Bug 1355819 - New regression test for editing selectors of @import'd rules; r=jdescottes

MozReview-Commit-ID: C1ScohI32tZ

--HG--
extra : rebase_source : 2f5a888162ca6431695af3203846c927a7460f9d
This commit is contained in:
Patrick Brosset 2017-05-22 15:10:00 +02:00
parent cba0ed3bd5
commit 3b06137e94
3 changed files with 53 additions and 0 deletions

View File

@ -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
@ -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]

View File

@ -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");
});

View File

@ -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>