browser_selectpopup_xhtml.js (1131B)
1 const PAGE = `<?xml version="1.0"?> 2 <html id="main-window" 3 xmlns:html="http://www.w3.org/1999/xhtml" 4 xmlns="http://www.w3.org/1999/xhtml"> 5 <head/> 6 <body> 7 <html:select> 8 <html:option>abc</html:option> 9 <html:optgroup> 10 <html:option>defg</html:option> 11 </html:optgroup> 12 </html:select> 13 </body> 14 </html> 15 `; 16 17 add_setup(async function () { 18 await SpecialPowers.pushPrefEnv({ 19 set: [["test.wait300msAfterTabSwitch", true]], 20 }); 21 }); 22 23 add_task(async function () { 24 const url = "data:application/xhtml+xml," + encodeURI(PAGE); 25 await BrowserTestUtils.withNewTab( 26 { 27 gBrowser, 28 url, 29 }, 30 async function () { 31 let popup = await openSelectPopup("click"); 32 let menuitems = popup.querySelectorAll("menuitem"); 33 is(menuitems.length, 2, "Should've properly detected two menu items"); 34 is(menuitems[0].textContent, "abc", "Option text should be correct"); 35 is(menuitems[1].textContent, "defg", "Second text should be correct"); 36 ok( 37 !!popup.querySelector("menucaption"), 38 "Should've created a caption for the optgroup" 39 ); 40 } 41 ); 42 });