Closed Bug 1453606 Opened 6 years ago Closed 6 years ago

Add tests for examples from accessible name and description computation spec

Categories

(Core :: Disability Access APIs, enhancement)

enhancement
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla61
Tracking Status
firefox61 --- fixed

People

(Reporter: MarcoZ, Assigned: MarcoZ)

References

(Blocks 1 open bug, )

Details

Attachments

(1 file)

There are three test cases given in the accessible name and description computation specification 1.1 that are worth converting into unit tests since they cover interesting edge cases.
Comment on attachment 8967329 [details]
Bug 1453606 - Add tests for Accessible name and Description Computation spec test cases,

https://reviewboard.mozilla.org/r/236030/#review241772


Code analysis found 26 defects in this patch:
 - 26 defects found by mozlint

You can run this analysis locally with:
 - `./mach lint path/to/file` (JS/Python)


If you see a problem in this automated review, please report it here: http://bit.ly/2y9N9Vx


::: accessible/tests/mochitest/name/test_NameComputationExamples.html:19
(Diff revision 1)
> +          src="../common.js"></script>
> +  <script type="application/javascript"
> +          src="../name.js"></script>
> +
> +  <script type="application/javascript">
> +    function doTest() {

Error: Expected linebreaks to be 'lf' but found 'crlf'. [eslint: linebreak-style]

::: accessible/tests/mochitest/name/test_NameComputationExamples.html:20
(Diff revision 1)
> +  <script type="application/javascript"
> +          src="../name.js"></script>
> +
> +  <script type="application/javascript">
> +    function doTest() {
> +      // All test cases taken from https://www.w3.org/TR/accname-1.1/

Error: Expected linebreaks to be 'lf' but found 'crlf'. [eslint: linebreak-style]

::: accessible/tests/mochitest/name/test_NameComputationExamples.html:21
(Diff revision 1)
> +          src="../name.js"></script>
> +
> +  <script type="application/javascript">
> +    function doTest() {
> +      // All test cases taken from https://www.w3.org/TR/accname-1.1/
> +      // These were especially called out to demonstrate edge cases.

Error: Expected linebreaks to be 'lf' but found 'crlf'. [eslint: linebreak-style]

::: accessible/tests/mochitest/name/test_NameComputationExamples.html:22
(Diff revision 1)
> +
> +  <script type="application/javascript">
> +    function doTest() {
> +      // All test cases taken from https://www.w3.org/TR/accname-1.1/
> +      // These were especially called out to demonstrate edge cases.
> +

Error: Expected linebreaks to be 'lf' but found 'crlf'. [eslint: linebreak-style]

::: accessible/tests/mochitest/name/test_NameComputationExamples.html:23
(Diff revision 1)
> +  <script type="application/javascript">
> +    function doTest() {
> +      // All test cases taken from https://www.w3.org/TR/accname-1.1/
> +      // These were especially called out to demonstrate edge cases.
> +
> +      // Example 1 from section 4.3.1 under 2.B.

Error: Expected linebreaks to be 'lf' but found 'crlf'. [eslint: linebreak-style]

::: accessible/tests/mochitest/name/test_NameComputationExamples.html:24
(Diff revision 1)
> +    function doTest() {
> +      // All test cases taken from https://www.w3.org/TR/accname-1.1/
> +      // These were especially called out to demonstrate edge cases.
> +
> +      // Example 1 from section 4.3.1 under 2.B.
> +      // Element1 should get its name from the text in element3.

Error: Expected linebreaks to be 'lf' but found 'crlf'. [eslint: linebreak-style]

::: accessible/tests/mochitest/name/test_NameComputationExamples.html:25
(Diff revision 1)
> +      // All test cases taken from https://www.w3.org/TR/accname-1.1/
> +      // These were especially called out to demonstrate edge cases.
> +
> +      // Example 1 from section 4.3.1 under 2.B.
> +      // Element1 should get its name from the text in element3.
> +      // Element2 should not gets name from element1 because that already

Error: Expected linebreaks to be 'lf' but found 'crlf'. [eslint: linebreak-style]

::: accessible/tests/mochitest/name/test_NameComputationExamples.html:26
(Diff revision 1)
> +      // These were especially called out to demonstrate edge cases.
> +
> +      // Example 1 from section 4.3.1 under 2.B.
> +      // Element1 should get its name from the text in element3.
> +      // Element2 should not gets name from element1 because that already
> +      // gets its name from another element.

Error: Expected linebreaks to be 'lf' but found 'crlf'. [eslint: linebreak-style]

::: accessible/tests/mochitest/name/test_NameComputationExamples.html:27
(Diff revision 1)
> +
> +      // Example 1 from section 4.3.1 under 2.B.
> +      // Element1 should get its name from the text in element3.
> +      // Element2 should not gets name from element1 because that already
> +      // gets its name from another element.
> +      testName("el1", "hello");

Error: Expected linebreaks to be 'lf' but found 'crlf'. [eslint: linebreak-style]

::: accessible/tests/mochitest/name/test_NameComputationExamples.html:28
(Diff revision 1)
> +      // Example 1 from section 4.3.1 under 2.B.
> +      // Element1 should get its name from the text in element3.
> +      // Element2 should not gets name from element1 because that already
> +      // gets its name from another element.
> +      testName("el1", "hello");
> +      testName("el2", null);

Error: Expected linebreaks to be 'lf' but found 'crlf'. [eslint: linebreak-style]

::: accessible/tests/mochitest/name/test_NameComputationExamples.html:29
(Diff revision 1)
> +      // Element1 should get its name from the text in element3.
> +      // Element2 should not gets name from element1 because that already
> +      // gets its name from another element.
> +      testName("el1", "hello");
> +      testName("el2", null);
> +

Error: Expected linebreaks to be 'lf' but found 'crlf'. [eslint: linebreak-style]

::: accessible/tests/mochitest/name/test_NameComputationExamples.html:30
(Diff revision 1)
> +      // Element2 should not gets name from element1 because that already
> +      // gets its name from another element.
> +      testName("el1", "hello");
> +      testName("el2", null);
> +
> +      // Example 2 from section 4.3.1 under 2.C.

Error: Expected linebreaks to be 'lf' but found 'crlf'. [eslint: linebreak-style]

::: accessible/tests/mochitest/name/test_NameComputationExamples.html:31
(Diff revision 1)
> +      // gets its name from another element.
> +      testName("el1", "hello");
> +      testName("el2", null);
> +
> +      // Example 2 from section 4.3.1 under 2.C.
> +      // The buttons should get their name from their labels and the links.

Error: Expected linebreaks to be 'lf' but found 'crlf'. [eslint: linebreak-style]

::: accessible/tests/mochitest/name/test_NameComputationExamples.html:32
(Diff revision 1)
> +      testName("el1", "hello");
> +      testName("el2", null);
> +
> +      // Example 2 from section 4.3.1 under 2.C.
> +      // The buttons should get their name from their labels and the links.
> +      testName("del_row1", "Delete Documentation.pdf");

Error: Expected linebreaks to be 'lf' but found 'crlf'. [eslint: linebreak-style]

::: accessible/tests/mochitest/name/test_NameComputationExamples.html:33
(Diff revision 1)
> +      testName("el2", null);
> +
> +      // Example 2 from section 4.3.1 under 2.C.
> +      // The buttons should get their name from their labels and the links.
> +      testName("del_row1", "Delete Documentation.pdf");
> +      testName("del_row2", "Delete HolidayLetter.pdf");

Error: Expected linebreaks to be 'lf' but found 'crlf'. [eslint: linebreak-style]

::: accessible/tests/mochitest/name/test_NameComputationExamples.html:34
(Diff revision 1)
> +
> +      // Example 2 from section 4.3.1 under 2.C.
> +      // The buttons should get their name from their labels and the links.
> +      testName("del_row1", "Delete Documentation.pdf");
> +      testName("del_row2", "Delete HolidayLetter.pdf");
> +

Error: Expected linebreaks to be 'lf' but found 'crlf'. [eslint: linebreak-style]

::: accessible/tests/mochitest/name/test_NameComputationExamples.html:35
(Diff revision 1)
> +      // Example 2 from section 4.3.1 under 2.C.
> +      // The buttons should get their name from their labels and the links.
> +      testName("del_row1", "Delete Documentation.pdf");
> +      testName("del_row2", "Delete HolidayLetter.pdf");
> +
> +      // Example 3 from section 4.3.1 under 2.F.

Error: Expected linebreaks to be 'lf' but found 'crlf'. [eslint: linebreak-style]

::: accessible/tests/mochitest/name/test_NameComputationExamples.html:36
(Diff revision 1)
> +      // The buttons should get their name from their labels and the links.
> +      testName("del_row1", "Delete Documentation.pdf");
> +      testName("del_row2", "Delete HolidayLetter.pdf");
> +
> +      // Example 3 from section 4.3.1 under 2.F.
> +      // Name should be own content text plus the value of the input plus

Error: Expected linebreaks to be 'lf' but found 'crlf'. [eslint: linebreak-style]

::: accessible/tests/mochitest/name/test_NameComputationExamples.html:37
(Diff revision 1)
> +      testName("del_row1", "Delete Documentation.pdf");
> +      testName("del_row2", "Delete HolidayLetter.pdf");
> +
> +      // Example 3 from section 4.3.1 under 2.F.
> +      // Name should be own content text plus the value of the input plus
> +      // more own inner text, separated by 1 space.

Error: Expected linebreaks to be 'lf' but found 'crlf'. [eslint: linebreak-style]

::: accessible/tests/mochitest/name/test_NameComputationExamples.html:38
(Diff revision 1)
> +      testName("del_row2", "Delete HolidayLetter.pdf");
> +
> +      // Example 3 from section 4.3.1 under 2.F.
> +      // Name should be own content text plus the value of the input plus
> +      // more own inner text, separated by 1 space.
> +      testName("chkbx", "Flash the screen 5 times");

Error: Expected linebreaks to be 'lf' but found 'crlf'. [eslint: linebreak-style]

::: accessible/tests/mochitest/name/test_NameComputationExamples.html:39
(Diff revision 1)
> +
> +      // Example 3 from section 4.3.1 under 2.F.
> +      // Name should be own content text plus the value of the input plus
> +      // more own inner text, separated by 1 space.
> +      testName("chkbx", "Flash the screen 5 times");
> +

Error: Expected linebreaks to be 'lf' but found 'crlf'. [eslint: linebreak-style]

::: accessible/tests/mochitest/name/test_NameComputationExamples.html:40
(Diff revision 1)
> +      // Example 3 from section 4.3.1 under 2.F.
> +      // Name should be own content text plus the value of the input plus
> +      // more own inner text, separated by 1 space.
> +      testName("chkbx", "Flash the screen 5 times");
> +
> +      SimpleTest.finish();

Error: Expected linebreaks to be 'lf' but found 'crlf'. [eslint: linebreak-style]

::: accessible/tests/mochitest/name/test_NameComputationExamples.html:41
(Diff revision 1)
> +      // Name should be own content text plus the value of the input plus
> +      // more own inner text, separated by 1 space.
> +      testName("chkbx", "Flash the screen 5 times");
> +
> +      SimpleTest.finish();
> +    }

Error: Expected linebreaks to be 'lf' but found 'crlf'. [eslint: linebreak-style]

::: accessible/tests/mochitest/name/test_NameComputationExamples.html:42
(Diff revision 1)
> +      // more own inner text, separated by 1 space.
> +      testName("chkbx", "Flash the screen 5 times");
> +
> +      SimpleTest.finish();
> +    }
> +

Error: Expected linebreaks to be 'lf' but found 'crlf'. [eslint: linebreak-style]

::: accessible/tests/mochitest/name/test_NameComputationExamples.html:43
(Diff revision 1)
> +      testName("chkbx", "Flash the screen 5 times");
> +
> +      SimpleTest.finish();
> +    }
> +
> +    SimpleTest.waitForExplicitFinish();

Error: Expected linebreaks to be 'lf' but found 'crlf'. [eslint: linebreak-style]

::: accessible/tests/mochitest/name/test_NameComputationExamples.html:44
(Diff revision 1)
> +
> +      SimpleTest.finish();
> +    }
> +
> +    SimpleTest.waitForExplicitFinish();
> +    addA11yLoadEvent(doTest);

Error: Expected linebreaks to be 'lf' but found 'crlf'. [eslint: linebreak-style]
Fixed the line breaks.
Comment on attachment 8967329 [details]
Bug 1453606 - Add tests for Accessible name and Description Computation spec test cases,

https://reviewboard.mozilla.org/r/236030/#review241952

r=me, good to know we handle these test cases correctly :)

::: accessible/tests/mochitest/name/a11y.ini:17
(Diff revision 2)
>  [test_general.html]
>  [test_general.xul]
>  [test_link.html]
>  [test_list.html]
>  [test_markup.html]
> +[test_NameComputationExamples.html]

I would name it test_ARIACore_examples.html

::: accessible/tests/mochitest/name/test_NameComputationExamples.html:33
(Diff revision 2)
> +      testName("el2", null);
> +
> +      // Example 2 from section 4.3.1 under 2.C.
> +      // The buttons should get their name from their labels and the links.
> +      testName("del_row1", "Delete Documentation.pdf");
> +      testName("del_row2", "Delete HolidayLetter.pdf");

not sure I can see difference between these two

::: accessible/tests/mochitest/name/test_NameComputationExamples.html:74
(Diff revision 2)
> +            aria-labelledby="del_row2 file_row2"></span>
> +    </li>
> +  </ul>
> +
> +  <!-- Label from combined text and subtree -->
> +  <div id="chkbx" role="checkbox" aria-checked="false">Flash the screen 

space in the end of line, it appears you dont' have to have it for the test, correct?
Attachment #8967329 - Flags: review?(surkov.alexander) → review+
Comment on attachment 8967329 [details]
Bug 1453606 - Add tests for Accessible name and Description Computation spec test cases,

https://reviewboard.mozilla.org/r/236030/#review241952

> not sure I can see difference between these two

There is none, I just kept them both since they are also both in the original example. Didn't want to deviate from the source.
Pushed by mzehe@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/4afef4326f2e
Add tests for Accessible name and Description Computation spec test cases, r=surkov
https://hg.mozilla.org/mozilla-central/rev/4afef4326f2e
Status: ASSIGNED → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla61
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: