Title: [292837] trunk/LayoutTests
Revision
292837
Author
andresg...@apple.com
Date
2022-04-13 15:47:07 -0700 (Wed, 13 Apr 2022)

Log Message

Rewrite accessibility/mac/stale-table-rows.html to properly check that the number of rows and columns are correct after grid changes.
https://bugs.webkit.org/show_bug.cgi?id=239292
<rdar://problem/91705969>

Reviewed by Chris Fleizach.

This test had a weak success criterion that was passing when two
expressions were equal without checking the actual value of the
expressions, which was incorrect in isolated tree mode. This is a
rewrite of the test that makes the success criteria more strict and
modernize the test to be async so that it can pass in isolated tree
mode. In addition, renamed the test to better reflect what it is
actually doing.

* accessibility/mac/grid-add-remove-rows-expected.txt: Added.
* accessibility/mac/grid-add-remove-rows.html: Added.
* accessibility/mac/stale-table-rows-expected.txt: Renamed to above.
* accessibility/mac/stale-table-rows.html: Renamed to above.

Modified Paths

Added Paths

Removed Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (292836 => 292837)


--- trunk/LayoutTests/ChangeLog	2022-04-13 22:44:04 UTC (rev 292836)
+++ trunk/LayoutTests/ChangeLog	2022-04-13 22:47:07 UTC (rev 292837)
@@ -1,3 +1,24 @@
+2022-04-13  Andres Gonzalez  <andresg...@apple.com>
+
+        Rewrite accessibility/mac/stale-table-rows.html to properly check that the number of rows and columns are correct after grid changes.
+        https://bugs.webkit.org/show_bug.cgi?id=239292
+        <rdar://problem/91705969>
+
+        Reviewed by Chris Fleizach.
+
+        This test had a weak success criterion that was passing when two
+        expressions were equal without checking the actual value of the
+        expressions, which was incorrect in isolated tree mode. This is a
+        rewrite of the test that makes the success criteria more strict and
+        modernize the test to be async so that it can pass in isolated tree
+        mode. In addition, renamed the test to better reflect what it is
+        actually doing.
+
+        * accessibility/mac/grid-add-remove-rows-expected.txt: Added.
+        * accessibility/mac/grid-add-remove-rows.html: Added.
+        * accessibility/mac/stale-table-rows-expected.txt: Renamed to above.
+        * accessibility/mac/stale-table-rows.html: Renamed to above.
+
 2022-04-13  Karl Rackler  <rack...@apple.com>
 
         [ Monterey wk2 release ] imported/w3c/web-platform-tests/content-security-policy/inheritance/blob-url-inherits-from-initiator.sub.html is a flaky crash

Added: trunk/LayoutTests/accessibility/mac/grid-add-remove-rows-expected.txt (0 => 292837)


--- trunk/LayoutTests/accessibility/mac/grid-add-remove-rows-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/accessibility/mac/grid-add-remove-rows-expected.txt	2022-04-13 22:47:07 UTC (rev 292837)
@@ -0,0 +1,18 @@
+This tests that the number of rows and columns of a grid are correct after adding and removing rows and columns.
+Initial count:
+PASS: grid.rowCount === 1
+PASS: grid.columnCount === 3
+Count after adding 3 rows:
+PASS: grid.rowCount === 4
+PASS: grid.columnCount === 3
+Count after clearing data:
+PASS: grid.rowCount === 1
+PASS: grid.columnCount === 3
+Count after adding 3 rows again:
+PASS: grid.rowCount === 4
+PASS: grid.columnCount === 3
+
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/accessibility/mac/grid-add-remove-rows.html (0 => 292837)


