forked from Floorp-Projects/Floorp
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bug 1355819 - New regression test for editing selectors of @import'd …
…rules; r=jdescottes MozReview-Commit-ID: C1ScohI32tZ
- Loading branch information
Patrick Brosset
committed
May 22, 2017
1 parent
688f021
commit 7a999ec
Showing
3 changed files
with
53 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
devtools/client/inspector/rules/test/browser_rules_edit-selector_12.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"); | ||
}); |
13 changes: 13 additions & 0 deletions
13
devtools/client/inspector/rules/test/doc_edit_imported_selector.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |