/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ "use strict"; /* import-globals-from ../../mochitest/role.js */ /* import-globals-from ../../mochitest/states.js */ loadScripts( { name: "role.js", dir: MOCHITESTS_DIR }, { name: "states.js", dir: MOCHITESTS_DIR } ); async function runTest(browser, accDoc) { let getAcc = id => findAccessibleChildByID(accDoc, id); testStates(getAcc("div"), 0, 0, STATE_INVISIBLE | STATE_OFFSCREEN); let input = getAcc("input_scrolledoff"); testStates(input, STATE_OFFSCREEN, 0, STATE_INVISIBLE); // scrolled off item (twice) let lastLi = getAcc("li_last"); testStates(lastLi, STATE_OFFSCREEN, 0, STATE_INVISIBLE); // scroll into view the item await SpecialPowers.spawn(browser, [], () => { content.document.getElementById("li_last").scrollIntoView(true); }); testStates(lastLi, 0, 0, STATE_OFFSCREEN | STATE_INVISIBLE); // first item is scrolled off now (testcase for bug 768786) let firstLi = getAcc("li_first"); testStates(firstLi, STATE_OFFSCREEN, 0, STATE_INVISIBLE); let newTab = await BrowserTestUtils.openNewForegroundTab(gBrowser); // Accessibles in background tab should have offscreen state and no // invisible state. testStates(getAcc("div"), STATE_OFFSCREEN, 0, STATE_INVISIBLE); BrowserTestUtils.removeTab(newTab); } addAccessibleTask( `