Bug 858130 - [AccessFu] Utterances are now stripped of whitespace. r=eeejay r=marcoz

This commit is contained in:
Yura Zenevich 2013-05-28 11:04:01 -07:00
parent 50fd8cc611
commit 8089c5b818
3 changed files with 57 additions and 33 deletions

View File

@ -97,6 +97,10 @@ this.UtteranceGenerator = {
aContext.newAncestry.reverse().forEach(addUtterance);
}
// Clean up the white space.
let trimmed;
utterance = [trimmed for (word of utterance) if (trimmed = word.trim())];
return utterance;
},

View File

@ -41,31 +41,32 @@
}, {
accOrElmOrID: "list",
expected: ["list 2 items", "Test List", "First item", "Top of the list",
"1. ", "list one", "Last item", "2. ", "list two"]
"1.", "list one", "Last item", "2.", "list two"]
}, {
accOrElmOrID: "dlist",
expected: ["definition list 0.5 items", "Test Definition List", "dd one "]
expected: ["definition list 0.5 items", "Test Definition List",
"dd one"]
}, {
accOrElmOrID: "li_one",
expected: ["list 2 items", "Test List", "First item", "Top of the list"]
}, {
accOrElmOrID: "li_two",
expected: ["list 2 items", "Test List", "Last item", "2. ", "list two"]
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"]
"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", " ", "link", "repost"]
expected: ["list 2 items", "First item", "link", "star", "Last item",
"link", "repost"]
}, {
// Test pivot to list from li_one.
accOrElmOrID: "list",
oldAccOrElmOrID: "li_one",
expected: ["list 2 items", "Test List", "First item", "Top of the list",
"1. ", "list one", "Last item", "2. ", "list two"]
"1.", "list one", "Last item", "2.", "list two"]
}, {
// Test pivot to li_one from list.
accOrElmOrID: "li_one",
@ -81,9 +82,9 @@
// Test pivot to the table cell from the "apples" link.
accOrElmOrID: "cell",
oldAccOrElmOrID: "apples",
expected: ["List of Fruits", "list 4 items", "First item", " ", "link",
"Apples", " ", "link", "Bananas", " ", "link", "Peaches", "Last item",
" ", "link", "Plums"]
expected: ["List of Fruits", "list 4 items", "First item", "link",
"Apples", "link", "Bananas", "link", "Peaches", "Last item", "link",
"Plums"]
}];
// Test various explicit names vs the utterance generated from subtrees.
@ -109,19 +110,25 @@
<div id="content" style="display: none"></div>
<pre id="test"></pre>
<button id="button1" aria-label="Press me">This is not a name</button>
<button id="button2">Press me</button>
<button id="button2">
Press me
</button>
<a id="anchor1" href="#test" title="title"></a>
<a id="anchor2" href="#test">This is a link</a>
<textarea id="textarea1" title="Test Text Area" cols="80" rows="5">This is the text area text.</textarea>
<textarea id="textarea2" cols="80" rows="5">This is the text area text.</textarea>
<textarea id="textarea2" cols="80" rows="5">
This is the text area text.
</textarea>
<h1 id="heading1" title="Test heading">This is the heading.</h1>
<h1 id="heading2">This is the heading.</h1>
<h1 id="heading2">
This is the heading.
</h1>
<ol id="list" title="Test List">
<li id="li_one" aria-label="Top of the list">list one</li>
<li id="li_two">list two</li>
</ol>
<dl id="dlist" title="Test Definition List">
<dd id="dd_one">dd one</li>
<dd id="dd_one">dd one</dd>
</dl>
<table>
<caption>Fruits and vegetables</caption>
@ -131,7 +138,12 @@
<li><a id="apples" href="#">Apples</a></li>
<li><a id="bananas" href="#">Bananas</a></li>
<li><a href="#">Peaches</a></li>
<li><a href="#">Plums</a></li>
<li>
<a href="#">
Plums
</a>
</li>
</ul>
</td>
</tr>

View File

@ -39,39 +39,39 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=753984
}, {
accOrElmOrID: "list",
expected: [
["list 1 items", "First item", "1. ", "list one"],
["1. ", "list one", "First item", "list 1 items"]
["list 1 items", "First item", "1.", "list one"],
["1.", "list one", "First item", "list 1 items"]
]
}, {
accOrElmOrID: "dlist",
expected: [
["definition list 0.5 items", "dd one "],
["dd one ", "definition list 0.5 items"]
["definition list 0.5 items", "dd one"],
["dd one", "definition list 0.5 items"]
]
}, {
accOrElmOrID: "li_one",
expected: [
["list 1 items", "First item", "1. ", "list one"],
["1. ", "list one", "First item", "list 1 items"]
["list 1 items", "First item", "1.", "list one"],
["1.", "list one", "First item", "list 1 items"]
]
}, {
accOrElmOrID: "cell",
expected: [[
"table", "Fruits and vegetables", "list 4 items", "First item", " ",
"link", "Apples", " ", "link", "Bananas", " ", "link", "Peaches",
"Last item", " ", "link", "Plums"
"table", "Fruits and vegetables", "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"
"Apples", "link", "First item", "Bananas", "link", "Peaches",
"link", "Plums", "link", "Last item", "list 4 items",
"Fruits and vegetables", "table"
]]
}, {
// Test pivot to list from li_one.
accOrElmOrID: "list",
oldAccOrElmOrID: "li_one",
expected: [
["list 1 items", "First item", "1. ", "list one"],
["1. ", "list one", "First item", "list 1 items"]
["list 1 items", "First item", "1.", "list one"],
["1.", "list one", "First item", "list 1 items"]
]
}, {
// Test pivot to "apples" link from the table cell.
@ -120,13 +120,17 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=753984
<div id="content" style="display: none"></div>
<pre id="test"></pre>
<a id="anchor" href="#test" title="title"></a>
<textarea id="textarea" cols="80" rows="5">This is the text area text.</textarea>
<textarea id="textarea" cols="80" rows="5">
This is the text area text.
</textarea>
<h1 id="heading" title="Test heading"></h1>
<ol id="list">
<li id="li_one">list one</li>
</ol>
<dl id="dlist">
<dd id="dd_one">dd one</li>
<dd id="dd_one">
dd one
</dd>
</dl>
<table>
<caption>Fruits and vegetables</caption>
@ -136,7 +140,11 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=753984
<li><a id="apples" href="#">Apples</a></li>
<li><a id="bananas" href="#">Bananas</a></li>
<li><a href="#">Peaches</a></li>
<li><a href="#">Plums</a></li>
<li>
<a href="#">
Plums
</a>
</li>
</ul>
</td>
</tr>