blob: bed196d15791415a74551a55056ca36de0f70701 (
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
|
"use strict";
const PAGE =
"http://example.com/browser/browser/base/content/test/general/page_style_sample.html";
/**
* Tests that the Page Style menu shows the currently
* selected Page Style after a new one has been selected.
*/
add_task(async function() {
let tab = await BrowserTestUtils.openNewForegroundTab(
gBrowser,
"about:blank",
false
);
let browser = tab.linkedBrowser;
BrowserTestUtils.loadURI(browser, PAGE);
await promiseStylesheetsLoaded(tab, 18);
let menupopup = document.getElementById("pageStyleMenu").menupopup;
gPageStyleMenu.fillPopup(menupopup);
// page_style_sample.html should default us to selecting the stylesheet
// with the title "6" first.
let selected = menupopup.querySelector("menuitem[checked='true']");
is(
selected.getAttribute("label"),
"6",
"Should have '6' stylesheet selected by default"
);
// Now select stylesheet "1"
let target = menupopup.querySelector("menuitem[label='1']");
target.doCommand();
gPageStyleMenu.fillPopup(menupopup);
// gPageStyleMenu empties out the menu between opens, so we need
// to get a new reference to the selected menuitem
selected = menupopup.querySelector("menuitem[checked='true']");
is(
selected.getAttribute("label"),
"1",
"Should now have stylesheet 1 selected"
);
BrowserTestUtils.removeTab(tab);
});
|