Warning:
This wiki has been archived and is now read-only.
SC2-4-4+SC4-1-2-anchors-have-names
This test belongs to 2.4.4 Link Purpose (In Context) and 4.1.2 Name, Role, Value.
Status
Contents
Description
This test checks that all links have a name.
Background
Assumptions
This test assumes that all image elements have alt attributes (see SC1-1-1-img-alt).
Test properties
| Property | Values |
|---|---|
| Test name | Anchor elements have a name |
| Success Criterion | |
| Test mode | Automatic |
| Test environment | rendered page |
| Test subject | single web page |
Test procedure
Selector
earl:automatic
Select the following elements: a[href].
Step 1
earl:automatic
If the link contains rendered text that is non-empty, return:
| Property | Value |
|---|---|
| TestCase | SC2-4-4+SC4-1-2-anchors-have-names |
| Identifier | SC2-4-4+SC4-1-2-anchors-have-names-passed1 |
| Outcome | passed |
| Pointer | position |
| Info | Link contains text |
Else continue to #Step 2
Step 2
earl:automatic
Concatenate the link's title and aria-label attribute, and the text content of an element referred to with the aria-labeledby attribute, in variable T1.
If T1 contains non-empty text, return:
| Property | Value |
|---|---|
| TestCase | SC2-4-4+SC4-1-2-anchors-have-names |
| Identifier | SC2-4-4+SC4-1-2-anchors-have-names-passed2 |
| Outcome | passed |
| Pointer | position |
| Info | The link has a name |
Else continue to #Step 3
Open question: Is the title ignored with aria-label
Step 3
earl:automatic
Take all img elements from the selected element (if any), that do not have [role=presentation] and are not hidden through display:none or visibility:hidden.
Concatenate the results of Text Alternative Computation Algorithm run on the img elements and assign it to variable T1.
If T1 contains non-empty text, return:
| Property | Value |
|---|---|
| TestCase | SC2-4-4+SC4-1-2-anchors-have-names |
| Identifier | SC2-4-4+SC4-1-2-anchors-have-names-passed3 |
| Outcome | passed |
| Pointer | position |
| Info | The link contains images with a text alternative |
Else return:
| Property | Value |
|---|---|
| TestCase | SC2-4-4+SC4-1-2-anchors-have-names |
| Identifier | SC2-4-4+SC4-1-2-anchors-have-names-failed |
| Outcome | failed |
| ErrorMessage | An image is the only content of this anchor and so it should have a text alternative to give a name to the link. |
| Pointer | position |
| Info |