mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-21 09:49:14 +00:00
Bug 830748 - [PATCH 2/2] [AccessFu] tests for improved reading of table semantics. r=eeejay, marcoz
This commit is contained in:
parent
af64fb7c4b
commit
bd384832bd
@ -15,9 +15,10 @@ MOCHITEST_A11Y_FILES =\
|
||||
jsatcommon.js \
|
||||
output.js \
|
||||
test_alive.html \
|
||||
test_explicit_names.html \
|
||||
test_utterance_order.html \
|
||||
test_braille.html \
|
||||
test_explicit_names.html \
|
||||
test_tables.html \
|
||||
test_utterance_order.html \
|
||||
$(NULL)
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
@ -37,7 +37,8 @@ function testContextOutput(expected, aAccOrElmOrID, aOldAccOrElmOrID, aGenerator
|
||||
*/
|
||||
function testObjectOutput(aAccOrElmOrID, aGenerator) {
|
||||
var accessible = getAccessible(aAccOrElmOrID);
|
||||
var output = aGenerator.genForObject(accessible);
|
||||
var context = new PivotContext(accessible);
|
||||
var output = aGenerator.genForObject(accessible, context);
|
||||
var outputOrder;
|
||||
try {
|
||||
outputOrder = SpecialPowers.getIntPref(PREF_UTTERANCE_ORDER);
|
||||
|
@ -54,9 +54,10 @@
|
||||
expected: ["list 2 items", "Test List", "Last item", "2.", "list two"]
|
||||
}, {
|
||||
accOrElmOrID: "cell",
|
||||
expected: ["table", "Fruits and vegetables", "List of Fruits",
|
||||
"list 4 items","First item", "link", "Apples", "link", "Bananas",
|
||||
"link", "Peaches", "Last item", "link", "Plums"]
|
||||
expected: ["table with 1 column and 1 row", "Fruits and vegetables",
|
||||
"Column 1 Row 1", "List of Fruits", "list 4 items", "First item",
|
||||
"link", "Apples", "link", "Bananas", "link", "Peaches", "Last item",
|
||||
"link", "Plums"]
|
||||
}, {
|
||||
accOrElmOrID: "app.net",
|
||||
expected: ["list 2 items", "First item", "link", "star", "Last item",
|
||||
@ -71,13 +72,12 @@
|
||||
// Test pivot to li_one from list.
|
||||
accOrElmOrID: "li_one",
|
||||
oldAccOrElmOrID: "list",
|
||||
expected: ["list 2 items", "Test List", "First item", "Top of the list"]
|
||||
expected: ["First item", "Top of the list"]
|
||||
}, {
|
||||
// Test pivot to "apples" link from the table cell.
|
||||
accOrElmOrID: "apples",
|
||||
oldAccOrElmOrID: "cell",
|
||||
expected: ["List of Fruits", "list 4 items", "First item", "link",
|
||||
"Apples"]
|
||||
expected: ["list 4 items", "First item", "link", "Apples"]
|
||||
}, {
|
||||
// Test pivot to the table cell from the "apples" link.
|
||||
accOrElmOrID: "cell",
|
||||
|
251
accessible/tests/mochitest/jsat/test_tables.html
Normal file
251
accessible/tests/mochitest/jsat/test_tables.html
Normal file
@ -0,0 +1,251 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>[AccessFu] Improve reading of table semantics</title>
|
||||
|
||||
<link rel="stylesheet" type="text/css"
|
||||
href="chrome://mochikit/content/tests/SimpleTest/test.css" />
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="../common.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="output.js"></script>
|
||||
<script type="application/javascript">
|
||||
|
||||
function doTest() {
|
||||
// Test the following accOrElmOrID.
|
||||
var tests = [{
|
||||
accOrElmOrID: "table1",
|
||||
expectedUtterance: ["table with 2 columns and 2 rows",
|
||||
"Column 1 Row 1", "col1", "Column 2 Row 1", "col2",
|
||||
"Column 1 Row 2 col1", "cell1", "Column 2 Row 2 col2", "cell2"],
|
||||
expectedBraille: ["tbl 2c 2r", "c1r1", "col1", "c2r1", "col2",
|
||||
"c1r2 col1", "cell1", "c2r2 col2", "cell2"]
|
||||
}, {
|
||||
accOrElmOrID: "table2",
|
||||
expectedUtterance: ["table with 2 columns and 2 rows",
|
||||
"Column 1 Row 1 col1", "cell1", "Column 2 Row 1 col2",
|
||||
"table with 1 column and 2 rows", "Column 1 Row 1", "colheader",
|
||||
"Column 1 Row 2 colheader", "bla", "Column 1 Row 2", "col1",
|
||||
"Column 2 Row 2", "col2"],
|
||||
expectedBraille: ["tbl 2c 2r", "c1r1 col1", "cell1", "c2r1 col2",
|
||||
"tbl 1c 2r", "c1r1", "colheader", "c1r2 colheader", "bla", "c1r2",
|
||||
"col1", "c2r2", "col2"]
|
||||
}, {
|
||||
accOrElmOrID: "table3",
|
||||
expectedUtterance: ["table with 2 columns and 2 rows",
|
||||
"Column 2 Row 1 col2", "table with 1 column and 2 rows",
|
||||
"Column 1 Row 1", "colheader", "Column 1 Row 2 colheader", "bla"],
|
||||
expectedBraille: ["tbl 1c 2r", "c1r1", "colheader", "c1r2 colheader",
|
||||
"bla"]
|
||||
}, {
|
||||
accOrElmOrID: "table4",
|
||||
expectedUtterance: ["table with 4 columns and 3 rows",
|
||||
"Column 1 Row 1", "col1", "Column 2 Row 1", "col2", "Column 3 Row 1",
|
||||
"col3", "Column 1 Row 2 spans 2 columns col1", "row1",
|
||||
"Column 3 Row 2 col3 row1", "cell1",
|
||||
"Column 4 Row 2 spans 2 rows row1", "cell2", "Column 1 Row 3 col1",
|
||||
"row2", "Column 2 Row 3 col2 row2", "cell3",
|
||||
"Column 3 Row 3 col3 row2", "cell4"],
|
||||
expectedBraille: ["tbl 4c 3r", "c1r1", "col1", "c2r1", "col2", "c3r1",
|
||||
"col3", "c1r2 col1", "row1", "c3r2 col3 row1", "cell1", "c4r2 row1",
|
||||
"cell2", "c1r3 col1", "row2", "c2r3 col2 row2", "cell3",
|
||||
"c3r3 col3 row2", "cell4"]
|
||||
}, {
|
||||
accOrElmOrID: "table5",
|
||||
expectedUtterance: ["Row1", "Row2"],
|
||||
expectedBraille: ["Row1", "Row2"]
|
||||
}, {
|
||||
// Test pivot to table1_th1 from table1.
|
||||
accOrElmOrID: "table1_th1",
|
||||
oldAccOrElmOrID: "table1",
|
||||
expectedUtterance: ["Column 1 Row 1", "col1"],
|
||||
expectedBraille: ["c1r1", "col1"]
|
||||
}, {
|
||||
// Test pivot to table1_td2 from table1.
|
||||
accOrElmOrID: "table1_td2",
|
||||
oldAccOrElmOrID: "table1",
|
||||
expectedUtterance: ["Column 2 Row 2 col2", "cell2"],
|
||||
expectedBraille: ["c2r2 col2", "cell2"]
|
||||
}, {
|
||||
// Test pivot to table1_td2 from table1_th1.
|
||||
accOrElmOrID: "table1_td2",
|
||||
oldAccOrElmOrID: "table1_th1",
|
||||
expectedUtterance: ["Column 2 Row 2 col2", "cell2"],
|
||||
expectedBraille: ["c2r2 col2", "cell2"]
|
||||
}, {
|
||||
// Test pivot to table1_td2 from table1_td1.
|
||||
accOrElmOrID: "table1_td2",
|
||||
oldAccOrElmOrID: "table1_td1",
|
||||
expectedUtterance: ["Column 2 col2", "cell2"],
|
||||
expectedBraille: ["c2r2 col2", "cell2"]
|
||||
}, {
|
||||
// Test pivot to table2_cell_1 from table2.
|
||||
accOrElmOrID: "table2_cell_1",
|
||||
oldAccOrElmOrID: "table2",
|
||||
expectedUtterance: ["Column 1 Row 1 col1", "cell1"],
|
||||
expectedBraille: ["c1r1 col1", "cell1"]
|
||||
}, {
|
||||
// Test pivot to table2_cell_2 from table2.
|
||||
accOrElmOrID: "table2_cell_2",
|
||||
oldAccOrElmOrID: "table2",
|
||||
expectedUtterance: ["Column 2 Row 1 col2",
|
||||
"table with 1 column and 2 rows", "Column 1 Row 1", "colheader",
|
||||
"Column 1 Row 2 colheader", "bla"],
|
||||
expectedBraille: ["c2r1 col2", "tbl 1c 2r", "c1r1", "colheader",
|
||||
"c1r2 colheader", "bla"]
|
||||
}, {
|
||||
// Test pivot to table2_cell_1 from table2_cell_2.
|
||||
accOrElmOrID: "table2_cell_1",
|
||||
oldAccOrElmOrID: "table2_cell_2",
|
||||
expectedUtterance: ["Column 1 col1", "cell1"],
|
||||
expectedBraille: ["c1r1 col1", "cell1"]
|
||||
}, {
|
||||
// Test pivot to table3_cell from table2.
|
||||
accOrElmOrID: "table3_cell",
|
||||
oldAccOrElmOrID: "table2",
|
||||
expectedUtterance: ["Column 2 Row 1 col2",
|
||||
"table with 1 column and 2 rows", "Column 1 Row 2 colheader",
|
||||
"bla"],
|
||||
expectedBraille: ["c1r2 colheader", "bla"]
|
||||
}, {
|
||||
// Test pivot to table3_cell from table2_cell_1.
|
||||
accOrElmOrID: "table3_cell",
|
||||
oldAccOrElmOrID: "table2_cell_1",
|
||||
expectedUtterance: ["Column 2 col2", "table with 1 column and 2 rows",
|
||||
"Column 1 Row 2 colheader", "bla"],
|
||||
expectedBraille: ["c1r2 colheader", "bla"]
|
||||
}, {
|
||||
// Test pivot to table3_cell from table3_ch.
|
||||
accOrElmOrID: "table3_cell",
|
||||
oldAccOrElmOrID: "table3_ch",
|
||||
expectedUtterance: ["Row 2", "bla"],
|
||||
expectedBraille: ["c1r2", "bla"]
|
||||
}, {
|
||||
// Test pivot to table3_cell from table1_td1.
|
||||
accOrElmOrID: "table3_cell",
|
||||
oldAccOrElmOrID: "table1_td1",
|
||||
expectedUtterance: ["table with 2 columns and 2 rows",
|
||||
"Column 2 Row 1 col2", "table with 1 column and 2 rows",
|
||||
"Column 1 Row 2 colheader", "bla"],
|
||||
expectedBraille: ["c1r2 colheader", "bla"]
|
||||
}, {
|
||||
// Test pivot to table4_ch_3 from table4.
|
||||
accOrElmOrID: "table4_ch_3",
|
||||
oldAccOrElmOrID: "table4",
|
||||
expectedUtterance: ["Column 3 Row 1", "col3"],
|
||||
expectedBraille: ["c3r1", "col3"]
|
||||
}, {
|
||||
// Test pivot to table4_rh_1 from table4_ch_3.
|
||||
accOrElmOrID: "table4_rh_1",
|
||||
oldAccOrElmOrID: "table4_ch_3",
|
||||
expectedUtterance: ["Column 1 Row 2 spans 2 columns col1", "row1"],
|
||||
expectedBraille: ["c1r2 col1", "row1"]
|
||||
}, {
|
||||
// Test pivot to table4_cell_3 from table4_rh_1.
|
||||
accOrElmOrID: "table4_cell_3",
|
||||
oldAccOrElmOrID: "table4_rh_1",
|
||||
expectedUtterance: ["Column 4 spans 2 rows", "cell2"],
|
||||
expectedBraille: ["c4r2", "cell2"]
|
||||
}, {
|
||||
// Test pivot to table4_cell_5 from table4_cell_3.
|
||||
accOrElmOrID: "table4_cell_5",
|
||||
oldAccOrElmOrID: "table4_cell_3",
|
||||
expectedUtterance: ["Column 2 Row 3 col2 row2", "cell3"],
|
||||
expectedBraille: ["c2r3 col2 row2", "cell3"]
|
||||
}];
|
||||
|
||||
SpecialPowers.setIntPref(PREF_UTTERANCE_ORDER, 0);
|
||||
|
||||
// Test outputs (utterance and braille) for tables including their
|
||||
// headers and cells.
|
||||
tests.forEach(function run(test) {
|
||||
testOutput(test.expectedUtterance, test.accOrElmOrID,
|
||||
test.oldAccOrElmOrID, 1);
|
||||
testOutput(test.expectedBraille, test.accOrElmOrID,
|
||||
test.oldAccOrElmOrID, 0);
|
||||
});
|
||||
|
||||
SpecialPowers.clearUserPref(PREF_UTTERANCE_ORDER);
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
addA11yLoadEvent(doTest);
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="root">
|
||||
<a target="_blank"
|
||||
href="https://bugzilla.mozilla.org/show_bug.cgi?id=830748"
|
||||
title="[AccessFu] Improve reading of table semantics">
|
||||
Mozilla Bug 830748
|
||||
</a>
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none"></div>
|
||||
<pre id="test"></pre>
|
||||
<table id="table1">
|
||||
<thead>
|
||||
<tr>
|
||||
<th id="table1_th1">col1</th>
|
||||
<th>col2</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td id="table1_td1">cell1</td>
|
||||
<td id="table1_td2">cell2</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<table id="table2" border="1">
|
||||
<tr>
|
||||
<td id="table2_cell_1" headers="table2_ch_1">cell1</td>
|
||||
<td id="table2_cell_2" headers="table2_ch_2">
|
||||
<table id="table3">
|
||||
<thead>
|
||||
<tr>
|
||||
<th id="table3_ch">colheader</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td id="table3_cell">bla</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td id="table2_ch_1" scope="col">col1</td>
|
||||
<td id="table2_ch_2" scope="col">col2</td>
|
||||
</tr>
|
||||
</table>
|
||||
<table id="table4" border="1">
|
||||
<thead>
|
||||
<tr>
|
||||
<th id="table4_ch_1">col1</th>
|
||||
<th id="table4_ch_2">col2</th>
|
||||
<td id="table4_ch_3" scope="col">col3</td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<th id="table4_rh_1" colspan="2">row1</th>
|
||||
<td id="table4_cell_2">cell1</td>
|
||||
<td id="table4_cell_3" rowspan="2">cell2</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td id="table4_rh_2" scope="row">row2</td>
|
||||
<td id="table4_cell_5">cell3</td>
|
||||
<td id="table4_cell_6">cell4</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<table id="table5">
|
||||
<tr><td>Row1</td></tr>
|
||||
<tr><td>Row2</td></tr>
|
||||
</table>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
@ -57,13 +57,14 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=753984
|
||||
}, {
|
||||
accOrElmOrID: "cell",
|
||||
expected: [[
|
||||
"table", "Fruits and vegetables", "list 4 items", "First item",
|
||||
"link", "Apples", "link", "Bananas", "link", "Peaches",
|
||||
"Last item", "link", "Plums"
|
||||
"table with 1 column and 1 row", "Fruits and vegetables",
|
||||
"Column 1 Row 1", "list 4 items", "First item", "link", "Apples",
|
||||
"link", "Bananas", "link", "Peaches", "Last item", "link", "Plums"
|
||||
], [
|
||||
"Apples", "link", "First item", "Bananas", "link", "Peaches",
|
||||
"link", "Plums", "link", "Last item", "list 4 items",
|
||||
"Fruits and vegetables", "table"
|
||||
"Column 1 Row 1", "Fruits and vegetables",
|
||||
"table with 1 column and 1 row"
|
||||
]]
|
||||
}, {
|
||||
// Test pivot to list from li_one.
|
||||
|
Loading…
x
Reference in New Issue
Block a user