|
1 |
| -import { assert, test, testGroup, triggerEvent } from "test/test_helper" |
| 1 | +import { assert, skipIf, test, testGroup, triggerEvent } from "test/test_helper" |
| 2 | +import TrixEditorElement from "trix/elements/trix_editor_element" |
2 | 3 |
|
3 | 4 | testGroup("Accessibility attributes", { template: "editor_default_aria_label" }, () => {
|
4 | 5 | test("sets the role to textbox", () => {
|
5 | 6 | const editor = document.getElementById("editor-without-labels")
|
6 | 7 | assert.equal(editor.getAttribute("role"), "textbox")
|
7 | 8 | })
|
8 | 9 |
|
9 |
| - test("does not set aria-label when the element has no <label> elements", () => { |
| 10 | + skipIf(TrixEditorElement.formAssociated, "does not set aria-label when the element has no <label> elements", () => { |
10 | 11 | const editor = document.getElementById("editor-without-labels")
|
11 | 12 | assert.equal(editor.hasAttribute("aria-label"), false)
|
12 | 13 | })
|
13 | 14 |
|
14 |
| - test("does not override aria-label when the element declares it", () => { |
| 15 | + skipIf(TrixEditorElement.formAssociated, "does not override aria-label when the element declares it", () => { |
15 | 16 | const editor = document.getElementById("editor-with-aria-label")
|
16 | 17 | assert.equal(editor.getAttribute("aria-label"), "ARIA Label text")
|
17 | 18 | })
|
18 | 19 |
|
19 |
| - test("does not set aria-label when the element declares aria-labelledby", () => { |
| 20 | + skipIf(TrixEditorElement.formAssociated, "does not set aria-label when the element declares aria-labelledby", () => { |
20 | 21 | const editor = document.getElementById("editor-with-aria-labelledby")
|
21 | 22 | assert.equal(editor.hasAttribute("aria-label"), false)
|
22 | 23 | assert.equal(editor.getAttribute("aria-labelledby"), "aria-labelledby-id")
|
23 | 24 | })
|
24 | 25 |
|
25 |
| - test("assigns aria-label to the text of the element's <label> elements", () => { |
| 26 | + skipIf(TrixEditorElement.formAssociated, "assigns aria-label to the text of the element's <label> elements", () => { |
26 | 27 | const editor = document.getElementById("editor-with-labels")
|
27 | 28 | assert.equal(editor.getAttribute("aria-label"), "Label 1 Label 2 Label 3")
|
28 | 29 | })
|
29 | 30 |
|
30 |
| - test("updates the aria-label on focus", () => { |
| 31 | + skipIf(TrixEditorElement.formAssociated, "updates the aria-label on focus", () => { |
31 | 32 | const editor = document.getElementById("editor-with-modified-label")
|
32 | 33 | const label = document.getElementById("modified-label")
|
33 | 34 |
|
|
0 commit comments