From 36d22d82aa202bb199967e9512281e9a53db42c9 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 21:33:14 +0200 Subject: Adding upstream version 115.7.0esr. Signed-off-by: Daniel Baumann --- .../browser/states/browser_test_visibility_2.js | 131 +++++++++++++++++++++ 1 file changed, 131 insertions(+) create mode 100644 accessible/tests/browser/states/browser_test_visibility_2.js (limited to 'accessible/tests/browser/states/browser_test_visibility_2.js') diff --git a/accessible/tests/browser/states/browser_test_visibility_2.js b/accessible/tests/browser/states/browser_test_visibility_2.js new file mode 100644 index 0000000000..ead134069a --- /dev/null +++ b/accessible/tests/browser/states/browser_test_visibility_2.js @@ -0,0 +1,131 @@ +/* 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"; + +/** + * Test tables, table rows are reported on screen, even if some cells of a given row are + * offscreen. + */ +addAccessibleTask( + ` +
onetwothree
+ `, + async function (browser, accDoc) { + const table = findAccessibleChildByID(accDoc, "table"); + const row = findAccessibleChildByID(accDoc, "row"); + const one = findAccessibleChildByID(accDoc, "one"); + const two = findAccessibleChildByID(accDoc, "two"); + const three = findAccessibleChildByID(accDoc, "three"); + + await untilCacheOk( + () => testVisibility(table, false, false), + "table should be on screen and visible" + ); + await untilCacheOk( + () => testVisibility(row, false, false), + "row should be on screen and visible" + ); + await untilCacheOk( + () => testVisibility(one, false, false), + "one should be on screen and visible" + ); + await untilCacheOk( + () => testVisibility(two, false, false), + "two should be on screen and visible" + ); + await untilCacheOk( + () => testVisibility(three, true, false), + "three should be off screen and visible" + ); + }, + { chrome: true, iframe: true, remoteIframe: true } +); + +/** + * Test rows and cells outside of the viewport are reported as offscreen. + */ +addAccessibleTask( + ` +
one
two
+ `, + async function (browser, accDoc) { + const table = findAccessibleChildByID(accDoc, "table"); + const rowA = findAccessibleChildByID(accDoc, "rowA"); + const one = findAccessibleChildByID(accDoc, "one"); + const rowB = findAccessibleChildByID(accDoc, "rowB"); + const two = findAccessibleChildByID(accDoc, "two"); + + await untilCacheOk( + () => testVisibility(table, false, false), + "table should be on screen and visible" + ); + await untilCacheOk( + () => testVisibility(rowA, false, false), + "rowA should be on screen and visible" + ); + await untilCacheOk( + () => testVisibility(one, false, false), + "one should be on screen and visible" + ); + await untilCacheOk( + () => testVisibility(rowB, true, false), + "rowB should be off screen and visible" + ); + await untilCacheOk( + () => testVisibility(two, true, false), + "two should be off screen and visible" + ); + }, + { chrome: true, iframe: true, remoteIframe: true } +); + +addAccessibleTask( + ` +
hello
+ `, + async function (browser, accDoc) { + let textLeaf = findAccessibleChildByID(accDoc, "div").firstChild; + await untilCacheOk( + () => testVisibility(textLeaf, false, false), + "text should be on screen and visible" + ); + let p = waitForEvent(EVENT_TEXT_INSERTED, "div"); + await invokeContentTask(browser, [], () => { + content.document.getElementById("div").textContent = "goodbye"; + }); + await p; + textLeaf = findAccessibleChildByID(accDoc, "div").firstChild; + await untilCacheOk( + () => testVisibility(textLeaf, false, false), + "text should be on screen and visible" + ); + }, + { chrome: true, iframe: true, remoteIframe: true } +); + +/** + * Overlapping, opaque divs with the same bounds should not be considered + * offscreen. + */ +addAccessibleTask( + ` + +
hi
+ `, + async function (browser, accDoc) { + const outer = findAccessibleChildByID(accDoc, "outer"); + const inner = findAccessibleChildByID(accDoc, "inner"); + + await untilCacheOk( + () => testVisibility(outer, false, false), + "outer should be on screen and visible" + ); + await untilCacheOk( + () => testVisibility(inner, false, false), + "inner should be on screen and visible" + ); + }, + { chrome: true, iframe: true, remoteIframe: true } +); -- cgit v1.2.3