Backed out changeset dd1efa762e49 (bug 1333683) for failing the browser_color_widget test a=backout
authorWes Kocher <wkocher@mozilla.com>
Wed, 25 Jan 2017 15:52:12 -0800
changeset 466656 6057588e27441ec4ce22e05b5a9f7eee7774995b
parent 466655 ad0c4806133ae96c62f4ecc47229d19887934b70
child 466657 2740c0e269054538fe69c6ed5b6afe82d9407370
push id42948
push userbmo:gasolin@mozilla.com
push dateThu, 26 Jan 2017 07:49:21 +0000
reviewersbackout
bugs1333683
milestone54.0a1
backs outdd1efa762e490f5d46aecca694150f993ab458b6
Backed out changeset dd1efa762e49 (bug 1333683) for failing the browser_color_widget test a=backout MozReview-Commit-ID: 1am5MdTLodU
devtools/client/shared/test/browser.ini
devtools/client/shared/test/browser_color_widget.js
--- a/devtools/client/shared/test/browser.ini
+++ b/devtools/client/shared/test/browser.ini
@@ -18,17 +18,16 @@ support-files =
   html-mdn-css-no-summary-or-syntax.html
   html-mdn-css-no-syntax.html
   html-mdn-css-syntax-old-style.html
   leakhunt.js
   test-actor.js
   test-actor-registry.js
   !/devtools/client/framework/test/shared-head.js
 
-[browser_color_widget.js]
 [browser_css_angle.js]
 [browser_css_color.js]
 [browser_cubic-bezier-01.js]
 [browser_cubic-bezier-02.js]
 [browser_cubic-bezier-03.js]
 [browser_cubic-bezier-04.js]
 [browser_cubic-bezier-05.js]
 [browser_cubic-bezier-06.js]
deleted file mode 100644
--- a/devtools/client/shared/test/browser_color_widget.js
+++ /dev/null
@@ -1,114 +0,0 @@
-/* vim: set ts=2 et sw=2 tw=80: */
-/* Any copyright is dedicated to the Public Domain.
-   http://creativecommons.org/publicdomain/zero/1.0/ */
-
-"use strict";
-
-// Tests that the color widget works correctly.
-
-const {ColorWidget} = require("devtools/client/shared/widgets/ColorWidget");
-
-const TEST_URI = `data:text/html,
-  <link rel="stylesheet" href="chrome://devtools/content/shared/widgets/color-widget.css" type="text/css"/>
-  <div id="colorwidget-container" />`;
-
-add_task(function* () {
-  let [host,, doc] = yield createHost("bottom", TEST_URI);
-
-  let container = doc.getElementById("colorwidget-container");
-
-  yield testCreateAndDestroyShouldAppendAndRemoveElements(container);
-  yield testPassingAColorAtInitShouldSetThatColor(container);
-  yield testSettingAndGettingANewColor(container);
-  yield testChangingColorShouldEmitEvents(container);
-  yield testSettingColorShoudUpdateTheUI(container);
-
-  host.destroy();
-});
-
-function testCreateAndDestroyShouldAppendAndRemoveElements(container) {
-  ok(container, "We have the root node to append color widget to");
-  is(container.childElementCount, 0, "Root node is empty");
-
-  let cw = new ColorWidget(container, [255, 126, 255, 1]);
-  cw.show();
-  ok(container.childElementCount > 0, "Color widget has appended elements");
-
-  cw.destroy();
-  is(container.childElementCount, 0, "Destroying color widget removed all nodes");
-}
-
-function testPassingAColorAtInitShouldSetThatColor(container) {
-  let initRgba = [255, 126, 255, 1];
-
-  let cw = new ColorWidget(container, initRgba);
-  cw.show();
-
-  let setRgba = cw.rgb;
-
-  is(initRgba[0], setRgba[0], "Color widget initialized with the right color");
-  is(initRgba[1], setRgba[1], "Color widget initialized with the right color");
-  is(initRgba[2], setRgba[2], "Color widget initialized with the right color");
-  is(initRgba[3], setRgba[3], "Color widget initialized with the right color");
-
-  cw.destroy();
-}
-
-function testSettingAndGettingANewColor(container) {
-  let cw = new ColorWidget(container, [0, 0, 0, 1]);
-  cw.show();
-
-  let colorToSet = [255, 255, 255, 1];
-  cw.rgb = colorToSet;
-  let newColor = cw.rgb;
-
-  is(colorToSet[0], newColor[0], "Color widget set with the right color");
-  is(colorToSet[1], newColor[1], "Color widget set with the right color");
-  is(colorToSet[2], newColor[2], "Color widget set with the right color");
-  is(colorToSet[3], newColor[3], "Color widget set with the right color");
-
-  cw.destroy();
-}
-
-function testChangingColorShouldEmitEvents(container) {
-  return new Promise(resolve => {
-    let cw = new ColorWidget(container, [255, 255, 255, 1]);
-    cw.show();
-
-    cw.once("changed", (event, rgba, color) => {
-      ok(true, "Changed event was emitted on color change");
-      is(rgba[0], 128, "New color is correct");
-      is(rgba[1], 64, "New color is correct");
-      is(rgba[2], 64, "New color is correct");
-      is(rgba[3], 1, "New color is correct");
-      is(`rgba(${rgba.join(", ")})`, color, "RGBA and css color correspond");
-
-      cw.destroy();
-      resolve();
-    });
-
-    // Simulate a drag move event by calling the handler directly.
-    cw.onDraggerMove(cw.dragger.offsetWidth / 2, cw.dragger.offsetHeight / 2);
-  });
-}
-
-function testSettingColorShoudUpdateTheUI(container) {
-  let cw = new ColorWidget(container, [255, 255, 255, 1]);
-  cw.show();
-  let dragHelperOriginalPos = [cw.dragHelper.style.top, cw.dragHelper.style.left];
-  let alphaHelperOriginalPos = cw.alphaSliderHelper.style.left;
-
-  cw.rgb = [50, 240, 234, .2];
-  cw.updateUI();
-
-  ok(cw.alphaSliderHelper.style.left != alphaHelperOriginalPos, "Alpha helper has moved");
-  ok(cw.dragHelper.style.top !== dragHelperOriginalPos[0], "Drag helper has moved");
-  ok(cw.dragHelper.style.left !== dragHelperOriginalPos[1], "Drag helper has moved");
-
-  cw.rgb = [240, 32, 124, 0];
-  cw.updateUI();
-  is(cw.alphaSliderHelper.style.left, -(cw.alphaSliderHelper.offsetWidth / 2) + "px",
-    "Alpha range UI has been updated again");
-
-  cw.destroy();
-}