fune/browser/base/content/test/forms/browser_selectpopup_xhtml.js
Emilio Cobos Álvarez eff5bd5860 Bug 1827451 - Make <html:select> work on top level windows. r=Gijs,gregtatum
Actually since the tagName may be things like "html:option" we need to
fix a couple other checks in the child actor, too, that was a
pre-existing bug with XHTML.

Differential Revision: https://phabricator.services.mozilla.com/D175150
2023-04-12 10:54:18 +00:00

36 lines
1,008 B
JavaScript

const PAGE = `<?xml version="1.0"?>
<html id="main-window"
xmlns:html="http://www.w3.org/1999/xhtml"
xmlns="http://www.w3.org/1999/xhtml">
<head/>
<body>
<html:select>
<html:option>abc</html:option>
<html:optgroup>
<html:option>defg</html:option>
</html:optgroup>
</html:select>
</body>
</html>
`;
add_task(async function() {
const url = "data:application/xhtml+xml," + encodeURI(PAGE);
await BrowserTestUtils.withNewTab(
{
gBrowser,
url,
},
async function(browser) {
let popup = await openSelectPopup("click");
let menuitems = popup.querySelectorAll("menuitem");
is(menuitems.length, 2, "Should've properly detected two menu items");
is(menuitems[0].textContent, "abc", "Option text should be correct");
is(menuitems[1].textContent, "defg", "Second text should be correct");
ok(
!!popup.querySelector("menucaption"),
"Should've created a caption for the optgroup"
);
}
);
});