зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1021202 - Turn @media sidebar on by default; r=bgrins
This commit is contained in:
Родитель
bc2f010f44
Коммит
b7cfaf03f1
|
@ -1343,7 +1343,7 @@ pref("devtools.scratchpad.enableAutocompletion", true);
|
||||||
pref("devtools.styleeditor.enabled", true);
|
pref("devtools.styleeditor.enabled", true);
|
||||||
pref("devtools.styleeditor.source-maps-enabled", false);
|
pref("devtools.styleeditor.source-maps-enabled", false);
|
||||||
pref("devtools.styleeditor.autocompletion-enabled", true);
|
pref("devtools.styleeditor.autocompletion-enabled", true);
|
||||||
pref("devtools.styleeditor.showMediaSidebar", false);
|
pref("devtools.styleeditor.showMediaSidebar", true);
|
||||||
|
|
||||||
// Enable the Shader Editor.
|
// Enable the Shader Editor.
|
||||||
pref("devtools.shadereditor.enabled", false);
|
pref("devtools.shadereditor.enabled", false);
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
// https rather than chrome to improve coverage
|
// https rather than chrome to improve coverage
|
||||||
const TESTCASE_URI = TEST_BASE_HTTPS + "media-rules.html";
|
const TESTCASE_URI = TEST_BASE_HTTPS + "media-rules.html";
|
||||||
const PREF = "devtools.styleeditor.showMediaSidebar";
|
const MEDIA_PREF = "devtools.styleeditor.showMediaSidebar";
|
||||||
|
|
||||||
const RESIZE = 300;
|
const RESIZE = 300;
|
||||||
const LABELS = ["not all", "all", "(max-width: 400px)"];
|
const LABELS = ["not all", "all", "(max-width: 400px)"];
|
||||||
|
@ -13,8 +13,6 @@ const LINE_NOS = [2, 8, 20];
|
||||||
waitForExplicitFinish();
|
waitForExplicitFinish();
|
||||||
|
|
||||||
let test = asyncTest(function*() {
|
let test = asyncTest(function*() {
|
||||||
Services.prefs.setBoolPref(PREF, true);
|
|
||||||
|
|
||||||
let {UI} = yield addTabAndOpenStyleEditors(2, null, TESTCASE_URI);
|
let {UI} = yield addTabAndOpenStyleEditors(2, null, TESTCASE_URI);
|
||||||
|
|
||||||
is(UI.editors.length, 2, "correct number of editors");
|
is(UI.editors.length, 2, "correct number of editors");
|
||||||
|
@ -29,20 +27,37 @@ let test = asyncTest(function*() {
|
||||||
yield openEditor(mediaEditor);
|
yield openEditor(mediaEditor);
|
||||||
testMediaEditor(mediaEditor);
|
testMediaEditor(mediaEditor);
|
||||||
|
|
||||||
|
// Test that sidebar hides when flipping pref
|
||||||
|
testShowHide(mediaEditor);
|
||||||
|
|
||||||
// Test resizing and seeing @media matching state change
|
// Test resizing and seeing @media matching state change
|
||||||
let originalWidth = window.outerWidth;
|
let originalWidth = window.outerWidth;
|
||||||
let originalHeight = window.outerHeight;
|
let originalHeight = window.outerHeight;
|
||||||
|
|
||||||
let onMatchesChange = listenForMatchesChange(UI);
|
let onMatchesChange = listenForMediaChange(UI);
|
||||||
window.resizeTo(RESIZE, RESIZE);
|
window.resizeTo(RESIZE, RESIZE);
|
||||||
yield onMatchesChange;
|
yield onMatchesChange;
|
||||||
|
|
||||||
testMediaMatchChanged(mediaEditor);
|
testMediaMatchChanged(mediaEditor);
|
||||||
|
|
||||||
window.resizeTo(originalWidth, originalHeight);
|
window.resizeTo(originalWidth, originalHeight);
|
||||||
Services.prefs.clearUserPref(PREF);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
function* testShowHide(editor) {
|
||||||
|
let sidebarChange = listenForMediaChange(UI);
|
||||||
|
Services.prefs.setBoolPref(MEDIA_PREF, false);
|
||||||
|
yield sidebarChange;
|
||||||
|
|
||||||
|
let sidebar = editor.details.querySelector(".stylesheet-sidebar");
|
||||||
|
is(sidebar.hidden, true, "sidebar is hidden after flipping pref");
|
||||||
|
|
||||||
|
sidebarChange = listenForMediaChange(UI);
|
||||||
|
Services.prefs.clearUserPref(MEDIA_PREF);
|
||||||
|
yield sidebarChange;
|
||||||
|
|
||||||
|
is(sidebar.hidden, false, "sidebar is showing after flipping pref back");
|
||||||
|
}
|
||||||
|
|
||||||
function testPlainEditor(editor) {
|
function testPlainEditor(editor) {
|
||||||
let sidebar = editor.details.querySelector(".stylesheet-sidebar");
|
let sidebar = editor.details.querySelector(".stylesheet-sidebar");
|
||||||
is(sidebar.hidden, true, "sidebar is hidden on editor without @media");
|
is(sidebar.hidden, true, "sidebar is hidden on editor without @media");
|
||||||
|
@ -89,7 +104,7 @@ function openEditor(editor) {
|
||||||
return editor.getSourceEditor();
|
return editor.getSourceEditor();
|
||||||
}
|
}
|
||||||
|
|
||||||
function listenForMatchesChange(UI) {
|
function listenForMediaChange(UI) {
|
||||||
let deferred = promise.defer();
|
let deferred = promise.defer();
|
||||||
UI.once("media-list-changed", () => {
|
UI.once("media-list-changed", () => {
|
||||||
deferred.resolve();
|
deferred.resolve();
|
||||||
|
|
|
@ -4,7 +4,6 @@
|
||||||
|
|
||||||
// https rather than chrome to improve coverage
|
// https rather than chrome to improve coverage
|
||||||
const TESTCASE_URI = TEST_BASE_HTTPS + "media-rules-sourcemaps.html";
|
const TESTCASE_URI = TEST_BASE_HTTPS + "media-rules-sourcemaps.html";
|
||||||
const MEDIA_PREF = "devtools.styleeditor.showMediaSidebar";
|
|
||||||
const MAP_PREF = "devtools.styleeditor.source-maps-enabled";
|
const MAP_PREF = "devtools.styleeditor.source-maps-enabled";
|
||||||
|
|
||||||
const LABELS = ["screen and (max-width: 320px)",
|
const LABELS = ["screen and (max-width: 320px)",
|
||||||
|
@ -14,7 +13,6 @@ const LINE_NOS = [4, 4];
|
||||||
waitForExplicitFinish();
|
waitForExplicitFinish();
|
||||||
|
|
||||||
let test = asyncTest(function*() {
|
let test = asyncTest(function*() {
|
||||||
Services.prefs.setBoolPref(MEDIA_PREF, true);
|
|
||||||
Services.prefs.setBoolPref(MAP_PREF, true);
|
Services.prefs.setBoolPref(MAP_PREF, true);
|
||||||
|
|
||||||
let {UI} = yield addTabAndOpenStyleEditors(2, null, TESTCASE_URI);
|
let {UI} = yield addTabAndOpenStyleEditors(2, null, TESTCASE_URI);
|
||||||
|
@ -28,7 +26,6 @@ let test = asyncTest(function*() {
|
||||||
yield openEditor(mediaEditor);
|
yield openEditor(mediaEditor);
|
||||||
testMediaEditor(mediaEditor);
|
testMediaEditor(mediaEditor);
|
||||||
|
|
||||||
Services.prefs.clearUserPref(MEDIA_PREF);
|
|
||||||
Services.prefs.clearUserPref(MAP_PREF);
|
Services.prefs.clearUserPref(MAP_PREF);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче