From a31b063cceb5e62e1aa4aa7365093bf22669c5db Mon Sep 17 00:00:00 2001 From: Patrick Brosset Date: Tue, 23 Feb 2016 17:09:01 +0100 Subject: [PATCH] Bug 1246677 - 7 - Clean remaining ruleview and tests eslint warnings; r=jdescottes MozReview-Commit-ID: BcyEv4fUWJZ --HG-- extra : rebase_source : d589e9df51222df10db1e2095f5018d8c44bcb5a --- .eslintignore | 1 - devtools/client/inspector/rules/rules.js | 6 +- .../rules/test/browser_rules_authored.js | 4 +- .../test/browser_rules_authored_color.js | 4 +- .../test/browser_rules_authored_override.js | 4 +- ..._rules_colorpicker-and-image-tooltip_02.js | 4 -- ...browser_rules_colorpicker-edit-gradient.js | 5 +- ...rules_colorpicker-release-outside-frame.js | 3 +- .../test/browser_rules_computed-lists_02.js | 26 ++++--- .../rules/test/browser_rules_content_02.js | 24 ++++--- ...ser_rules_context-menu-show-mdn-docs-01.js | 2 - ...ser_rules_context-menu-show-mdn-docs-02.js | 10 ++- .../rules/test/browser_rules_copy_styles.js | 2 +- ...owser_rules_cubicbezier-commit-on-ENTER.js | 12 ++-- .../browser_rules_edit-property-increments.js | 62 +++++++++++----- .../browser_rules_editable-field-focus_02.js | 2 +- .../rules/test/browser_rules_eyedropper.js | 10 +-- .../browser_rules_inherited-properties_01.js | 2 - .../browser_rules_inherited-properties_02.js | 2 - .../test/browser_rules_pseudo-element_01.js | 45 ++++++------ .../test/browser_rules_refresh-no-flicker.js | 7 +- ...er_rules_refresh-on-attribute-change_02.js | 18 ++--- ...er_rules_search-filter-computed-list_01.js | 15 ++-- .../test/browser_rules_search-filter_01.js | 6 +- .../test/browser_rules_search-filter_08.js | 2 +- .../test/browser_rules_search-filter_10.js | 6 +- .../browser_rules_select-and-copy-styles.js | 4 +- .../test/browser_rules_selector_highlight.js | 2 - ...s_strict-search-filter-computed-list_01.js | 21 ++++-- .../browser_rules_strict-search-filter_01.js | 15 ++-- .../test/browser_rules_style-editor-link.js | 72 +++++++++---------- .../test/browser_rules_user-agent-styles.js | 29 ++++---- .../rules/test/doc_author-sheet.html | 18 ++--- .../rules/test/doc_content_stylesheet.html | 10 +-- .../inspector/rules/test/doc_cssom.html | 1 + .../inspector/rules/test/doc_frame_script.js | 23 +++--- devtools/client/inspector/rules/test/head.js | 12 ++-- devtools/client/inspector/test/head.js | 2 + testing/eslint-plugin-mozilla/lib/helpers.js | 19 +++-- 39 files changed, 288 insertions(+), 224 deletions(-) diff --git a/.eslintignore b/.eslintignore index c92509a36591..4467632742de 100644 --- a/.eslintignore +++ b/.eslintignore @@ -92,7 +92,6 @@ devtools/client/framework/** devtools/client/inspector/computed/** devtools/client/inspector/fonts/** devtools/client/inspector/markup/test/** -devtools/client/inspector/rules/** devtools/client/inspector/shared/test/** devtools/client/inspector/test/** devtools/client/inspector/*.js diff --git a/devtools/client/inspector/rules/rules.js b/devtools/client/inspector/rules/rules.js index bdca31f05fb7..0279be26c622 100644 --- a/devtools/client/inspector/rules/rules.js +++ b/devtools/client/inspector/rules/rules.js @@ -957,7 +957,7 @@ CssRuleView.prototype = { let elementStyle = this._elementStyle; return this._elementStyle.populate().then(() => { if (this._elementStyle !== elementStyle || this.isDestroyed) { - return; + return null; } this._clearRules(); @@ -1693,8 +1693,8 @@ RuleViewTool.prototype = { let target = this.inspector.target; if (Tools.styleEditor.isTargetSupported(target)) { gDevTools.showToolbox(target, "styleeditor").then(function(toolbox) { - let sheet = source || href; - toolbox.getCurrentPanel().selectStyleSheet(sheet, line, column); + let url = source || href; + toolbox.getCurrentPanel().selectStyleSheet(url, line, column); }); } return; diff --git a/devtools/client/inspector/rules/test/browser_rules_authored.js b/devtools/client/inspector/rules/test/browser_rules_authored.js index d3f769c8f12b..cb0dd11866e5 100644 --- a/devtools/client/inspector/rules/test/browser_rules_authored.js +++ b/devtools/client/inspector/rules/test/browser_rules_authored.js @@ -7,11 +7,11 @@ // Test for as-authored styles. function* createTestContent(style) { - let content = `
Styled Node
`; - yield addTab("data:text/html;charset=utf-8," + encodeURIComponent(content)); + yield addTab("data:text/html;charset=utf-8," + encodeURIComponent(html)); let {inspector, view} = yield openRuleView(); yield selectNode("#testid", inspector); diff --git a/devtools/client/inspector/rules/test/browser_rules_authored_color.js b/devtools/client/inspector/rules/test/browser_rules_authored_color.js index 320f0608b902..40c7bf75996e 100644 --- a/devtools/client/inspector/rules/test/browser_rules_authored_color.js +++ b/devtools/client/inspector/rules/test/browser_rules_authored_color.js @@ -7,12 +7,12 @@ // Test for as-authored styles. function* createTestContent(style) { - let content = `
Styled Node
`; let tab = yield addTab("data:text/html;charset=utf-8," + - encodeURIComponent(content)); + encodeURIComponent(html)); let {inspector, view} = yield openRuleView(); yield selectNode("#testid", inspector); diff --git a/devtools/client/inspector/rules/test/browser_rules_authored_override.js b/devtools/client/inspector/rules/test/browser_rules_authored_override.js index fec49996476a..7349d3ec7f76 100644 --- a/devtools/client/inspector/rules/test/browser_rules_authored_override.js +++ b/devtools/client/inspector/rules/test/browser_rules_authored_override.js @@ -7,11 +7,11 @@ // Test for as-authored styles. function* createTestContent(style) { - let content = `
Styled Node
`; - yield addTab("data:text/html;charset=utf-8," + encodeURIComponent(content)); + yield addTab("data:text/html;charset=utf-8," + encodeURIComponent(html)); let {inspector, view} = yield openRuleView(); yield selectNode("#testid", inspector); diff --git a/devtools/client/inspector/rules/test/browser_rules_colorpicker-and-image-tooltip_02.js b/devtools/client/inspector/rules/test/browser_rules_colorpicker-and-image-tooltip_02.js index 42df19281b7b..cef2646c1fa6 100644 --- a/devtools/client/inspector/rules/test/browser_rules_colorpicker-and-image-tooltip_02.js +++ b/devtools/client/inspector/rules/test/browser_rules_colorpicker-and-image-tooltip_02.js @@ -20,10 +20,6 @@ const TEST_URI = ` Testing the color picker tooltip! `; -const PAGE_CONTENT = [ - -].join("\n"); - add_task(function*() { yield addTab("data:text/html;charset=utf-8," + encodeURIComponent(TEST_URI)); let {view} = yield openRuleView(); diff --git a/devtools/client/inspector/rules/test/browser_rules_colorpicker-edit-gradient.js b/devtools/client/inspector/rules/test/browser_rules_colorpicker-edit-gradient.js index 65f5bacf28f2..8df35dfe7819 100644 --- a/devtools/client/inspector/rules/test/browser_rules_colorpicker-edit-gradient.js +++ b/devtools/client/inspector/rules/test/browser_rules_colorpicker-edit-gradient.js @@ -51,7 +51,7 @@ function* testPickingNewColor(view) { let swatchEl = ruleEl.valueSpan.querySelector(".ruleview-colorswatch"); let colorEl = ruleEl.valueSpan.querySelector(".ruleview-color"); - info("Getting the color picker tooltip and clicking on the swatch to show it"); + info("Get the color picker tooltip and clicking on the swatch to show it"); let cPicker = view.tooltips.colorPicker; let onShown = cPicker.tooltip.once("shown"); swatchEl.click(); @@ -60,7 +60,8 @@ function* testPickingNewColor(view) { let change = { selector: "body", name: "background-image", - value: "linear-gradient(to left, rgb(1, 1, 1) 25%, rgb(51, 51, 51) 95%, rgb(0, 0, 0) 100%)" + value: "linear-gradient(to left, rgb(1, 1, 1) 25%, " + + "rgb(51, 51, 51) 95%, rgb(0, 0, 0) 100%)" }; yield simulateColorPickerChange(view, cPicker, [1, 1, 1, 1], change); diff --git a/devtools/client/inspector/rules/test/browser_rules_colorpicker-release-outside-frame.js b/devtools/client/inspector/rules/test/browser_rules_colorpicker-release-outside-frame.js index 8e6c2e9f99ba..7d5e98de8f12 100644 --- a/devtools/client/inspector/rules/test/browser_rules_colorpicker-release-outside-frame.js +++ b/devtools/client/inspector/rules/test/browser_rules_colorpicker-release-outside-frame.js @@ -44,7 +44,8 @@ add_task(function*() { info("Moving mouse over color picker without any buttons pressed."); EventUtils.synthesizeMouse(spectrum.dragger, 10, 10, { - button: -1, // -1 = no buttons are pressed down + // -1 = no buttons are pressed down + button: -1, type: "mousemove", }, spectrum.dragger.ownerDocument.defaultView); }); diff --git a/devtools/client/inspector/rules/test/browser_rules_computed-lists_02.js b/devtools/client/inspector/rules/test/browser_rules_computed-lists_02.js index fd22e09765a2..abf8a62ffaee 100644 --- a/devtools/client/inspector/rules/test/browser_rules_computed-lists_02.js +++ b/devtools/client/inspector/rules/test/browser_rules_computed-lists_02.js @@ -31,7 +31,7 @@ function* testComputedList(inspector, view) { ok(!expander.hasAttribute("open"), "margin computed list is closed"); - info("Opening the computed list of margin property") + info("Opening the computed list of margin property"); expander.click(); ok(expander.hasAttribute("open"), "margin computed list is open"); @@ -45,22 +45,28 @@ function* testComputedList(inspector, view) { ]; is(computed.length, propNames.length, "There should be 4 computed values"); - is(computedDom.children.length, propNames.length, "There should be 4 nodes in the DOM"); + is(computedDom.children.length, propNames.length, + "There should be 4 nodes in the DOM"); + propNames.forEach((propName, i) => { let propValue = i + "px"; - is(computed[i].name, propName, "Computed property #" + i + " has name " + propName); - is(computed[i].value, propValue, "Computed property #" + i + " has value " + propValue); - is(computedDom.getElementsByClassName("ruleview-propertyname")[i].textContent, propName, - "Computed property #" + i + " in DOM has correct name"); - is(computedDom.getElementsByClassName("ruleview-propertyvalue")[i].textContent, propValue, - "Computed property #" + i + " in DOM has correct value"); + is(computed[i].name, propName, + "Computed property #" + i + " has name " + propName); + is(computed[i].value, propValue, + "Computed property #" + i + " has value " + propValue); + is(computedDom.querySelectorAll(".ruleview-propertyname")[i].textContent, + propName, + "Computed property #" + i + " in DOM has correct name"); + is(computedDom.querySelectorAll(".ruleview-propertyvalue")[i].textContent, + propValue, + "Computed property #" + i + " in DOM has correct value"); }); - info("Closing the computed list of margin property") + info("Closing the computed list of margin property"); expander.click(); ok(!expander.hasAttribute("open"), "margin computed list is closed"); - info("Opening the computed list of margin property") + info("Opening the computed list of margin property"); expander.click(); ok(expander.hasAttribute("open"), "margin computed list is open"); is(computed.length, propNames.length, "Still 4 computed values"); diff --git a/devtools/client/inspector/rules/test/browser_rules_content_02.js b/devtools/client/inspector/rules/test/browser_rules_content_02.js index 5c9d31409fa3..d1a7473d6f64 100644 --- a/devtools/client/inspector/rules/test/browser_rules_content_02.js +++ b/devtools/client/inspector/rules/test/browser_rules_content_02.js @@ -1,19 +1,21 @@ /* vim: set ft=javascript ts=2 et sw=2 tw=80: */ /* Any copyright is dedicated to the Public Domain. http://creativecommons.org/publicdomain/zero/1.0/ */ - +/* globals getTestActorWithoutToolbox */ "use strict"; // Test the rule-view content when the inspector gets opened via the page // ctx-menu "inspect element" -const CONTENT = '\ -
\ -

