зеркало из https://github.com/mozilla/gecko-dev.git
Bug 828008 - Fix browser_styleeditor_media_sidebar_links.js by properly waiting for contentResize. r=jryans
MozReview-Commit-ID: 4rT9F3u1c6F
This commit is contained in:
Родитель
8c0c6e78fe
Коммит
d5396968a9
|
@ -47,19 +47,17 @@ function* testMediaLink(editor, tab, ui, itemIndex, type, value) {
|
|||
let conditions = sidebar.querySelectorAll(".media-rule-condition");
|
||||
|
||||
let onMediaChange = once("media-list-changed", ui);
|
||||
let ruiEvent = !ResponsiveUIManager.isActiveForTab(tab) ?
|
||||
once("on", ResponsiveUIManager) :
|
||||
once("contentResize", ResponsiveUIManager);
|
||||
let onContentResize = waitForResizeTo(ResponsiveUIManager, type, value);
|
||||
|
||||
info("Launching responsive mode");
|
||||
conditions[itemIndex].querySelector(responsiveModeToggleClass).click();
|
||||
|
||||
info("Waiting for the @media list to update");
|
||||
yield ruiEvent;
|
||||
yield onMediaChange;
|
||||
|
||||
ResponsiveUIManager.getResponsiveUIForTab(tab).transitionsEnabled = false;
|
||||
|
||||
info("Waiting for the @media list to update");
|
||||
yield onMediaChange;
|
||||
yield onContentResize;
|
||||
|
||||
ok(ResponsiveUIManager.isActiveForTab(tab),
|
||||
"Responsive mode should be active.");
|
||||
conditions = sidebar.querySelectorAll(".media-rule-condition");
|
||||
|
@ -91,6 +89,21 @@ function doFinalChecks(editor) {
|
|||
}
|
||||
|
||||
/* Helpers */
|
||||
function waitForResizeTo(manager, type, value) {
|
||||
return new Promise(resolve => {
|
||||
let onResize = (_, data) => {
|
||||
if (data[type] != value) {
|
||||
return;
|
||||
}
|
||||
manager.off("contentResize", onResize);
|
||||
info(`Got contentResize to a ${type} of ${value}`);
|
||||
resolve();
|
||||
};
|
||||
info(`Waiting for contentResize to a ${type} of ${value}`);
|
||||
manager.on("contentResize", onResize);
|
||||
});
|
||||
}
|
||||
|
||||
function* getSizing() {
|
||||
let browser = gBrowser.selectedBrowser;
|
||||
let sizing = yield ContentTask.spawn(browser, {}, function*() {
|
||||
|
|
Загрузка…
Ссылка в новой задаче