Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(Valerie_Label_HasContent): add more test cases for shadow DOM slot tests #1363

Merged
merged 7 commits into from
Mar 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
<!DOCTYPE html>
<!--
/******************************************************************************
Copyright:: 2020- IBM, Inc

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*****************************************************************************/
-->

<html lang="en-US">
<head>
<title>Slot Label 10</title>
<meta charset="UTF-8" />
</head>
<body>
<main id="main">
<label id="host" for="input1">
<slot>Search by location or language. Note: Location/Language will be dynamically updated as you provide the input</slot>
</label>
<input id="input1" type="text" />
</main>

<script type="text/javascript">
UnitTest = {
ruleIds: ["Valerie_Label_HasContent"],
results: [
{
"ruleId": "Valerie_Label_HasContent",
"value": [
"INFORMATION",
"PASS"
],
"path": {
"dom": "/html[1]/body[1]/main[1]/label[1]",
"aria": "/document[1]/main[1]"
},
"reasonId": "Pass_Regular",
"message": "<label> element has accessible name with inner content",
"messageArgs": [],
"apiArgs": [],
"category": "Accessibility"
}
]
}

</script>
</body>
</html>
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<!--
/******************************************************************************
Copyright:: 2020- IBM, Inc

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*****************************************************************************/
-->

<!DOCTYPE html>
<html lang="en">
<head>
<title>Slot label 12</title>
</head>
<body>
<script>
customElements.define('custom-element', class extends HTMLElement {
connectedCallback() {
this.attachShadow({mode: 'open'});
this.shadowRoot.innerHTML = `
<label for="input1">
<slot name="labeltext"></slot>
</label>
<input id="input1" type="text" />
`;
}
});
</script>

<custom-element>
<span slot="labeltext">This is input label</span>
</custom-element>

<script type="text/javascript">
UnitTest = {
ruleIds: ["Valerie_Label_HasContent"],
results: [
{
"ruleId": "Valerie_Label_HasContent",
"value": [
"INFORMATION",
"PASS"
],
"path": {
"dom": "/html[1]/body[1]/custom-element[1]/#document-fragment[1]/label[1]",
"aria": "/document[1]"
},
"reasonId": "Pass_Regular",
"message": "<label> element has accessible name with inner content",
"messageArgs": [],
"apiArgs": [],
"category": "Accessibility"
}
]
}

</script>
</body>
</html>
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
<!DOCTYPE html>
<!--
/******************************************************************************
Copyright:: 2020- IBM, Inc

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*****************************************************************************/
-->

<html lang="en-US">
<head>
<title>Shadow DOM input Label</title>
<meta charset="UTF-8" />
</head>
<body>
<main id="main">
<div id="host"><span slot="label">Search by location or language. Note: Location/Language will be dynamically updated as you provide the input</span>
</div>
</main>
<script type="text/javascript">
let shadow = document.getElementById("host").attachShadow({ mode: "open" });
shadow.innerHTML = `
<label for="input1"><slot name='label'></slot>
</label>
<input id="input1" type="text" />
`;

</script>
<script type="text/javascript">
UnitTest = {
ruleIds: ["Valerie_Label_HasContent"],
results: [
{
"ruleId": "Valerie_Label_HasContent",
"value": [
"INFORMATION",
"PASS"
],
"path": {
"dom": "/html[1]/body[1]/main[1]/div[1]/#document-fragment[1]/label[1]",
"aria": "/document[1]/main[1]"
},
"reasonId": "Pass_Regular",
"message": "<label> element has accessible name with inner content",
"messageArgs": [],
"apiArgs": [],
"category": "Accessibility"
}
]
}

</script>
</body>
</html>
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
<!DOCTYPE html>
<!--
/******************************************************************************
Copyright:: 2020- IBM, Inc

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*****************************************************************************/
-->

<html lang="en-US">
<head>
<title>Slot Label 13</title>
<meta charset="UTF-8" />
</head>
<body>
<main id="main">
<div id="host"><span slot="label">Search by location or language. Note: Location/Language will be dynamically updated as you provide the input</span>
</div>
</main>
<script type="text/javascript">
let shadow = document.getElementById("host").attachShadow({ mode: "open" });
shadow.innerHTML = `
<label for="input1"><slot name='label'></slot>
</label>
<input id="input1" type="text" />
`;

</script>
<script type="text/javascript">
UnitTest = {
ruleIds: ["Valerie_Label_HasContent"],
results: [
{
"ruleId": "Valerie_Label_HasContent",
"value": [
"INFORMATION",
"PASS"
],
"path": {
"dom": "/html[1]/body[1]/main[1]/div[1]/#document-fragment[1]/label[1]",
"aria": "/document[1]/main[1]"
},
"reasonId": "Pass_Regular",
"message": "<label> element has accessible name with inner content",
"messageArgs": [],
"apiArgs": [],
"category": "Accessibility"
}
]
}

</script>
</body>
</html>
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
<!DOCTYPE html>
<!--
/******************************************************************************
Copyright:: 2020- IBM, Inc

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*****************************************************************************/
-->

<html lang="en-US">
<head>
<title>Slot Label 20</title>
<meta charset="UTF-8" />
</head>
<body>
<main id="main">
<div id="host"></div>
</main>
<script type="text/javascript">
let shadow = document
.getElementById("host")
.attachShadow({ mode: "open" });
shadow.innerHTML = `
<label for="input1">
<slot>Search by location or language. Note: Location/Language will be dynamically updated as you provide the input</slot>
</label>
<input id="input1" type="text" />
`;

</script>
<script type="text/javascript">
UnitTest = {
ruleIds: ["Valerie_Label_HasContent"],
results: [
{
"ruleId": "Valerie_Label_HasContent",
"value": [
"INFORMATION",
"PASS"
],
"path": {
"dom": "/html[1]/body[1]/main[1]/div[1]/#document-fragment[1]/label[1]",
"aria": "/document[1]/main[1]"
},
"reasonId": "Pass_Regular",
"message": "<label> element has accessible name with inner content",
"messageArgs": [],
"apiArgs": [],
"category": "Accessibility"
}
]
}

</script>
</body>
</html>
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
<!DOCTYPE html>
<!--
/******************************************************************************
Copyright:: 2020- IBM, Inc

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*****************************************************************************/
-->

<html lang="en-US">
<head>
<title>Slot Label 21</title>
<meta charset="UTF-8" />
</head>
<body>
<main id="main">
<div id="host">
</div>
</main>
<script type="text/javascript">
let shadow = document
.getElementById("host")
.attachShadow({ mode: "open" });
shadow.innerHTML = `
<label for="input1">
<slot>Search by location or language. Note: Location/Language will be dynamically updated as you provide the input</slot>
</label>
<input id="input1" type="text" />
`;

</script>
<script type="text/javascript">
UnitTest = {
ruleIds: ["Valerie_Label_HasContent"],
results: [
{
"ruleId": "Valerie_Label_HasContent",
"value": [
"INFORMATION",
"FAIL"
],
"path": {
"dom": "/html[1]/body[1]/main[1]/div[1]/#document-fragment[1]/label[1]",
"aria": "/document[1]/main[1]"
},
"reasonId": "Fail_1",
"message": "The <label> element does not have descriptive text that identifies the expected input",
"messageArgs": [],
"apiArgs": [],
"category": "Accessibility"
}
]
}

</script>
</body>
</html>
Loading