\ - test element\ -

\ -
\ - '; +const CONTENT = ` + +
+

+ test element +

+
+ +`; const STRINGS = Services.strings .createBundle("chrome://devtools-shared/locale/styleinspector.properties"); @@ -53,10 +55,12 @@ function checkRuleViewContent({styleDocument}) { "The rule's selector is correct"); let propertyNames = [...rule.querySelectorAll(".ruleview-propertyname")]; - is(propertyNames.length, 1, "There's only one property name, as expected"); + is(propertyNames.length, 1, + "There's only one property name, as expected"); let propertyValues = [...rule.querySelectorAll(".ruleview-propertyvalue")]; - is(propertyValues.length, 1, "There's only one property value, as expected"); + is(propertyValues.length, 1, + "There's only one property value, as expected"); } } diff --git a/devtools/client/inspector/rules/test/browser_rules_context-menu-show-mdn-docs-01.js b/devtools/client/inspector/rules/test/browser_rules_context-menu-show-mdn-docs-01.js index ba552e03b119..5e3890e17429 100644 --- a/devtools/client/inspector/rules/test/browser_rules_context-menu-show-mdn-docs-01.js +++ b/devtools/client/inspector/rules/test/browser_rules_context-menu-show-mdn-docs-01.js @@ -16,8 +16,6 @@ "use strict"; -const {setBaseCssDocsUrl} = require("devtools/client/shared/widgets/MdnDocsWidget"); - /** * The test document tries to confuse the context menu * code by having a tag called "padding" and a property diff --git a/devtools/client/inspector/rules/test/browser_rules_context-menu-show-mdn-docs-02.js b/devtools/client/inspector/rules/test/browser_rules_context-menu-show-mdn-docs-02.js index 24d7b28f0d1b..6963b0dd5e8e 100644 --- a/devtools/client/inspector/rules/test/browser_rules_context-menu-show-mdn-docs-02.js +++ b/devtools/client/inspector/rules/test/browser_rules_context-menu-show-mdn-docs-02.js @@ -17,7 +17,8 @@ "use strict"; -const {setBaseCssDocsUrl} = require("devtools/client/shared/widgets/MdnDocsWidget"); +const {setBaseCssDocsUrl} = + require("devtools/client/shared/widgets/MdnDocsWidget"); const PROPERTYNAME = "color"; @@ -70,6 +71,8 @@ function* testShowAndHideMdnTooltip(view) { info("Quick check that the tooltip contents are set"); let cssDocs = view.tooltips.cssDocs; + // FIXME: Remove the comment below when bug 1246896 is fixed. + /* eslint-disable mozilla/no-cpows-in-tests */ let tooltipDocument = cssDocs.tooltip.content.contentDocument; let h1 = tooltipDocument.getElementById("property-name"); is(h1.textContent, PROPERTYNAME, "The MDN docs tooltip h1 is correct"); @@ -80,8 +83,3 @@ function* testShowAndHideMdnTooltip(view) { yield onHidden; ok(true, "The MDN docs tooltip was hidden on pressing 'escape'"); } - -/** - * Returns the root element for the rule view. - */ -var rootElement = view => (view.element) ? view.element : view.styleDocument; diff --git a/devtools/client/inspector/rules/test/browser_rules_copy_styles.js b/devtools/client/inspector/rules/test/browser_rules_copy_styles.js index a2d1fe2630b7..b1c2f5ca8f0f 100644 --- a/devtools/client/inspector/rules/test/browser_rules_copy_styles.js +++ b/devtools/client/inspector/rules/test/browser_rules_copy_styles.js @@ -259,7 +259,7 @@ function* checkCopyStyle(view, node, menuItem, expectedPattern, hidden) { try { yield waitForClipboard(() => menuItem.click(), () => checkClipboardData(expectedPattern)); - } catch(e) { + } catch (e) { failedClipboard(expectedPattern); } diff --git a/devtools/client/inspector/rules/test/browser_rules_cubicbezier-commit-on-ENTER.js b/devtools/client/inspector/rules/test/browser_rules_cubicbezier-commit-on-ENTER.js index 87210f1623a3..953a9d0b57d6 100644 --- a/devtools/client/inspector/rules/test/browser_rules_cubicbezier-commit-on-ENTER.js +++ b/devtools/client/inspector/rules/test/browser_rules_cubicbezier-commit-on-ENTER.js @@ -56,9 +56,11 @@ function* testPressingEnterCommitsChanges(swatch, ruleView) { EventUtils.sendKey("RETURN", widget.parent.ownerDocument.defaultView); yield onRuleViewChanged; - is((yield getComputedStyleProperty("body", null, "transition-timing-function")), - expected, "The element's timing-function was kept after RETURN"); - ok(getRuleViewProperty(ruleView, "body", "transition").valueSpan.textContent - .indexOf("cubic-bezier(") !== -1, - "The text of the timing-function was kept after RETURN"); + let style = yield getComputedStyleProperty("body", null, + "transition-timing-function"); + is(style, expected, "The element's timing-function was kept after RETURN"); + + let ruleViewStyle = getRuleViewProperty(ruleView, "body", "transition") + .valueSpan.textContent.indexOf("cubic-bezier(") !== -1; + ok(ruleViewStyle, "The text of the timing-function was kept after RETURN"); } diff --git a/devtools/client/inspector/rules/test/browser_rules_edit-property-increments.js b/devtools/client/inspector/rules/test/browser_rules_edit-property-increments.js index 8ad8804c3b9c..7c6d98a7d245 100644 --- a/devtools/client/inspector/rules/test/browser_rules_edit-property-increments.js +++ b/devtools/client/inspector/rules/test/browser_rules_edit-property-increments.js @@ -51,7 +51,8 @@ function* testMarginIncrements(view) { 5: {down: true, start: "0px", end: "-1px", selectAll: true}, 6: {down: true, shift: true, start: "0px", end: "-10px", selectAll: true}, 7: {pageUp: true, shift: true, start: "0px", end: "100px", selectAll: true}, - 8: {pageDown: true, shift: true, start: "0px", end: "-100px", selectAll: true}, + 8: {pageDown: true, shift: true, start: "0px", end: "-100px", + selectAll: true}, 9: {start: "0", end: "1px", selectAll: true}, 10: {down: true, start: "0", end: "-1px", selectAll: true}, }); @@ -90,7 +91,8 @@ function* testHexIncrements(view) { 3: {start: "#CCCCCC", end: "#CDCCCC", selection: [1, 3]}, 4: {shift: true, start: "#CCCCCC", end: "#DCCCCC", selection: [1, 3]}, 5: {start: "#FFFFFF", end: "#FFFFFF", selectAll: true}, - 6: {down: true, shift: true, start: "#000000", end: "#000000", selectAll: true} + 6: {down: true, shift: true, start: "#000000", end: "#000000", + selectAll: true} }); } @@ -102,11 +104,14 @@ function* testRgbIncrements(view) { yield runIncrementTest(rgbColorPropEditor, view, { 1: {start: "rgb(0,0,0)", end: "rgb(0,1,0)", selection: [6, 7]}, - 2: {shift: true, start: "rgb(0,0,0)", end: "rgb(0,10,0)", selection: [6, 7]}, + 2: {shift: true, start: "rgb(0,0,0)", end: "rgb(0,10,0)", + selection: [6, 7]}, 3: {start: "rgb(0,255,0)", end: "rgb(0,255,0)", selection: [6, 9]}, - 4: {shift: true, start: "rgb(0,250,0)", end: "rgb(0,255,0)", selection: [6, 9]}, + 4: {shift: true, start: "rgb(0,250,0)", end: "rgb(0,255,0)", + selection: [6, 9]}, 5: {down: true, start: "rgb(0,0,0)", end: "rgb(0,0,0)", selection: [6, 7]}, - 6: {down: true, shift: true, start: "rgb(0,5,0)", end: "rgb(0,0,0)", selection: [6, 7]} + 6: {down: true, shift: true, start: "rgb(0,5,0)", end: "rgb(0,0,0)", + selection: [6, 7]} }); } @@ -118,14 +123,21 @@ function* testShorthandIncrements(view) { yield runIncrementTest(paddingPropEditor, view, { 1: {start: "0px 0px 0px 0px", end: "0px 1px 0px 0px", selection: [4, 7]}, - 2: {shift: true, start: "0px 0px 0px 0px", end: "0px 10px 0px 0px", selection: [4, 7]}, + 2: {shift: true, start: "0px 0px 0px 0px", end: "0px 10px 0px 0px", + selection: [4, 7]}, 3: {start: "0px 0px 0px 0px", end: "1px 0px 0px 0px", selectAll: true}, - 4: {shift: true, start: "0px 0px 0px 0px", end: "10px 0px 0px 0px", selectAll: true}, - 5: {down: true, start: "0px 0px 0px 0px", end: "0px 0px -1px 0px", selection: [8, 11]}, - 6: {down: true, shift: true, start: "0px 0px 0px 0px", end: "-10px 0px 0px 0px", selectAll: true}, - 7: {up: true, start: "0.1em .1em 0em 0em", end: "0.1em 1.1em 0em 0em", selection: [6, 9]}, - 8: {up: true, alt: true, start: "0.1em .9em 0em 0em", end: "0.1em 1em 0em 0em", selection: [6, 9]}, - 9: {up: true, shift: true, start: "0.2em .2em 0em 0em", end: "0.2em 10.2em 0em 0em", selection: [6, 9]} + 4: {shift: true, start: "0px 0px 0px 0px", end: "10px 0px 0px 0px", + selectAll: true}, + 5: {down: true, start: "0px 0px 0px 0px", end: "0px 0px -1px 0px", + selection: [8, 11]}, + 6: {down: true, shift: true, start: "0px 0px 0px 0px", + end: "-10px 0px 0px 0px", selectAll: true}, + 7: {up: true, start: "0.1em .1em 0em 0em", end: "0.1em 1.1em 0em 0em", + selection: [6, 9]}, + 8: {up: true, alt: true, start: "0.1em .9em 0em 0em", + end: "0.1em 1em 0em 0em", selection: [6, 9]}, + 9: {up: true, shift: true, start: "0.2em .2em 0em 0em", + end: "0.2em 10.2em 0em 0em", selection: [6, 9]} }); } @@ -143,13 +155,19 @@ function* testOddCases(view) { 5: {start: "'a=-1'", end: "'a=0'", selection: [4, 4]}, 6: {start: "0 -1px", end: "0 0px", selection: [2, 2]}, 7: {start: "url(-1)", end: "url(-1)", selection: [4, 4]}, - 8: {start: "url('test1.1.png')", end: "url('test1.2.png')", selection: [11, 11]}, + 8: {start: "url('test1.1.png')", end: "url('test1.2.png')", + selection: [11, 11]}, 9: {start: "url('test1.png')", end: "url('test2.png')", selection: [9, 9]}, - 10: {shift: true, start: "url('test1.1.png')", end: "url('test11.1.png')", selection: [9, 9]}, - 11: {down: true, start: "url('test-1.png')", end: "url('test-2.png')", selection: [9, 11]}, - 12: {start: "url('test1.1.png')", end: "url('test1.2.png')", selection: [11, 12]}, - 13: {down: true, alt: true, start: "url('test-0.png')", end: "url('test--0.1.png')", selection: [10, 11]}, - 14: {alt: true, start: "url('test--0.1.png')", end: "url('test-0.png')", selection: [10, 14]}, + 10: {shift: true, start: "url('test1.1.png')", end: "url('test11.1.png')", + selection: [9, 9]}, + 11: {down: true, start: "url('test-1.png')", end: "url('test-2.png')", + selection: [9, 11]}, + 12: {start: "url('test1.1.png')", end: "url('test1.2.png')", + selection: [11, 12]}, + 13: {down: true, alt: true, start: "url('test-0.png')", + end: "url('test--0.1.png')", selection: [10, 11]}, + 14: {alt: true, start: "url('test--0.1.png')", end: "url('test-0.png')", + selection: [10, 14]} }); } @@ -216,9 +234,15 @@ function* testIncrement(editor, options, view) { let onRuleViewChanged = view.once("ruleview-changed"); let onKeyUp = once(input, "keyup"); + let key; key = options.down ? "VK_DOWN" : "VK_UP"; - key = options.pageDown ? "VK_PAGE_DOWN" : options.pageUp ? "VK_PAGE_UP" : key; + if (options.pageDown) { + key = "VK_PAGE_DOWN"; + } else if (options.pageUp) { + key = "VK_PAGE_UP"; + } + EventUtils.synthesizeKey(key, {altKey: options.alt, shiftKey: options.shift}, view.styleWindow); yield onKeyUp; diff --git a/devtools/client/inspector/rules/test/browser_rules_editable-field-focus_02.js b/devtools/client/inspector/rules/test/browser_rules_editable-field-focus_02.js index bb2d58a0919f..66b03e0ae258 100644 --- a/devtools/client/inspector/rules/test/browser_rules_editable-field-focus_02.js +++ b/devtools/client/inspector/rules/test/browser_rules_editable-field-focus_02.js @@ -29,7 +29,7 @@ add_task(function*() { yield testEditableFieldFocus(inspector, view, "VK_TAB", { shiftKey: true }); }); -function* testEditableFieldFocus(inspector, view, commitKey, options={}) { +function* testEditableFieldFocus(inspector, view, commitKey, options = {}) { let ruleEditor = getRuleViewRuleEditor(view, 2); let editor = yield focusEditableField(view, ruleEditor.selectorText); is(inplaceEditor(ruleEditor.selectorText), editor, diff --git a/devtools/client/inspector/rules/test/browser_rules_eyedropper.js b/devtools/client/inspector/rules/test/browser_rules_eyedropper.js index da4da18bdedc..50d41ca6bde0 100644 --- a/devtools/client/inspector/rules/test/browser_rules_eyedropper.js +++ b/devtools/client/inspector/rules/test/browser_rules_eyedropper.js @@ -10,8 +10,6 @@ Services.telemetry.canRecordExtended = true; registerCleanupFunction(function() { Services.telemetry.canRecordExtended = oldCanRecord; }); -const HISTOGRAM_ID = "DEVTOOLS_PICKER_EYEDROPPER_OPENED_COUNT"; -const FLAG_HISTOGRAM_ID = "DEVTOOLS_PICKER_EYEDROPPER_OPENED_PER_USER_FLAG"; const EXPECTED_TELEMETRY = { "DEVTOOLS_PICKER_EYEDROPPER_OPENED_COUNT": 2, "DEVTOOLS_PICKER_EYEDROPPER_OPENED_PER_USER_FLAG": 1 @@ -40,8 +38,10 @@ const TEST_URI = `
`; -const ORIGINAL_COLOR = "rgb(255, 0, 153)"; // #f09 -const EXPECTED_COLOR = "rgb(255, 255, 85)"; // #ff5 +// #f09 +const ORIGINAL_COLOR = "rgb(255, 0, 153)"; +// #ff5 +const EXPECTED_COLOR = "rgb(255, 255, 85)"; // Test opening the eyedropper from the color picker. Pressing escape // to close it, and clicking the page to select a color. @@ -147,7 +147,7 @@ function openEyedropper(view, swatch) { return deferred.promise; } -function inspectPage(dropper, click=true) { +function inspectPage(dropper, click = true) { let target = document.documentElement; let win = window; diff --git a/devtools/client/inspector/rules/test/browser_rules_inherited-properties_01.js b/devtools/client/inspector/rules/test/browser_rules_inherited-properties_01.js index eee571864224..f4af8543c974 100644 --- a/devtools/client/inspector/rules/test/browser_rules_inherited-properties_01.js +++ b/devtools/client/inspector/rules/test/browser_rules_inherited-properties_01.js @@ -7,8 +7,6 @@ // Check that inherited properties appear for a nested element in the // rule view. -var {ELEMENT_STYLE} = require("devtools/server/actors/styles"); - const TEST_URI = `
', - '', - '', - '', - '', - '', - '', - '

Some header text

', - '

hi.

', - '

I am a test-case. This text exists ', - 'solely to provide some things to ', - '', - 'highlight and count ', - 'style list-items in the box at right. If you are reading this, ', - 'you should go do something else instead. Maybe read a book. Or better ', - 'yet, write some test-cases for another bit of code. ', - 'some text

', - '

more text

', - '

even more text

', - '
', - '', - ''].join("\n")); +const DOCUMENT_URL = "data:text/html;charset=utf-8," + encodeURIComponent(` + + + Rule view style editor link test +
+ + + + + + +

Some header text

+

hi.

+

I am a test-case. This text exists + solely to provide some things to + + highlight and count + style list-items in the box at right. If you are reading this, + you should go do something else instead. Maybe read a book. Or better + yet, write some test-cases for another bit of code. + some text

+

more text

+

even more text

+
+ + +`); add_task(function*() { yield addTab(DOCUMENT_URL); diff --git a/devtools/client/inspector/rules/test/browser_rules_user-agent-styles.js b/devtools/client/inspector/rules/test/browser_rules_user-agent-styles.js index 812ce0f5dc46..ee6c1c8aa89c 100644 --- a/devtools/client/inspector/rules/test/browser_rules_user-agent-styles.js +++ b/devtools/client/inspector/rules/test/browser_rules_user-agent-styles.js @@ -110,17 +110,20 @@ function* userAgentStylesVisible(inspector, view) { ok(uaRules.length > data.numUARules, "Has UA rules"); } - ok(userRules.some(rule=> rule.matchedSelectors.length === 1), + ok(userRules.some(rule => rule.matchedSelectors.length === 1), "There is an inline style for element in user styles"); // These tests rely on the "a" selector being the last test in // TEST_DATA. - ok(uaRules.some(rule=> rule.matchedSelectors.indexOf(":-moz-any-link") !== -1), - "There is a rule for :-moz-any-link"); - ok(uaRules.some(rule=> rule.matchedSelectors.indexOf("*|*:link") !== -1), - "There is a rule for *|*:link"); - ok(uaRules.some(rule=> rule.matchedSelectors.length === 1), - "Inline styles for ua styles"); + ok(uaRules.some(rule => { + return rule.matchedSelectors.indexOf(":-moz-any-link") !== -1; + }), "There is a rule for :-moz-any-link"); + ok(uaRules.some(rule => { + return rule.matchedSelectors.indexOf("*|*:link") !== -1; + }), "There is a rule for *|*:link"); + ok(uaRules.some(rule => { + return rule.matchedSelectors.length === 1; + }), "Inline styles for ua styles"); } function* userAgentStylesNotVisible(inspector, view) { @@ -144,11 +147,13 @@ function* compareAppliedStylesWithUI(inspector, view, filter) { info("Making sure that UI is consistent with pageStyle.getApplied"); let entries = yield inspector.pageStyle.getApplied( - inspector.selection.nodeFront, { - inherited: true, - matchedSelectors: true, - filter: filter - }); + inspector.selection.nodeFront, + { + inherited: true, + matchedSelectors: true, + filter: filter + } + ); // We may see multiple entries that map to a given rule; filter the // duplicates here to match what the UI does. diff --git a/devtools/client/inspector/rules/test/doc_author-sheet.html b/devtools/client/inspector/rules/test/doc_author-sheet.html index a4d095978916..f8c2eadd53a9 100644 --- a/devtools/client/inspector/rules/test/doc_author-sheet.html +++ b/devtools/client/inspector/rules/test/doc_author-sheet.html @@ -11,16 +11,16 @@ diff --git a/devtools/client/inspector/rules/test/doc_content_stylesheet.html b/devtools/client/inspector/rules/test/doc_content_stylesheet.html index 3d3b132d6133..3ea65f606553 100644 --- a/devtools/client/inspector/rules/test/doc_content_stylesheet.html +++ b/devtools/client/inspector/rules/test/doc_content_stylesheet.html @@ -5,13 +5,15 @@ diff --git a/devtools/client/inspector/rules/test/doc_cssom.html b/devtools/client/inspector/rules/test/doc_cssom.html index 4a2dad60f5ef..65d4dfb7d2d5 100644 --- a/devtools/client/inspector/rules/test/doc_cssom.html +++ b/devtools/client/inspector/rules/test/doc_cssom.html @@ -5,6 +5,7 @@ CSSOM test