[orca] New test case



commit 7cc538cb7637bfc164974c9005604549caa5ab6b
Author: Joanmarie Diggs <jdiggs igalia com>
Date:   Tue Aug 4 11:53:53 2015 -0400

    New test case

 test/html/aria-modal-dialog.html                   |   83 ++++++++++++++++++++
 .../firefox/aria_dialog_dismissed.params           |    1 +
 test/keystrokes/firefox/aria_dialog_dismissed.py   |   51 ++++++++++++
 3 files changed, 135 insertions(+), 0 deletions(-)
---
diff --git a/test/html/aria-modal-dialog.html b/test/html/aria-modal-dialog.html
new file mode 100644
index 0000000..75629c2
--- /dev/null
+++ b/test/html/aria-modal-dialog.html
@@ -0,0 +1,83 @@
+<html>
+<head>
+<style>
+.box-hidden {
+       display: none;
+       position: absolute;
+       top: 19em; left:15em; width:20em; height:5em;
+       border: 2px solid black;
+       padding:0 1em 1em 1em;
+       background-color: #eee;
+       z-index:1002;
+       overflow: auto;
+       }               
+</style>
+
+<script>
+var dialogOpen = false, lastFocus, dialog, okbutton, pagebackground;
+
+function showDialog(el) {
+       lastFocus = el || document.activeElement;
+       toggleDialog('show');
+}
+function hideDialog(el) {
+       toggleDialog('hide');
+}
+
+function toggleDialog(sh) {
+       dialog = document.getElementById("box");
+       okbutton = document.getElementById("ok");
+       pagebackground = document.getElementById("bg");
+
+       if (sh == "show") {
+               dialogOpen = true;
+
+               // show the dialog 
+               dialog.style.display = 'block';
+               
+               // after displaying the dialog, focus an element inside it
+               okbutton.focus();
+               
+               // only hide the background *after* you've moved focus out of the content that will be 
"hidden"
+               pagebackground.setAttribute("aria-hidden","true");
+               
+       } else {
+               dialogOpen = false;
+               dialog.style.display = 'none';
+               pagebackground.setAttribute("aria-hidden","false");
+               lastFocus.focus(); 
+       }
+}
+
+
+document.addEventListener("focus", function(event) {
+
+    var d = document.getElementById("box");
+
+    if (dialogOpen && !d.contains(event.target)) {
+        event.stopPropagation();
+        d.focus();
+    }
+
+}, true);
+
+
+document.addEventListener("keydown", function(event) {
+    if (dialogOpen && event.keyCode == 27) {
+        toggleDialog('hide');
+    }
+}, true);
+</script>
+</head>
+<body>
+<p>This was taken from <a 
href="http://www.w3.org/WAI/GL/wiki/Using_ARIA_role%3Ddialog_to_implement_a_modal_dialog_box";>The WCAG 
Wiki</a>.</p>
+<p><a onclick="toggleDialog('show');" href="#">Display a dialog</a></p>
+
+<div tabindex="-1" style="display: none;" role="dialog" aria-labelledby="myDialog" id="box" 
class="box-hidden">
+       <h3 id="myDialog">Just an example.</h3>
+       <button onclick="toggleDialog('hide');" class="close-button">OK</button>
+       <button onclick="toggleDialog('hide');" class="close-button">Cancel</button>            
+</div>
+<p>Another <a href="foo">link</a></p>
+</body>
+</html>
diff --git a/test/keystrokes/firefox/aria_dialog_dismissed.params 
b/test/keystrokes/firefox/aria_dialog_dismissed.params
new file mode 100644
index 0000000..e3b5553
--- /dev/null
+++ b/test/keystrokes/firefox/aria_dialog_dismissed.params
@@ -0,0 +1 @@
+PARAMS=$TEST_DIR/../../html/aria-modal-dialog.html
diff --git a/test/keystrokes/firefox/aria_dialog_dismissed.py 
b/test/keystrokes/firefox/aria_dialog_dismissed.py
new file mode 100644
index 0000000..5336f8d
--- /dev/null
+++ b/test/keystrokes/firefox/aria_dialog_dismissed.py
@@ -0,0 +1,51 @@
+#!/usr/bin/python
+
+from macaroon.playback import *
+import utils
+
+sequence = MacroSequence()
+
+sequence.append(KeyComboAction("Tab"))
+
+sequence.append(utils.StartRecordingAction())
+sequence.append(KeyComboAction("Tab"))
+sequence.append(utils.AssertPresentationAction(
+    "1. Tab to link",
+    ["BRAILLE LINE:  'Display a dialog'",
+     "     VISIBLE:  'Display a dialog', cursor=1",
+     "BRAILLE LINE:  'Display a dialog'",
+     "     VISIBLE:  'Display a dialog', cursor=1",
+     "SPEECH OUTPUT: 'Display a dialog link.'"]))
+
+sequence.append(utils.StartRecordingAction())
+sequence.append(KeyComboAction("Return"))
+sequence.append(utils.AssertPresentationAction(
+    "2. Return to open dialog",
+    ["BRAILLE LINE:  'Just an example. dialog'",
+     "     VISIBLE:  'Just an example. dialog', cursor=1",
+     "SPEECH OUTPUT: 'Just an example.'"]))
+
+sequence.append(utils.StartRecordingAction())
+sequence.append(KeyComboAction("Tab"))
+sequence.append(utils.AssertPresentationAction(
+    "3. Tab to dialog button",
+    ["BRAILLE LINE:  'OK push button'",
+     "     VISIBLE:  'OK push button', cursor=1",
+     "SPEECH OUTPUT: 'OK push button'"]))
+
+sequence.append(utils.StartRecordingAction())
+sequence.append(KeyComboAction("Escape"))
+sequence.append(utils.AssertPresentationAction(
+    "4. Escape to dismiss dialog",
+    ["KNOWN ISSUE: https://bugzilla.mozilla.org/show_bug.cgi?id=1190882";,
+     ""]))
+
+sequence.append(utils.StartRecordingAction())
+sequence.append(KeyComboAction("Down"))
+sequence.append(utils.AssertPresentationAction(
+    "5. Down to move to next line",
+    ["KNOWN ISSUE: https://bugzilla.mozilla.org/show_bug.cgi?id=1190882";,
+     ""]))
+
+sequence.append(utils.AssertionSummaryAction())
+sequence.start()



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]