diff options
author | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
---|---|---|
committer | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
commit | 5f8de423f190bbb79a62f804151bc24824fa32d8 (patch) | |
tree | 10027f336435511475e392454359edea8e25895d /devtools/client/inspector/test/browser_inspector_highlighter-eyedropper-xul.js | |
parent | 49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff) | |
download | UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip |
Add m-esr52 at 52.6.0
Diffstat (limited to 'devtools/client/inspector/test/browser_inspector_highlighter-eyedropper-xul.js')
-rw-r--r-- | devtools/client/inspector/test/browser_inspector_highlighter-eyedropper-xul.js | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/devtools/client/inspector/test/browser_inspector_highlighter-eyedropper-xul.js b/devtools/client/inspector/test/browser_inspector_highlighter-eyedropper-xul.js new file mode 100644 index 000000000..7c44e7275 --- /dev/null +++ b/devtools/client/inspector/test/browser_inspector_highlighter-eyedropper-xul.js @@ -0,0 +1,64 @@ +/* Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ */ + +"use strict"; + +// Test that the eyedropper icons in the toolbar and in the color picker aren't displayed +// when the page isn't an HTML one. + +const TEST_URL = URL_ROOT + "doc_inspector_highlighter_xbl.xul"; +const TEST_URL_2 = + "data:text/html;charset=utf-8,<h1 style='color:red'>HTML test page</h1>"; + +add_task(function* () { + let {inspector} = yield openInspectorForURL(TEST_URL); + + info("Check the inspector toolbar"); + let button = inspector.panelDoc.querySelector("#inspector-eyedropper-toggle"); + ok(isDisabled(button), "The button is hidden in the toolbar"); + + info("Check the color picker"); + yield selectNode("#scale", inspector); + + // Find the color swatch in the rule-view. + let ruleView = inspector.ruleview.view; + let ruleViewDocument = ruleView.styleDocument; + let swatchEl = ruleViewDocument.querySelector(".ruleview-colorswatch"); + + info("Open the color picker"); + let cPicker = ruleView.tooltips.colorPicker; + let onColorPickerReady = cPicker.once("ready"); + swatchEl.click(); + yield onColorPickerReady; + + button = cPicker.tooltip.doc.querySelector("#eyedropper-button"); + ok(isDisabled(button), "The button is disabled in the color picker"); + + info("Navigate to a HTML document"); + yield navigateTo(inspector, TEST_URL_2); + + info("Check the inspector toolbar in HTML document"); + button = inspector.panelDoc.querySelector("#inspector-eyedropper-toggle"); + ok(!isDisabled(button), "The button is enabled in the toolbar"); + + info("Check the color picker in HTML document"); + // Find the color swatch in the rule-view. + yield selectNode("h1", inspector); + + ruleView = inspector.ruleview.view; + ruleViewDocument = ruleView.styleDocument; + swatchEl = ruleViewDocument.querySelector(".ruleview-colorswatch"); + + info("Open the color picker in HTML document"); + cPicker = ruleView.tooltips.colorPicker; + onColorPickerReady = cPicker.once("ready"); + swatchEl.click(); + yield onColorPickerReady; + + button = cPicker.tooltip.doc.querySelector("#eyedropper-button"); + ok(!isDisabled(button), "The button is enabled in the color picker"); +}); + +function isDisabled(button) { + return button.disabled; +} |