browser_bug710878.js (1309B)
1 /* Any copyright is dedicated to the Public Domain. 2 http://creativecommons.org/publicdomain/zero/1.0/ */ 3 4 const PAGE = 5 "data:text/html;charset=utf-8,<a href='%23xxx'><span>word1 <span> word2 </span></span><span> word3</span></a>"; 6 7 add_setup(async function () { 8 await SpecialPowers.pushPrefEnv({ 9 set: [["test.wait300msAfterTabSwitch", true]], 10 }); 11 }); 12 13 /** 14 * Tests that we correctly compute the text for context menu 15 * selection of some content. 16 */ 17 add_task(async function () { 18 await BrowserTestUtils.withNewTab( 19 { 20 gBrowser, 21 url: PAGE, 22 }, 23 async function (browser) { 24 let contextMenu = document.getElementById("contentAreaContextMenu"); 25 let awaitPopupShown = BrowserTestUtils.waitForEvent( 26 contextMenu, 27 "popupshown" 28 ); 29 let awaitPopupHidden = BrowserTestUtils.waitForEvent( 30 contextMenu, 31 "popuphidden" 32 ); 33 34 await BrowserTestUtils.synthesizeMouseAtCenter( 35 "a", 36 { 37 type: "contextmenu", 38 button: 2, 39 }, 40 browser 41 ); 42 43 await awaitPopupShown; 44 45 is( 46 gContextMenu.linkTextStr, 47 "word1 word2 word3", 48 "Text under link is correctly computed." 49 ); 50 51 contextMenu.hidePopup(); 52 await awaitPopupHidden; 53 } 54 ); 55 });