--- trunk/LayoutTests/accessibility/mac/grid-add-remove-rows.html	                        (rev 0)
+++ trunk/LayoutTests/accessibility/mac/grid-add-remove-rows.html	2022-04-13 22:47:07 UTC (rev 292837)
@@ -0,0 +1,86 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<script src=""
+<script src=""
+</head>
+<body>
+
+<div role="grid" id="grid1">
+    <div role="rowgroup">
+        <div role="row">
+            <span role="columnheader">A</span>
+            <span role="columnheader">B</span>
+            <span role="columnheader">C</span>
+        </div>
+    </div>
+    <div role="rowgroup" id="myData"><!-- to be populated by script --></div>
+</div>
+
+<script>
+    let output = "This tests that the number of rows and columns of a grid are correct after adding and removing rows and columns.\n";
+
+    function $(id) {
+       return document.getElementById(id);
+    }
+
+    function createNode(tagName, role) {
+        let el = document.createElement(tagName);
+        el.setAttribute('role', role);
+        return el;
+    }
+
+    function clearGridData() {
+        let data = ""
+        data.innerHTML = "";
+    }
+
+    function randomizeGridData() {
+        let choices = ['foo', 'bar', 'baz', 'baf', 'bop', 'bip'];
+        let data = ""
+        for (let i = 0; i < 3; i++) {
+            let row = createNode("tr", "row");
+            for (let j = 0; j < 3; j++) {
+                let cell = createNode("tr", "gridcell");
+                cell.innerHTML = choices[Math.floor(Math.random() * choices.length)]; // Populate cell with a random entry from 'choices' array: 'foo', 'bar', 'baz', etc.
+                row.appendChild(cell);
+            }
+            data.appendChild(row);
+        }
+    }
+
+    if (window.accessibilityController) {
+        window.jsTestIsAsync = true;
+
+        window.grid = accessibilityController.accessibleElementById("grid1");
+        output += "Initial count:\n";
+        output += expect("grid.rowCount", "1");
+        output += expect("grid.columnCount", "3");
+
+        randomizeGridData();
+        setTimeout(async () => {
+            await waitFor(() => { return grid.rowCount == 4; });
+            output += "Count after adding 3 rows:\n";
+            output += expect("grid.rowCount", "4");
+            output += expect("grid.columnCount", "3");
+
+            clearGridData();
+            await waitFor(() => { return grid.rowCount == 1; });
+            output += "Count after clearing data:\n";
+            output += expect("grid.rowCount", "1");
+            output += expect("grid.columnCount", "3");
+
+            randomizeGridData();
+            await waitFor(() => { return grid.rowCount == 4; });
+            output += "Count after adding 3 rows again:\n";
+            output += expect("grid.rowCount", "4");
+            output += expect("grid.columnCount", "3");
+
+            debug(output);
+            $("grid1").style.visibility = "hidden";
+            finishJSTest();
+        }, 0);
+    }
+</script>
+</body>
+</html>

Deleted: trunk/LayoutTests/accessibility/mac/stale-table-rows-expected.txt (292836 => 292837)


--- trunk/LayoutTests/accessibility/mac/stale-table-rows-expected.txt	2022-04-13 22:44:04 UTC (rev 292836)
+++ trunk/LayoutTests/accessibility/mac/stale-table-rows-expected.txt	2022-04-13 22:47:07 UTC (rev 292837)
@@ -1,12 +0,0 @@
-A B C
-This tests that when a table has its DOM changed, all the table method still return the correct data.
-
-On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
-
-
-PASS rows is grid.rowCount
-PASS columns is grid.columnCount
-PASS successfullyParsed is true
-
-TEST COMPLETE
-

Deleted: trunk/LayoutTests/accessibility/mac/stale-table-rows.html (292836 => 292837)


--- trunk/LayoutTests/accessibility/mac/stale-table-rows.html	2022-04-13 22:44:04 UTC (rev 292836)
+++ trunk/LayoutTests/accessibility/mac/stale-table-rows.html	2022-04-13 22:47:07 UTC (rev 292837)
@@ -1,79 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
-<html>
-<head>
-<script type="text/_javascript_" charset="utf-8">
-    
-var choices = ['foo', 'bar', 'baz', 'baf', 'bop', 'bip'];
-    
-function $(id){
-   return document.getElementById(id);
-}
-function node(tagName, role){
-    var el = document.createElement(tagName);
-    el.setAttribute('role', role);
-    return el;
-}
-
-function randomize(){
-
-    var d = $('myData');
-    d.innerHTML = ''; // clear it out first
-    for (var i=0; i<3; i++){
-        var row = node('tr', 'row');
-        d.appendChild(row);
-        for (var j=0; j<3; j++){
-            var cell = node('tr', 'gridcell');
-            cell.innerHTML = choices[Math.floor(Math.random()*choices.length)]; // populate cell with a random entry from 'choices' array: 'foo', 'bar', 'baz', etc.
-            row.appendChild(cell);
-        }
-    }
-}
-
-</script>
-<script src=""
-</head>
-<body id="body">
-
-<div role="grid" tabindex=0 id="grid1">
-  <div role="rowgroup">
-    <div role="row">
-    <span role="columnheader">A</span>
-    <span role="columnheader">B</span>
-    <span role="columnheader">C</span>
-  </div>
-</div>
-<div role="rowgroup" id="myData"><!-- to be populated by script --></div>
-</div>
-
-<p id="description"></p>
-<div id="console"></div>
-
-<script>
-
-    description("This tests that when a table has its DOM changed, all the table method still return the correct data.");
-
-    if (window.accessibilityController) {
-
-          randomize();
-          
-          document.getElementById("grid1").focus();
-          var grid = accessibilityController.focusedElement;
-          var rows = grid.rowCount;
-          var columns = grid.columnCount;
-          randomize();
-
-          // this used to crash in debug mode.
-          shouldBe("rows", "grid.rowCount");
-          shouldBe("columns", "grid.columnCount");
-
-          // clear out the data so that we get the same end results for our layout test.
-          var d = $('myData');
-          d.innerHTML = '';
-
-    }
-
-</script>
-
-<script src=""
-</body>
-</html>
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to