Bug 1243749 - Enable 2 rule-view test with e10s and fix unhandled rejected promises; r=miker

--HG--
extra : commitid : IdcJNcbTgsY
extra : rebase_source : 5cb0f048674e014ecb422a37e97357903871101c
This commit is contained in:
Patrick Brosset 2016-01-28 16:19:01 +01:00
parent f71bb0acdf
commit d3313fce23
2 changed files with 40 additions and 25 deletions

View File

@ -110,7 +110,7 @@ skip-if = e10s # Bug 1039528: "inspect element" contextual-menu doesn't work wit
[browser_rules_filtereditor-appears-on-swatch-click.js]
[browser_rules_filtereditor-commit-on-ENTER.js]
[browser_rules_filtereditor-revert-on-ESC.js]
skip-if = (os == "win" && debug) || e10s # bug 963492: win. bug 1040653: e10s.
skip-if = (os == "win" && debug) # bug 963492: win.
[browser_rules_guessIndentation.js]
[browser_rules_inherited-properties_01.js]
[browser_rules_inherited-properties_02.js]
@ -172,7 +172,6 @@ skip-if = (os == "win" && debug) || e10s # bug 963492: win. bug 1040653: e10s.
[browser_rules_strict-search-filter_02.js]
[browser_rules_strict-search-filter_03.js]
[browser_rules_style-editor-link.js]
skip-if = e10s # bug 1040670 Cannot open inline styles in viewSourceUtils
[browser_rules_urls-clickable.js]
[browser_rules_user-agent-styles.js]
[browser_rules_user-agent-styles-uneditable.js]

View File

@ -19,23 +19,15 @@ function* testPressingEscapeRevertsChanges(view) {
let ruleEditor = getRuleViewRuleEditor(view, 1);
let propEditor = ruleEditor.rule.textProps[0].editor;
let swatch = propEditor.valueSpan.querySelector(".ruleview-filterswatch");
let filterTooltip = view.tooltips.filterEditor;
let onShow = filterTooltip.tooltip.once("shown");
swatch.click();
yield onShow;
let widget = yield filterTooltip.widget;
widget.setCssValue("blur(2px)");
yield ruleEditor.rule._applyingModifications;
yield clickOnFilterSwatch(swatch, view);
yield setValueInFilterWidget("blur(2px)", view);
yield waitForComputedStyleProperty("body", null, "filter", "blur(2px)");
is(propEditor.valueSpan.textContent, "blur(2px)",
"Got expected property value.");
info("Pressing ESCAPE to close the tooltip");
EventUtils.sendKey("ESCAPE", widget.styleWindow);
yield ruleEditor.rule._applyingModifications;
yield pressEscapeToCloseTooltip(view);
yield waitForComputedStyleProperty("body", null, "filter",
"blur(2px) contrast(2)");
@ -47,11 +39,11 @@ function* testPressingEscapeRevertsChangesAndDisables(view) {
let ruleEditor = getRuleViewRuleEditor(view, 1);
let propEditor = ruleEditor.rule.textProps[0].editor;
let swatch = propEditor.valueSpan.querySelector(".ruleview-filterswatch");
let filterTooltip = view.tooltips.filterEditor;
info("Disabling filter property");
let onRuleViewChanged = view.once("ruleview-changed");
propEditor.enable.click();
yield ruleEditor.rule._applyingModifications;
yield onRuleViewChanged;
ok(propEditor.element.classList.contains("ruleview-overridden"),
"property is overridden.");
@ -64,22 +56,15 @@ function* testPressingEscapeRevertsChangesAndDisables(view) {
let newValue = yield getRulePropertyValue("filter");
is(newValue, "", "filter should have been unset.");
let onShow = filterTooltip.tooltip.once("shown");
swatch.click();
yield onShow;
yield clickOnFilterSwatch(swatch, view);
ok(!propEditor.element.classList.contains("ruleview-overridden"),
"property overridden is not displayed.");
is(propEditor.enable.style.visibility, "hidden",
"property enable checkbox is hidden.");
let widget = yield filterTooltip.widget;
widget.setCssValue("blur(2px)");
yield ruleEditor.rule._applyingModifications;
info("Pressing ESCAPE to close the tooltip");
EventUtils.sendKey("ESCAPE", widget.styleWindow);
yield ruleEditor.rule._applyingModifications;
yield setValueInFilterWidget("blur(2px)", view);
yield pressEscapeToCloseTooltip(view);
ok(propEditor.element.classList.contains("ruleview-overridden"),
"property is overridden.");
@ -102,3 +87,34 @@ function* getRulePropertyValue(name) {
});
return propValue;
}
function* clickOnFilterSwatch(swatch, view) {
info("Clicking on a css filter swatch to open the tooltip");
// Clicking on a cssfilter swatch sets the current filter value in the tooltip
// which, in turn, makes the FilterWidget emit an "updated" event that causes
// the rule-view to refresh. So we must wait for the ruleview-changed event.
let onRuleViewChanged = view.once("ruleview-changed");
swatch.click();
yield onRuleViewChanged;
}
function* setValueInFilterWidget(value, view) {
info("Setting the CSS filter value in the tooltip");
let filterTooltip = view.tooltips.filterEditor;
let widget = yield filterTooltip.widget;
let onRuleViewChanged = view.once("ruleview-changed");
widget.setCssValue(value);
yield onRuleViewChanged;
}
function* pressEscapeToCloseTooltip(view) {
info("Pressing ESCAPE to close the tooltip");
let filterTooltip = view.tooltips.filterEditor;
let widget = yield filterTooltip.widget;
let onRuleViewChanged = view.once("ruleview-changed");
EventUtils.sendKey("ESCAPE", widget.styleWindow);
yield onRuleViewChanged;
}