Skip to content

Commit

Permalink
Bug 1355819 - New regression test for editing selectors of @import'd …
Browse files Browse the repository at this point in the history
…rules; r=jdescottes

MozReview-Commit-ID: C1ScohI32tZ
  • Loading branch information
Patrick Brosset committed May 22, 2017
1 parent 688f021 commit 7a999ec
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 0 deletions.
2 changes: 2 additions & 0 deletions devtools/client/inspector/rules/test/browser.ini
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ support-files =
doc_copystyles.html
doc_cssom.html
doc_custom.html
doc_edit_imported_selector.html
doc_filter.html
doc_frame_script.js
doc_inline_sourcemap.html
Expand Down Expand Up @@ -140,6 +141,7 @@ skip-if = os == "mac" # Bug 1245996 : click on scrollbar not working on OSX
[browser_rules_edit-selector_09.js]
[browser_rules_edit-selector_10.js]
[browser_rules_edit-selector_11.js]
[browser_rules_edit-selector_12.js]
[browser_rules_edit-value-after-name_01.js]
[browser_rules_edit-value-after-name_02.js]
[browser_rules_edit-value-after-name_03.js]
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/* 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/ */

"use strict";

// Test editing selectors for rules inside @import'd stylesheets.
// This is a regression test for bug 1355819.

add_task(function* () {
yield addTab(URL_ROOT + "doc_edit_imported_selector.html");
let {inspector, view} = yield openRuleView();

info("Select the node styled by an @import'd rule");
yield selectNode("#target", inspector);

info("Focus the selector in the rule-view");
let ruleEditor = getRuleViewRuleEditor(view, 1);
let editor = yield focusEditableField(view, ruleEditor.selectorText);

info("Change the selector to something else");
editor.input.value = "div";
let onRuleViewChanged = once(view, "ruleview-changed");
EventUtils.synthesizeKey("VK_RETURN", {});
yield onRuleViewChanged;

info("Escape the new property editor after editing the selector");
let onBlur = once(view.styleDocument.activeElement, "blur");
EventUtils.synthesizeKey("VK_ESCAPE", {}, view.styleWindow);
yield onBlur;

info("Check the rules are still displayed correctly");
is(view._elementStyle.rules.length, 3, "The element still has 3 rules.");

ruleEditor = getRuleViewRuleEditor(view, 1);
is(ruleEditor.element.getAttribute("unmatched"), "false", "Rule editor is matched.");
is(ruleEditor.selectorText.textContent, "div", "The new selector is correct");
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!-- Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ -->
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Edit a selector in an imported stylesheet</title>
<link rel="stylesheet" type="text/css" href="doc_content_stylesheet_script.css">
</head>
<body>
<div id="target">Styled node</div>
</body>
</html>

0 comments on commit 7a999ec

Please sign in to comment.