4 var
tab = gBrowser.addTab();
5 gBrowser.selectedTab =
tab;
8 "chrome://mochikit/content/browser/browser/base/content/test/page_style_sample.html";
12 var menupopup = document.getElementById(
"pageStyleMenu")
13 .getElementsByTagName(
"menupopup")[0];
17 var current = menupopup.getElementsByTagName(
"menuseparator")[0];
18 while (current.nextSibling) {
19 current = current.nextSibling;
24 Array.forEach(content.document.getElementsByTagName(
"link"),
function (link) {
25 var title = link.getAttribute(
"title");
26 var rel = link.getAttribute(
"rel");
27 var media = link.getAttribute(
"media");
28 var idstring =
"link " + (title ? title :
"without title and") +
29 " with rel=\"" + rel +
"\"" +
30 (media ?
" and media=\"" + media +
"\"" :
"");
32 var item = items.filter(
function (item) item.getAttribute(
"label") == title);
33 var found = item.length == 1;
34 var checked = found && (item[0].getAttribute(
"checked") ==
"true");
36 switch (link.getAttribute(
"data-state")) {
38 ok(!found, idstring +
" does not show up in page style menu");
42 todo(!found, idstring +
" should not show up in page style menu");
43 ok(!checked, idstring +
" is not selected");
47 ok(found, idstring +
" shows up in page style menu");
48 ok(!checked, idstring +
" is not selected");
52 ok(found, idstring +
" shows up in page style menu");
53 ok(checked, idstring +
" is selected");
56 throw "data-state attribute is missing or has invalid value";
60 is(validLinks, items.length,
"all valid links found");
62 gBrowser.removeCurrentTab();
function stylesheetFillPopup(menuPopup)