Skip to content

Commit

Permalink
script change
Browse files Browse the repository at this point in the history
  • Loading branch information
howard-e committed Feb 4, 2022
1 parent 927c750 commit 935a967
Show file tree
Hide file tree
Showing 7 changed files with 98 additions and 0 deletions.
6 changes: 6 additions & 0 deletions tests/alert-test/data/commands.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
testId,task,mode,at,commandA,commandB,commandC,commandD,commandE,commandF
1,trigger alert,reading,JAWS,SPACE,ENTER,,,,
1,trigger alert,reading,NVDA,SPACE,ENTER,,,,
2,trigger alert,interaction,JAWS,SPACE,ENTER,,,,
2,trigger alert,interaction,NVDA,SPACE,ENTER,,,,
3,trigger alert,interaction,voiceover_macos,CTRL_OPT_SPACE,SPACE,ENTER,,,
2 changes: 2 additions & 0 deletions tests/alert-test/data/js/setFocusOnButton.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// sets focus on the 'Trigger Alert' button
testPageDocument.querySelector('#alert-trigger').focus();
10 changes: 10 additions & 0 deletions tests/alert-test/data/references.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
refId,value
author,Isabel Del Castillo
authorEmail,[email protected]
title,Alert Example
reference,reference/2021-10-15_143458/alert.html
designPattern,https://w3c.github.io/aria-practices/#alert
example,https://w3c.github.io/aria-practices/examples/alert/alert.html
alert,https://w3c.github.io/aria/#alert
aria-live,https://w3c.github.io/aria/#aria-live)
aria-atomic,https://w3c.github.io/aria/#aria-atomic
4 changes: 4 additions & 0 deletions tests/alert-test/data/tests.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
testId,title,appliesTo,mode,task,setupScript,setupScriptDescription,refs,instructions,assertion1,assertion2,assertion3,assertion4,assertion5,assertion6,assertion7
1,Trigger an alert in reading mode,"JAWS,NVDA",reading,trigger alert,setFocusOnButton,sets focus on the 'Trigger Alert' button,alert,"With the reading cursor on the 'Trigger Alert' button, activate the button to trigger the alert.",Role 'alert' is conveyed,Text 'Hello' is conveyed,,,,,
2,Trigger an alert in interaction mode,"JAWS,NVDA",interaction,trigger alert,setFocusOnButton,sets focus on the 'Trigger Alert' button,alert,"With focus on the 'Trigger Alert' button, activate the button to trigger the alert.",Role 'alert' is conveyed,Text 'Hello' is conveyed,,,,,
3,Trigger an alert,voiceover_macos,interaction,trigger alert,setFocusOnButton,sets focus on the 'Trigger Alert' button,alert,"With focus on the 'Trigger Alert' button, activate the button to trigger the alert.",Role 'alert' is conveyed,Text 'Hello' is conveyed,,,,,
37 changes: 37 additions & 0 deletions tests/alert-test/reference/2021-10-15_143458/alert.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Alert Example</title>

<!-- js and css for this example. -->
<link href="css/alert.css" rel="stylesheet">
<script src="js/alert.js" type="text/javascript"></script>
</head>
<body>
<main>
<h1>Alert Example</h1>
<p>
The below example demonstrates the <a href="https://w3c.github.io/#alert">design pattern for alert</a>.
Activating the <q>Trigger Alert</q> button causes a message to be inserted into the example alert element.
</p>
<section>
<div class="example-header">
<h2 id="ex_label">Example</h2>
</div>
<div role="separator" id="ex_start_sep" aria-labelledby="ex_start_sep ex_label" aria-label="Start of"></div>
<div id="ex1">
<button type="button" id="alert-trigger">Trigger Alert</button>

<div id="example" role="alert"></div>

<!-- The following script element contains the content that will be inserted into the alert element. -->
<script type="text/template" id="alert-template">
<p>Hello</p>
</script>
</div>
<div role="separator" id="ex_end_sep" aria-labelledby="ex_end_sep ex_label" aria-label="End of"></div>
</section>
</main>
</body>
</html>
10 changes: 10 additions & 0 deletions tests/alert-test/reference/2021-10-15_143458/css/alert.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[role="alert"] {
padding: 10px;
border: 2px solid hsl(206, 74%, 54%);
border-radius: 4px;
background: hsl(206, 74%, 90%);
}

[role="alert"]:empty {
display: none;
}
29 changes: 29 additions & 0 deletions tests/alert-test/reference/2021-10-15_143458/js/alert.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/*
* This content is licensed according to the W3C Software License at
* https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document
*
*/

'use strict';

window.addEventListener('load', function () {
var button = document.getElementById('alert-trigger');

button.addEventListener('click', addAlert);
});

/*
* @function addAlert
*
* @desc Adds an alert to the page
*
* @param {object} event - Standard W3C event object
*
*/

function addAlert() {
var example = document.getElementById('example');
var template = document.getElementById('alert-template').innerHTML;

example.innerHTML = template;
}

0 comments on commit 935a967

Please sign in to comment.