browser_selectpopup_hr.js (1522B)
1 add_task(async function test_hr() { 2 await SpecialPowers.pushPrefEnv({ 3 set: [ 4 ["test.wait300msAfterTabSwitch", true], 5 ["dom.forms.select.customstyling", true], 6 ], 7 }); 8 9 const PAGE_CONTENT = ` 10 <!doctype html> 11 <select> 12 <option>One</option> 13 <hr style="color: red; background-color: blue"> 14 <option>Two</option> 15 </select>`; 16 17 const pageUrl = "data:text/html," + encodeURIComponent(PAGE_CONTENT); 18 let tab = await BrowserTestUtils.openNewForegroundTab(gBrowser, pageUrl); 19 20 const selectPopup = await openSelectPopup("click"); 21 const menulist = selectPopup.parentNode; 22 23 const optionOne = selectPopup.children[0]; 24 const separator = selectPopup.children[1]; 25 const optionTwo = selectPopup.children[2]; 26 27 is(optionOne.textContent, "One", "First option has expected text content"); 28 29 is(separator.tagName, "menuseparator", "Separator is menuseparator"); 30 31 const separatorStyle = getComputedStyle(separator); 32 33 is( 34 separatorStyle.color, 35 "rgb(255, 0, 0)", 36 "Separator color is specified CSS color" 37 ); 38 39 is( 40 separatorStyle.backgroundColor, 41 "rgba(0, 0, 0, 0)", 42 "Separator background-color is not set to specified CSS color" 43 ); 44 45 is(optionTwo.textContent, "Two", "Second option has expected text content"); 46 47 is(menulist.activeChild, optionOne, "First option is selected to start"); 48 49 EventUtils.synthesizeKey("KEY_ArrowDown"); 50 51 is( 52 menulist.activeChild, 53 optionTwo, 54 "Second option is selected after arrow down" 55 ); 56 57 BrowserTestUtils.removeTab(tab); 58 });