blob: c8a213413503be3a97982ed978a4398722a3a9ef (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
// Test that 'no styles' indicator is shown if a page doesn't contain any style
// sheets.
const TESTCASE_URI = TEST_BASE_HTTP + "nostyle.html";
add_task(async function () {
// Make enough room for the "append style sheet" link to not wrap,
// as it messes up with EvenEventUtils.synthesizeMouse
await pushPref("devtools.styleeditor.navSidebarWidth", 500);
const { panel, ui } = await openStyleEditorForURL(TESTCASE_URI);
const { panelWindow } = panel;
ok(
!getRootElement(panel).classList.contains("loading"),
"style editor root element does not have 'loading' class name anymore"
);
const newButton = panelWindow.document.querySelector(
"toolbarbutton.style-editor-newButton"
);
ok(!newButton.hasAttribute("disabled"), "new style sheet button is enabled");
const importButton = panelWindow.document.querySelector(
".style-editor-importButton"
);
ok(!importButton.hasAttribute("disabled"), "import button is enabled");
const emptyPlaceHolderEl =
getRootElement(panel).querySelector(".empty.placeholder");
isnot(
emptyPlaceHolderEl.ownerGlobal.getComputedStyle(emptyPlaceHolderEl).display,
"none",
"showing 'no style' indicator"
);
info(
"Check that clicking on the append new stylesheet link do add a stylesheet"
);
const onEditorAdded = ui.once("editor-added");
const newLink = emptyPlaceHolderEl.querySelector("a.style-editor-newButton");
// Use synthesizeMouse to also check that the element is visible
EventUtils.synthesizeMouseAtCenter(newLink, {}, newLink.ownerGlobal);
await onEditorAdded;
ok(true, "A stylesheet was added");
is(
emptyPlaceHolderEl.ownerGlobal.getComputedStyle(emptyPlaceHolderEl).display,
"none",
"The empty placeholder element is now hidden"
);
});
|