diff options
author | 2008-11-13 09:49:11 +0000 | |
---|---|---|
committer | 2008-11-13 09:49:11 +0000 | |
commit | e44a7e37b6c7b5961adaffc62b9042b8d442938e (patch) | |
tree | 95b67c356e93163467db2451f2b8cce84ed5d582 /includes/js/dijit/tests/_base/wai.html | |
parent | a62b9742ee5e28bcec6872d88f50f25b820914f6 (diff) | |
download | scuttle-e44a7e37b6c7b5961adaffc62b9042b8d442938e.tar.gz scuttle-e44a7e37b6c7b5961adaffc62b9042b8d442938e.zip |
New feature: basic Ajax suggestion for tags and implementation of Dojo toolkit
git-svn-id: https://semanticscuttle.svn.sourceforge.net/svnroot/semanticscuttle/trunk@151 b3834d28-1941-0410-a4f8-b48e95affb8f
Diffstat (limited to 'includes/js/dijit/tests/_base/wai.html')
-rw-r--r-- | includes/js/dijit/tests/_base/wai.html | 115 |
1 files changed, 115 insertions, 0 deletions
diff --git a/includes/js/dijit/tests/_base/wai.html b/includes/js/dijit/tests/_base/wai.html new file mode 100644 index 0000000..50ab8ca --- /dev/null +++ b/includes/js/dijit/tests/_base/wai.html @@ -0,0 +1,115 @@ +<html>
+<head>
+ <title>Dijit wai unit test</title>
+ <script type="text/javascript" src="../../../dojo/dojo.js"
+ djConfig="isDebug: true"></script>
+ <script type="text/javascript">
+ dojo.require("doh.runner");
+ dojo.require("dijit.dijit");
+
+ dojo.addOnLoad(function(){
+ doh.register("dijit.tests._base.wai",
+ [
+ function getWaiRoleOnElementWithNoRole(){
+ var elem = dojo.byId("no-role-or-states");
+ doh.assertFalse(dijit.hasWaiRole(elem));
+ doh.assertEqual("", dijit.getWaiRole(elem));
+ },
+
+ function getEmptyWairoleRole(){
+ var elem = dojo.byId("empty-wairole");
+ doh.assertTrue(dijit.hasWaiRole(elem));
+ doh.assertEqual("", dijit.getWaiRole(elem));
+ },
+
+ function getWairoleRole(){
+ var elem = dojo.byId("wairole");
+ doh.assertTrue(dijit.hasWaiRole(elem));
+ doh.assertEqual("menuitem", dijit.getWaiRole(elem));
+ },
+
+ function getUnprefixedRole(){
+ var elem = dojo.byId("unprefixed-role");
+ doh.assertTrue(dijit.hasWaiRole(elem));
+ doh.assertEqual("menuitem", dijit.getWaiRole(elem));
+ },
+
+ function setWaiRole(){
+ var div = document.createElement("div");
+ dijit.setWaiRole(div, "menuitem");
+ if(dojo.isFF && dojo.isFF < 3){
+ doh.assertEqual("wairole:menuitem",
+ div.getAttribute("role"));
+ }else{
+ doh.assertEqual("menuitem",
+ div.getAttribute("role"));
+ }
+ },
+
+ function removeWaiRole(){
+ var div = document.createElement("div");
+ dijit.setWaiRole(div, "menuitem");
+ dijit.removeWaiRole(div);
+ if(div.hasAttribute){
+ doh.assertFalse(div.hasAttribute("role"));
+ }else{
+ doh.assertTrue(div.getAttribute("role") == null
+ || div.getAttribute("role") == "");
+ }
+ },
+
+ function getWaiStateOnElementWithNoState(){
+ var elem = dojo.byId("no-role-or-states");
+ doh.assertFalse(dijit.hasWaiState(elem, "checked"));
+ doh.assertEqual("", dijit.getWaiState(elem, "checked"));
+ },
+
+ function getWaiState(){
+ if(dojo.isFF && dojo.isFF < 3){
+ var div = document.createElement("div");
+ div.setAttributeNS("http://www.w3.org/2005/07/aaa",
+ "aaa:checked", "true");
+ doh.assertTrue(dijit.hasWaiState(div, "checked"));
+ doh.assertEqual("true",
+ dijit.getWaiState(div, "checked"));
+ }else{
+ var elem = dojo.byId("checked");
+ doh.assertTrue(dijit.hasWaiState(elem, "checked"));
+ doh.assertEqual("true",
+ dijit.getWaiState(elem, "checked"));
+ }
+ },
+
+ function setWaiState(){
+ var div = document.createElement("div");
+ dijit.setWaiState(div, "checked", "true");
+ if(dojo.isFF && dojo.isFF < 3){
+ doh.assertEqual("true",
+ div.getAttributeNS("http://www.w3.org/2005/07/aaa",
+ "checked"));
+ }else{
+ doh.assertEqual("true",
+ div.getAttribute("aria-checked"));
+ }
+ },
+
+ function removeWaiState(){
+ var div = document.createElement("div");
+ dijit.setWaiState(div, "checked", "true");
+ dijit.removeWaiState(div, "checked");
+ doh.assertEqual("", dijit.getWaiState(div, "checked"));
+ }
+ ]
+ );
+ doh.run();
+ });
+ </script>
+</head>
+<body>
+ <div id="no-role-or-states"></div>
+ <div id="empty-wairole" role="wairole:"></div>
+ <div id="wairole" role="wairole:menuitem"></div>
+ <div id="unprefixed-role" role="menuitem"></div>
+ <div id="checked" aria-checked="true"></div>
+</body>
+</html>
|