aboutsummaryrefslogtreecommitdiff
path: root/includes/js/dijit/tests/_base
diff options
context:
space:
mode:
Diffstat (limited to 'includes/js/dijit/tests/_base')
-rw-r--r--includes/js/dijit/tests/_base/manager.html322
-rw-r--r--includes/js/dijit/tests/_base/manager.js9
-rw-r--r--includes/js/dijit/tests/_base/test_FocusManager.html46
-rw-r--r--includes/js/dijit/tests/_base/test_focusWidget.html130
-rw-r--r--includes/js/dijit/tests/_base/test_placeStrict.html400
-rw-r--r--includes/js/dijit/tests/_base/test_typematic.html56
-rw-r--r--includes/js/dijit/tests/_base/viewport.html79
-rw-r--r--includes/js/dijit/tests/_base/viewport.js10
-rw-r--r--includes/js/dijit/tests/_base/viewportStrict.html81
-rw-r--r--includes/js/dijit/tests/_base/wai.html115
-rw-r--r--includes/js/dijit/tests/_base/wai.js9
11 files changed, 1257 insertions, 0 deletions
diff --git a/includes/js/dijit/tests/_base/manager.html b/includes/js/dijit/tests/_base/manager.html
new file mode 100644
index 0000000..3ca3349
--- /dev/null
+++ b/includes/js/dijit/tests/_base/manager.html
@@ -0,0 +1,322 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
+ "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+ <title>Dijit manager unit test</title>
+ <style type="text/css">
+ @import "../../../dojo/resources/dojo.css";
+ @import "../css/dijitTests.css";
+ </style>
+ <script type="text/javascript" src="../../../dojo/dojo.js"
+ djConfig="isDebug: true, parseOnLoad: true"></script>
+ <script type="text/javascript" src="../_testCommon.js"></script>
+
+ <script type="text/javascript">
+ dojo.require("doh.runner");
+ dojo.require("dijit.dijit");
+
+ dojo.declare("foo", dijit._Widget, {
+ name: "",
+ attr1: 0,
+ attr2: 0
+ });
+
+ dojo.declare("bar", dijit._Widget, {
+ name: "",
+ attr1: 0,
+ attr2: 0
+ });
+
+ dojo.addOnLoad(function(){
+ doh.register("dijit._base.manager",
+ [
+ function forEachTest(t){
+ var names=[];
+ dijit.registry.forEach(function(widget){ names.push(widget.name); });
+ t.is(names.join(" "), "bob is your uncle");
+ },
+ function filterTest(t){
+ var names=[];
+ dijit.registry.
+ filter(function(widget){ return widget.attr1==10; }).
+ forEach(function(widget){ names.push(widget.name); });
+ t.is(names.join(" "), "bob uncle");
+ },
+ function byId(t){
+ t.is(dijit.byId("three").name, "your");
+ },
+ function byClass(t){
+ var names=[];
+ dijit.registry.
+ byClass("bar").
+ forEach(function(widget){ names.push(widget.name); });
+ t.is(names.join(" "), "your uncle");
+ },
+ function deleteTest(t){
+ var names=[];
+ dijit.byId("two").destroy();
+ dijit.byId("four").destroy();
+ var names=[];
+ dijit.registry.forEach(function(widget){ names.push(widget.name); });
+ t.is(names.join(" "), "bob your");
+ },
+ function getEnclosingWidgetTest(t){
+ t.is(dijit.getEnclosingWidget(dojo.byId("not-a-widget")), null);
+ t.is(dijit.getEnclosingWidget(dojo.byId("three")).name, "your");
+ t.is(dijit.getEnclosingWidget(dojo.byId("three.one")).name, "your");
+ t.is(dijit.getEnclosingWidget(dojo.byId("three.one.one")).name, "your");
+ },
+ function isTabNavigable(t){
+ t.t(dijit.isTabNavigable(dojo.byId("a-with-href")));
+ t.f(dijit.isTabNavigable(dojo.byId("a-without-href")));
+ t.t(dijit.isTabNavigable(dojo.byId("area")));
+ t.t(dijit.isTabNavigable(dojo.byId("button")));
+ t.t(dijit.isTabNavigable(dojo.byId("input")));
+ t.t(dijit.isTabNavigable(dojo.byId("object")));
+ t.t(dijit.isTabNavigable(dojo.byId("select")));
+ t.t(dijit.isTabNavigable(dojo.byId("textarea")));
+ t.f(dijit.isTabNavigable(dojo.byId("empty")));
+ t.t(dijit.isTabNavigable(dojo.byId("zero-tabindex-div")));
+ },
+ function findTabNullOnEmpty(t){
+ t.is(null, dijit.getFirstInTabbingOrder("empty"));
+ t.is(null, dijit.getLastInTabbingOrder("empty"));
+ },
+ function findTabElements(t){
+ t.is(null, dijit.getFirstInTabbingOrder("div-container"));
+ t.is(null, dijit.getFirstInTabbingOrder("a-without-href-container"));
+ t.is("a-with-href", dijit.getFirstInTabbingOrder("a-with-href-container").id);
+
+ // in Safari area elements are not in the tab order
+ // and their display style property is "none";
+ // therefore it is expected that this test will fail
+ if(!dojo.isSafari){
+ t.is("area", dijit.getFirstInTabbingOrder("area-map").id);
+ }
+
+ t.is("button", dijit.getFirstInTabbingOrder("button-container").id);
+ t.is("input", dijit.getFirstInTabbingOrder("input-container").id);
+ t.is("object", dijit.getFirstInTabbingOrder("object-container").id);
+ t.is("select", dijit.getFirstInTabbingOrder("select-container").id);
+ t.is("textarea", dijit.getFirstInTabbingOrder("textarea-container").id);
+ t.is(null, dijit.getLastInTabbingOrder("div-container"));
+ t.is(null, dijit.getLastInTabbingOrder("a-without-href-container"));
+ t.is("a-with-href", dijit.getLastInTabbingOrder("a-with-href-container").id);
+
+ // in Safari area elements are not in the tab order
+ // and their display style property is "none";
+ // therefore it is expected that this test will fail
+ if(!dojo.isSafari){
+ t.is("area", dijit.getLastInTabbingOrder("area-map").id);
+ }
+
+ t.is("button", dijit.getLastInTabbingOrder("button-container").id);
+ t.is("input", dijit.getLastInTabbingOrder("input-container").id);
+ t.is("object", dijit.getLastInTabbingOrder("object-container").id);
+ t.is("select", dijit.getLastInTabbingOrder("select-container").id);
+ t.is("textarea", dijit.getLastInTabbingOrder("textarea-container").id);
+ },
+ function findTabOnElementRatherThanString(t){
+ t.is("a-with-href", dijit.getFirstInTabbingOrder(dojo.byId("a-with-href-container")).id);
+ t.is("a-with-href", dijit.getLastInTabbingOrder(dojo.byId("a-with-href-container")).id);
+ },
+ function findTabSkipDisabled(t){
+ t.is("not-disabled-input", dijit.getFirstInTabbingOrder("skip-disabled").id);
+ t.is("not-disabled-input", dijit.getLastInTabbingOrder("skip-disabled").id);
+ },
+ function findTabZeroTabindex(t){
+ t.is("zero-tabindex-div", dijit.getFirstInTabbingOrder("zero-tabindex-div-container").id);
+ t.is("zero-tabindex-input", dijit.getFirstInTabbingOrder("zero-tabindex-input-container").id);
+ t.is("zero-tabindex-div", dijit.getLastInTabbingOrder("zero-tabindex-div-container").id);
+ t.is("zero-tabindex-input", dijit.getLastInTabbingOrder("zero-tabindex-input-container").id);
+ },
+ function findTabPositiveTabindex(t){
+ t.is("positive-tabindex-input1a", dijit.getFirstInTabbingOrder("positive-tabindex-mixed-with-no-tabindex").id);
+ t.is("positive-tabindex-input3a", dijit.getFirstInTabbingOrder("positive-tabindex").id);
+ t.is("no-tabindex-input2", dijit.getLastInTabbingOrder("positive-tabindex-mixed-with-no-tabindex").id);
+ t.is("positive-tabindex-input4b", dijit.getLastInTabbingOrder("positive-tabindex").id);
+ },
+ function findTabSkipMinusOneTabindex(t){
+ t.is("not-minus-one-input", dijit.getFirstInTabbingOrder("skip-minus-one").id);
+ t.is("not-minus-one-input", dijit.getLastInTabbingOrder("skip-minus-one").id);
+ },
+ function findTabDescend(t){
+ t.is("child-input1", dijit.getFirstInTabbingOrder("descend").id);
+ t.is("child-input2", dijit.getLastInTabbingOrder("descend").id);
+ },
+ function findTabOuterInner(t){
+ t.is("outer1", dijit.getFirstInTabbingOrder("outer-inner-container").id);
+ t.is("inner2", dijit.getLastInTabbingOrder("outer-inner-container").id);
+ },
+ function skipNotShown(t){
+ t.is(null, dijit.getFirstInTabbingOrder("hidden-element-container"));
+ t.is(null, dijit.getFirstInTabbingOrder("hidden-container-tabindex-zero"));
+ t.is(null, dijit.getFirstInTabbingOrder("hidden-container-no-tabindex"));
+ t.is(null, dijit.getFirstInTabbingOrder("container-with-hidden-containers"));
+
+ t.is(null, dijit.getFirstInTabbingOrder("display-none-element-container"));
+ t.is(null, dijit.getFirstInTabbingOrder("display-none-container-tabindex-zero"));
+ t.is(null, dijit.getFirstInTabbingOrder("display-none-container-no-tabindex"));
+ t.is(null, dijit.getFirstInTabbingOrder("container-with-display-none-containers"));
+ }
+ ]
+ );
+ doh.run();
+ });
+
+ </script>
+</head>
+<body>
+ <h1>Dijit Manager Unit Test</h1>
+ <div dojoType="foo" id="one" name="bob" attr1="10" attr2="10"></div>
+ <div dojoType="foo" id="two" name="is" attr1="5" attr2="10"></div>
+ <div dojoType="bar" id="three" name="your" attr1="5" attr2="5">
+ <div id="three.one">
+ <div id="three.one.one"></div>
+ </div>
+ </div>
+ <div dojoType="bar" id="four" name="uncle" attr1="10" attr2="5"></div>
+ <div id="not-a-widget"></div>
+
+ <div id="empty"></div>
+
+ <div id="div-container">
+ <div id="div"></div>
+ </div>
+ <div id="a-without-href-container">
+ <a id="a-without-href" name="named-link-anchor"></a>
+ </div>
+ <div id="a-with-href-container">
+ <a id="a-with-href" href="#named-link-anchor"></a>
+ </div>
+
+ <div><img src="../images/flatScreen.gif" alt="picture of a flat-screen monitor" usemap="#area-map"></div>
+ <map id="area-map" name="area-map">
+ <area id="area" href="#" alt="example area" shape="rect" coords="0,0,8,8">
+ </map>
+
+ <div id="button-container">
+ <button id="button"></button>
+ </div>
+ <div id="input-container">
+ <input id="input">
+ </div>
+ <div id="object-container">
+ <object id="object"></object>
+ </div>
+ <div id="select-container">
+ <select id="select"></select>
+ </div>
+ <div id="textarea-container">
+ <textarea id="textarea"></textarea>
+ </div>
+
+ <div id="skip-disabled">
+ <input id="disabled-input1" disabled="disabled">
+ <input id="not-disabled-input">
+ <input id="disabled-input2" disabled="disabled">
+ </div>
+
+ <div id="zero-tabindex-div-container">
+ <div id="zero-tabindex-div" tabindex="0"></div>
+ </div>
+
+ <div id="zero-tabindex-input-container">
+ <input id="zero-tabindex-input" tabindex="0">
+ </div>
+
+ <div id="positive-tabindex-mixed-with-no-tabindex">
+ <input id="no-tabindex-input1">
+ <input id="no-tabindex-input2">
+ <input id="positive-tabindex-input1a" tabindex="1">
+ <input id="positive-tabindex-input1b" tabindex="1">
+ <input id="positive-tabindex-input2a" tabindex="2">
+ <input id="positive-tabindex-input2b" tabindex="2">
+ </div>
+
+ <div id="positive-tabindex">
+ <input id="positive-tabindex-input3a" tabindex="3">
+ <input id="positive-tabindex-input3b" tabindex="3">
+ <input id="positive-tabindex-input4a" tabindex="4">
+ <input id="positive-tabindex-input4b" tabindex="4">
+ </div>
+
+ <div id="skip-minus-one">
+ <input id="minus-one-input1" tabindex="-1">
+ <input id="not-minus-one-input">
+ <input id="minus-one-input2" tabindex="-1">
+ </div>
+
+ <div id="descend">
+ <input disabled="disabled">
+ <div>
+ <input disabled="disabled">
+ <div>
+ <input disabled="disabled">
+ </div>
+ </div>
+ <div>
+ <input disabled="disabled">
+ <div>
+ <input disabled="disabled">
+ </div>
+ <div>
+ <input id="child-input1">
+ </div>
+ <div>
+ <input id="child-input2">
+ </div>
+ </div>
+ <div>
+ <div>
+ <input disabled="disabled">
+ </div>
+ <input disabled="disabled">
+ </div>
+ <input disabled="disabled">
+ </div>
+
+ <div id="outer-inner-container">
+ <div id="outer1" tabindex="0">
+ <div id="inner1" tabindex="0"></div>
+ </div>
+ <div id="outer2" tabindex="0">
+ <div id="inner2" tabindex="0"></div>
+ </div>
+ </div>
+
+ <div id="hidden-element-container">
+ <div id="hidden-element" tabindex="0" style="visibility: hidden;">
+ </div>
+ </div>
+
+ <div id="container-with-hidden-containers">
+ <div id="hidden-container-tabindex-zero" tabindex="0" style="visibility: hidden;">
+ <div id="inside-hidden-container-tabindex-zero" tabindex="0">
+ </div>
+ </div>
+
+ <div id="hidden-container-no-tabindex" style="visibility: hidden;">
+ <div id="inside-hidden-container-no-tabindex" tabindex="0">
+ </div>
+ </div>
+ </div>
+
+ <div id="display-none-element-container">
+ <div id="display-none-element" tabindex="0" style="display: none;">
+ </div>
+ </div>
+
+ <div id="container-with-display-none-containers">
+ <div id="display-none-container-tabindex-zero" tabindex="0" style="display: none;">
+ <div id="inside-display-none-container-tabindex-zero" tabindex="0">
+ </div>
+ </div>
+
+ <div id="display-none-container-no-tabindex" style="display: none;">
+ <div id="inside-display-none-container-no-tabindex" tabindex="0">
+ </div>
+ </div>
+ </div>
+</body>
+</html>
diff --git a/includes/js/dijit/tests/_base/manager.js b/includes/js/dijit/tests/_base/manager.js
new file mode 100644
index 0000000..667a763
--- /dev/null
+++ b/includes/js/dijit/tests/_base/manager.js
@@ -0,0 +1,9 @@
+if(!dojo._hasResource["dijit.tests._base.manager"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
+dojo._hasResource["dijit.tests._base.manager"] = true;
+dojo.provide("dijit.tests._base.manager");
+
+if(dojo.isBrowser){
+ doh.registerUrl("dijit.tests._base.manager", dojo.moduleUrl("dijit", "tests/_base/manager.html"));
+}
+
+}
diff --git a/includes/js/dijit/tests/_base/test_FocusManager.html b/includes/js/dijit/tests/_base/test_FocusManager.html
new file mode 100644
index 0000000..1d6a707
--- /dev/null
+++ b/includes/js/dijit/tests/_base/test_FocusManager.html
@@ -0,0 +1,46 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
+ "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+ <title>dijit.focus Test</title>
+ <style type="text/css">
+ @import "../../../dojo/resources/dojo.css";
+ @import "../../themes/tundra/tundra.css";
+ @import "../css/dijitTests.css";
+ </style>
+
+ <script type="text/javascript" src="../../../dojo/dojo.js"
+ djConfig="isDebug: true"></script>
+ <script type="text/javascript">
+ dojo.require("dijit._base.focus");
+ var savedFocus;
+ dojo.addOnLoad(function(){
+ fakeWidget = { domNode: dojo.byId("save") };
+ dojo.subscribe("focusNode", function(node){ console.log("focused on " + (node?(node.id||node.tagName):"nothing"));});
+ });
+ function save(){
+ savedFocus = dijit.getFocus(fakeWidget);
+ console.debug("saved focus: ", savedFocus);
+
+ }
+ function restore(){
+ dijit.focus(savedFocus);
+ }
+ </script>
+</head>
+<body style="background-color: #fff; color: black; padding: 0; margin: 0" class="tundra">
+
+ <h3>Focus/Selection Save/Restore Test</h3>
+ <p>This is for testing whether focus and selection are restored by the focus manager</p>
+ <form style="border: 2px solid blue;">
+ <input id=input1 value=tom><br>
+ <input id=input2 value=jones><br>
+ <textarea id=textarea>hello there!</textarea><br>
+ <button id=button>push me</button>
+ </form>
+
+ <button id="save" onclick="save();" tabIndex="1">Save focus/selection state</button>
+ <button onclick="restore();">Restore focus/selection state</button>
+
+</body>
+</html>
diff --git a/includes/js/dijit/tests/_base/test_focusWidget.html b/includes/js/dijit/tests/_base/test_focusWidget.html
new file mode 100644
index 0000000..edc01c1
--- /dev/null
+++ b/includes/js/dijit/tests/_base/test_focusWidget.html
@@ -0,0 +1,130 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
+ "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+ <title>dijit.focus Test</title>
+ <style type="text/css">
+ @import "../../../dojo/resources/dojo.css";
+ @import "../../themes/tundra/tundra.css";
+ @import "../css/dijitTests.css";
+ </style>
+
+ <script type="text/javascript" src="../../../dojo/dojo.js"
+ djConfig="isDebug: true, parseOnLoad: true"></script>
+ <script type="text/javascript">
+ dojo.require("dijit.form.DateTextBox");
+ dojo.require("dijit.form.ComboBox");
+ dojo.require("dijit.form.NumberSpinner");
+ dojo.require("dijit.form.Button");
+ dojo.require("dijit.Menu");
+ dojo.require("dijit.layout.ContentPane");
+
+ var queue=[];
+ var animation;
+ function animateBorderColor(widget, color, startWidth, endWidth){
+ if(animation){
+ queue.push(arguments);
+ return;
+ }
+ with(widget.domNode.style){
+ borderStyle="solid";
+ outlineStyle="solid";
+
+ }
+ animation = dojo.animateProperty({
+ node: widget.domNode,
+ duration: 400,
+ properties: {
+ // depending on browser and node type, sometimes border or outline is ineffective.
+ // doing both seems to work in all cases though (for at least one of them)
+ borderColor: { end: color },
+ borderWidth: { start: startWidth, end: endWidth },
+ outlineColor: { end: color },
+ outlineWidth: { start: startWidth, end: endWidth }
+ },
+ onEnd: function(){
+ animation=null;
+ if(queue.length){
+ animateBorderColor.apply(null, queue.shift());
+ }
+ }
+ });
+ animation.play();
+ }
+
+ dojo.addOnLoad(function(){
+ dojo.subscribe("widgetFocus", function(widget){
+ console.log("focused on widget " + (widget?widget:"nothing"));
+ animateBorderColor(widget, "#ff0000", 2, 5);
+ });
+ dojo.subscribe("widgetBlur", function(widget){
+ console.log("blurred widget " + (widget?widget:"nothing"));
+ animateBorderColor(widget, "#0000ff", 5, 2);
+ });
+ dojo.subscribe("focusNode", function(node){ console.log("focused on node " + (node?(node.id||node.tagName):"nothing"));});
+ });
+ </script>
+ <style>
+ div, fieldset, form, input {
+ padding: 10px;
+ margin: 10px;
+ border: 2px solid blue;
+ }
+ </style>
+</head>
+<body style="background-color: #fff; color: black; padding: 0; margin: 0" class="tundra">
+
+ <h3>Widget Focus Test</h3>
+ <p>
+ This is for testing code to detect onBlur and onFocus on a widget level.<br>
+ Focused widgets' borders will turn red.<br>
+ Also, heck the console log for focus and blur events on widgets.
+ </p>
+
+ <label for="fieldset1">a form ContentPane widget:</label><br>
+ <form dojoType="dijit.layout.ContentPane">
+ <label for="first">simple input: </label><input id=first><br>
+
+ <label for="fieldset1">a fieldset ContentPane widget:</label><br>
+ <fieldset id=fieldset1 dojoType="dijit.layout.ContentPane">
+ <label for="select">a ComboBox widget:</label>
+ <select id=select dojoType="dijit.form.ComboBox">
+ <option>this</option>
+ <option>is</option>
+ <option>a</option>
+ <option>list</option>
+ </select>
+ <label for="plain">a plain input:</label>
+ <input id=plain value=plain>
+ </fieldset>
+ <br>
+ <label for="fieldset1">another fieldset ContentPane:</label><br>
+ <fieldset id=fieldset2 dojoType="dijit.layout.ContentPane">
+ <label for="date">a DateTextBox widget:</label>
+ <input id=date dojoType="dijit.form.DateTextBox"><br>
+
+ <label for="textarea">a plain textarea:</label><br>
+ <textarea id=textarea>hello there!</textarea><br>
+
+ <label for="spinner">a Spinner widget:</label>
+ <input id=spinner dojoType="dijit.form.NumberSpinner" value=100><br>
+
+ <label for="button">a Combobutton widget:</label>
+ <div id=button dojoType="dijit.form.ComboButton" tabIndex=0>
+ <span>push me</span>
+ <div id=menu dojoType="dijit.Menu">
+ <div id=mi1 dojoType="dijit.MenuItem">menu item 1</div>
+ <div id=mi2 dojoType="dijit.MenuItem">menu item 2</div>
+ <div id=popupMenuItem dojoType="dijit.PopupMenuItem">
+ <span>submenu</span>
+ <div id=submenu dojoType="dijit.Menu">
+ <div id=smi1 dojoType="dijit.MenuItem">submenu item 1</div>
+ <div id=smi2 dojoType="dijit.MenuItem">submenu item 2</div>
+ </div>
+ </div>
+ </div>
+ </div>
+ </fieldset>
+ </form>
+</body>
+</html>
diff --git a/includes/js/dijit/tests/_base/test_placeStrict.html b/includes/js/dijit/tests/_base/test_placeStrict.html
new file mode 100644
index 0000000..c40325c
--- /dev/null
+++ b/includes/js/dijit/tests/_base/test_placeStrict.html
@@ -0,0 +1,400 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+ <head>
+ <title>dijit.place tests</title>
+ <script type="text/javascript" src="../../../dojo/dojo.js"
+ djConfig="isDebug: true, extraLocale: ['de-de', 'en-us']"></script>
+ <script type="text/javascript">
+ dojo.require("dijit.dijit");
+ </script>
+ <script>
+ dojo.addOnLoad(function(){
+ var vp = dijit.getViewport();
+ alert("viewport w="+vp.w + ", h=" + vp.h);
+ });
+ </script>
+ <style type="text/css">
+ @import "../../../dojo/resources/dojo.css";
+ @import "../../themes/tundra/tundra.css";
+ @import "../css/dijitTests.css";
+
+ body {
+ padding: 1em;
+ }
+ .formQuestion {
+ background-color:#d0e3f5;
+ padding:0.3em;
+ font-weight:900;
+ font-family:Verdana, Arial, sans-serif;
+ font-size:0.8em;
+ color:#5a5a5a;
+ }
+ .formAnswer {
+ background-color:#f5eede;
+ padding:0.3em;
+ margin-bottom:1em;
+ }
+ .pageSubContentTitle {
+ color:#8e8e8e;
+ font-size:1em;
+ font-family:Verdana, Arial, sans-serif;
+ margin-bottom:0.75em;
+ }
+ .small {
+ width: 2.5em;
+ }
+ .medium {
+ width: 10em;
+ }
+ .long {
+ width: 20em;
+ }
+
+ .dojoValidationTextBoxMessage {
+ display: inline;
+ margin-left: 1em;
+ font-weight: bold;
+ font-style: italic;
+ font-family: Arial, Verdana, sans-serif;
+ color: #f66;
+ font-size: 0.9em;
+ }
+
+ .noticeMessage {
+ font-weight: normal;
+ font-family:Arial, Verdana, sans-serif;
+ color:#663;
+ font-size:0.9em;
+ }
+ </style>
+ </head>
+
+ <body class=tundra>
+ <h2 class="pageSubContentTitle">Test dijit.place</h2>
+ <p>Currently this just tests getViewport(). Change the size of your browser window and then reload,
+ and see if it reports the browser window size correctly.<br>
+ <p>All the text below is just filler text...<br>
+ <!-- to test form submission, you'll need to create an action handler similar to
+ http://www.utexas.edu/teamweb/cgi-bin/generic.cgi -->
+ <form id="form1" action="" name="example" method="post">
+
+ <div class="formQuestion">
+ <span class="emphasize"><label for="q01">First Name: </label></span>
+ <span class="noticeMessage"> TextBox class, <b>tabIndex=2</b>, Attributes: {trim: true, ucFirst: true, class: 'medium'}, First letter of each word is upper case.</span>
+ </div>
+ <div class="formAnswer">
+ <input id="q01" type="text" name="firstname" value="testing testing" class="medium" tabIndex=2
+ dojoType="dijit.form.TextBox"
+ trim="true"
+ ucfirst="true" />
+ </div>
+
+ <div class="formQuestion">
+ <span class="emphasize"><label for="q02">Last Name: </label></span>
+ <span class="noticeMessage"> TextBox class, Attributes: {trim: true, uppercase: true, class: 'medium'}, all letters converted to upper case. </span>
+ </div>
+ <div class="formAnswer">
+ <input id="q02" type="text" name="lastname" value="testing testing" class="medium"
+ dojoType="dijit.form.TextBox"
+ trim="true"
+ uppercase="true" />
+ </div>
+
+ <div class="formQuestion">
+ <span class="emphasize"><label for="q03">Age: </label></span>
+ <span class="noticeMessage"> TextBox class, <b>tabIndex=1</b>, Attributes: {trim: true, digit: true, class: 'small'}, all but digits extracted.</span>
+ </div>
+ <div class="formAnswer">
+ <input id="q03" type="text" name="age" value="38" class="small" tabIndex=1
+ dojoType="dijit.form.NumberTextBox"
+ promptMessage="(optional) Enter an age between 0 and 120"
+ constraints={places:0,min:0,max:120}
+ onChange="console.debug('onChange fired for widget id = ' + this.id + ' with value = ' + arguments[0]);"
+ digit="true"
+ trim="true"
+ />
+ </div>
+
+ <div class="formQuestion">
+ <span class="emphasize"><label for="q04">Occupation: </label></span>
+ <span class="noticeMessage">ValidationTextBox class,
+ Attributes: {lowercase: true, required: true}. Displays a prompt message if field is missing. </span>
+ </div>
+ <div class="formAnswer">
+ <input id="q04" type="text" name="occupation" class="medium"
+ dojoType="dijit.form.ValidationTextBox"
+ lowercase="true"
+ required="true"
+ promptMessage="Enter an occupation" />
+ </div>
+
+ <div class="formQuestion">
+ <span class="emphasize"><label for="q05">Elevation: </label></span>
+ <span class="noticeMessage">IntegerTextBox class,
+ Attributes: {required: true, min:-20000, max:+20000 }, Enter feet above sea level with a sign.</span>
+ </div>
+ <div class="formAnswer">
+ <input id="q05" class="medium"/>
+ </div>
+
+ <div class="formQuestion">
+ <span class="emphasize"><label for="q08">Annual Income: </label></span>
+ <span class="noticeMessage">CurrencyTextBox class,
+ Attributes: {fractional: true}. Enter whole and cents. Currency symbol is optional.</span>
+ </div>
+ <div class="formAnswer">
+ <input id="q08" type="text" name="income1" class="medium" value="54775.53"
+ dojoType="dijit.form.CurrencyTextBox"
+ required="true"
+ currency="USD"
+ invalidMessage="Invalid amount. Include dollar sign, commas, and cents. Example: $12,000.00" />USD
+ </div>
+
+ <div class="formAnswer">
+ <input id="q08eur" type="text" name="income2" class="medium" value="54775.53"
+ dojoType="dijit.form.CurrencyTextBox"
+ required="true"
+ currency="EUR"
+ invalidMessage="Invalid amount. Include euro sign, commas, and cents. Example: &#x20ac;12,000.00" />EUR
+ </div>
+<!--
+ <div class="formQuestion">
+ <span class="emphasize"><label for="q08a">Annual Income: </label></span>
+ <span class="noticeMessage">Old regexp currency textbox,
+ Attributes: {fractional: true}. Enter dollars and cents.</span>
+ </div>
+ <div class="formAnswer">
+ <input id="q08a" type="text" name="income3" class="medium" value="$54,775.53"
+ dojoType="dijit.form.ValidationTextBox"
+ regExpGen="dojo.regexp.currency"
+ trim="true"
+ required="true"
+ constraints={fractional:true}
+ invalidMessage="Invalid amount. Include dollar sign, commas, and cents. Example: $12,000.00" />
+ </div>
+
+ <div class="formQuestion">
+ <span class="emphasize"><label for="q09">IPv4 Address: </label></span>
+ <span class="noticeMessage">IpAddressTextBox class,
+ Attributes: {allowIPv6: false, allowHybrid: false}. Also Dotted Hex works, 0x18.0x11.0x9b.0x28</span>
+ </div>
+ <div class="formAnswer">
+ <input id="q09" type="text" name="ipv4" class="medium" value="24.17.155.40"
+ dojoType="dijit.form.ValidationTextBox"
+ regExpGen="dojo.regexp.ipAddress"
+ trim="true"
+ required="true"
+ constraints={allowIPv6:false,allowHybrid:false}
+ invalidMessage="Invalid IPv4 address." />
+ </div>
+
+ <div class="formQuestion">
+ <span class="emphasize"><label for="q10"> IPv6 Address: </label></span>
+ <span class="noticeMessage">IpAddressTextBox class,
+ Attributes: {allowDottedDecimal: false, allowDottedHex: false}.
+ Also hybrid works, x:x:x:x:x:x:d.d.d.d</span>
+ </div>
+ <div class="formAnswer">
+ <input id="q10" type="text" name="ipv6" class="long" value="0000:0000:0000:0000:0000:0000:0000:0000"
+ dojoType="dijit.form.ValidationTextBox"
+ regExpGen="dojo.regexp.ipAddress"
+ trim="true"
+ uppercase = "true"
+ required="true"
+ constraints={allowDottedDecimal:false, allowDottedHex:false, allowDottedOctal:false}
+ invalidMessage="Invalid IPv6 address, please enter eight groups of four hexadecimal digits. x:x:x:x:x:x:x:x" />
+ </div>
+
+ <div class="formQuestion">
+ <span class="emphasize"><label for="q11"> URL: </label></span>
+ <span class="noticeMessage">UrlTextBox class,
+ Attributes: {required: true, trim: true, scheme: true}. </span>
+ </div>
+ <div class="formAnswer">
+ <input id="q11" type="text" name="url" class="long" value="http://www.xyz.com/a/b/c?x=2#p3"
+ dojoType="dijit.form.ValidationTextBox"
+ regExpGen="dojo.regexp.url"
+ trim="true"
+ required="true"
+ constraints={scheme:true}
+ invalidMessage="Invalid URL. Be sure to include the scheme, http://..." />
+ </div>
+
+ <div class="formQuestion">
+ <span class="emphasize"><label for="q12"> Email Address </label></span>
+ <span class="noticeMessage">EmailTextBox class,
+ Attributes: {required: true, trim: true}. </span>
+ </div>
+ <div class="formAnswer">
+ <input id="q12" type="text" name="email" class="long" value="fred&barney@stonehenge.com"
+ dojoType="dijit.form.ValidationTextBox"
+ regExpGen="dojo.regexp.emailAddress"
+ trim="true"
+ required="true"
+ invalidMessage="Invalid Email Address." />
+ </div>
+
+ <div class="formQuestion">
+ <span class="emphasize"><label for="q13"> Email Address List </label></span>
+ <span class="noticeMessage">EmailListTextBox class,
+ Attributes: {required: true, trim: true}. </span>
+ </div>
+ <div class="formAnswer">
+ <input id="q13" type="text" name="email" class="long" value="a@xyz.com; b@xyz.com; c@xyz.com; "
+ dojoType="dijit.form.ValidationTextBox"
+ regExpGen="dojo.regexp.emailAddressList"
+ trim="true"
+ required="true"
+ invalidMessage="Invalid Email Address List." />
+ </div>
+-->
+
+ <div class="formQuestion">
+ <span class="emphasize"><label for="q14"> Date (American format) </label></span>
+ <span class="noticeMessage">DateTextBox class,
+ Attributes: {locale: "en-us", required: true}. Works for leap years</span>
+ </div>
+ <div class="formAnswer">
+ <input id="q14" type="text" name="date1" class="medium" value="2005-12-30"
+ dojoType="dijit.form.DateTextBox"
+ constraints={locale:'en-us'}
+ required="true"
+ promptMessage="mm/dd/yyyy"
+ invalidMessage="Invalid date. Use mm/dd/yyyy format." />
+ </div>
+
+ <div class="formQuestion">
+ <span class="emphasize"><label for="q15"> Date (German format) </label></span>
+ <span class="noticeMessage">DateTextBox class,
+ Attributes: {locale: "de-de", min:2006-01-01, max:2006-12-31}. Works for leap years</span>
+ </div>
+ <div class="formAnswer">
+ <input id="q15" class="medium"/>
+ </div>
+
+ <div class="formQuestion">
+ <span class="emphasize"><label for="q16"> 12 Hour Time </label></span>
+ <span class="noticeMessage">TimeTextBox class,
+ Attributes: {formatLength: "medium", required: true, trim: true}</span>
+ </div>
+ <div class="formAnswer">
+ <input id="q16" type="text" name="time1" class="medium" value="5:45:00 pm"
+ dojoType="dijit.form.ValidationTextBox"
+ validator="dojo.date.local.parse"
+ constraints={formatLength:'medium',selector:'time'}
+ trim="true"
+ required="true"
+ invalidMessage="Invalid time." />
+ </div>
+
+ <div class="formQuestion">
+ <span class="emphasize"><label for="q17"> 24 Hour Time</label></span>
+ <span class="noticeMessage">TimeTextBox class,
+ Attributes: {displayFormat:"HH:mm:ss", required: true, trim: true}</span>
+ </div>
+ <div class="formAnswer">
+ <input id="q17" type="text" name="time2" class="medium" value="17:45:00"
+ dojoType="dijit.form.ValidationTextBox"
+ validator="dojo.date.local.parse"
+ constraints={formatLength:'short',selector:'time',timePattern:'HH:mm:ss'}
+ trim="true"
+ required="true"
+ invalidMessage="Invalid time. Use HH:mm:ss where HH is 00 - 23 hours." />
+ </div>
+
+<!--
+ <div class="formQuestion">
+ <span class="emphasize"><label for="q18"> US State 2 letter abbr. </label></span>
+ <span class="noticeMessage">UsStateTextBox class,
+ Attributes: {required: true, trim: true, uppercase: true}</span>
+ </div>
+ <div class="formAnswer">
+ <input id="q18" type="text" name="state" class="small" value="CA"
+ dojoType="dijit.form.ValidationTextBox"
+ regExpGen="dojo.regexp.us.state"
+ constraints={allowTerritories:false}
+ trim="true"
+ uppercase="true"
+ required="true"
+ invalidMessage="Invalid US state abbr." />
+ </div>
+
+ <div class="formQuestion">
+ <span class="emphasize"><label for="q19"> US Zip Code </label></span>
+ <span class="noticeMessage">UsZipTextBox class,
+ Attributes: {required: true, trim: true} Five digit Zip code or 5 + 4.</span>
+ </div>
+ <div class="formAnswer">
+ <input id="q19" type="text" name="zip" class="medium" value="98225-1649"
+ dojoType="dijit.form.ValidationTextBox"
+ validator="dojo.validate.us.isZipCode"
+ trim="true"
+ required="true"
+ invalidMessage="Invalid US Zip Code." />
+ </div>
+
+ <div class="formQuestion">
+ <span class="emphasize"><label for="q20"> US Social Security Number </label></span>
+ <span class="noticeMessage">UsSocialSecurityNumberTextBox class,
+ Attributes: {required: true, trim: true} </span>
+ </div>
+ <div class="formAnswer">
+ <input id="q20" type="text" name="ssn" class="medium" value="123-45-6789"
+ dojoType="dijit.form.ValidationTextBox"
+ validator="dojo.validate.us.isSocialSecurityNumber"
+ trim="true"
+ required="true"
+ invalidMessage="Invalid US Social Security Number." />
+ </div>
+
+ <div class="formQuestion">
+ <span class="emphasize"><label for="q21"> 10-digit US Phone Number </label></span>
+ <span class="noticeMessage">UsPhoneNumberTextBox class,
+ Attributes: {required: true, trim: true} </span>
+ </div>
+ <div class="formAnswer">
+ <input id="q21" type="text" name="phone" class="medium" value="(123) 456-7890"
+ dojoType="dijit.form.ValidationTextBox"
+ validator="dojo.validate.us.isPhoneNumber"
+ trim="true"
+ required="true"
+ invalidMessage="Invalid US Phone Number." />
+ </div>
+ -->
+ <div class="formQuestion">
+ <span class="emphasize"><label for="q22"> Regular Expression </label></span>
+ <span class="noticeMessage">RegexpTextBox class,
+ Attributes: {required: true} </span>
+ </div>
+ <div class="formAnswer">
+ <input id="q22" type="text" name="phone" class="medium" value="someTestString"
+ dojoType="dijit.form.ValidationTextBox"
+ regExp="[\w]+"
+ required="true"
+ invalidMessage="Invalid Non-Space Text." />
+ </div>
+
+ <div class="formQuestion">
+ <span class="emphasize"><label for="q23"> Password </label></span>
+ <span class="noticeMessage">(just a test that type attribute is obeyed) </span>
+ </div>
+ <div class="formAnswer">
+ <input id="q23" type="password" name="password" class="medium"
+ dojoType="dijit.form.TextBox" />
+ </div>
+
+ <div class="formQuestion">
+ <span class="emphasize"><label for="ticket1651">Trac ticket 1651: </label></span>
+ <span class="noticeMessage">value: null should show up as empty</span>
+ </div>
+ <div class="formAnswer">
+ <input id="ticket1651" class="medium" value="not null"/>
+ </div>
+
+ <button name="button" onclick="displayData(); return false;">view data</button>
+ <input type="submit" name="submit" />
+ </form>
+ </body>
+</html>
diff --git a/includes/js/dijit/tests/_base/test_typematic.html b/includes/js/dijit/tests/_base/test_typematic.html
new file mode 100644
index 0000000..4a85027
--- /dev/null
+++ b/includes/js/dijit/tests/_base/test_typematic.html
@@ -0,0 +1,56 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
+ "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+ <title>Typematic Test</title>
+ <style type="text/css">
+ @import "../../../dojo/resources/dojo.css";
+ @import "../../themes/tundra/tundra.css";
+ @import "../css/dijitTests.css";
+ </style>
+
+ <script type="text/javascript" src="../../../dojo/dojo.js"
+ djConfig="isDebug: true, debugAtAllCosts: true"></script>
+ <script type="text/javascript">
+ dojo.require("dijit._base.typematic");
+
+ var lastCount = 0;
+ function typematicCallBack(count, node, evt){
+ var inputNode = dojo.byId('typematicInput');
+ if (node == inputNode){
+ key = "a";
+ }else{
+ key = "b";
+ }
+ if(-1 == count){
+ console.debug((lastCount+1) + ' ' + key + ' events');
+ }else{
+ lastCount = count;
+ inputNode.value += key;
+ }
+ inputNode.focus();
+ }
+ dojo.addOnLoad(function(){
+ var keyNode = dojo.byId('typematicInput');
+ var mouseNode = dojo.byId('typematicButton');
+ dijit.typematic.addKeyListener(keyNode,
+ {
+ keyCode:dojo.keys.F10,
+ ctrlKey:true
+ },
+ this, typematicCallBack, 200, 200);
+ dijit.typematic.addMouseListener(mouseNode,
+ this, typematicCallBack, 0.9, 200);
+ keyNode.focus(); // make it easier to type
+ });
+ </script>
+</head>
+<body class="tundra">
+
+ <h2>Dijit typematic tests</h2>
+ Press and hold the <b>ctrl+F10</b> keys to see a's typed (constant rate) in the input field,<br>
+ or left-mouse click the button and hold down to see b's typed (increasing rate) in the input field.<br>
+ <input id="typematicInput" size="500"><button id="typematicButton">to B or not to B</button>
+
+</body>
+</html>
diff --git a/includes/js/dijit/tests/_base/viewport.html b/includes/js/dijit/tests/_base/viewport.html
new file mode 100644
index 0000000..2b8454a
--- /dev/null
+++ b/includes/js/dijit/tests/_base/viewport.html
@@ -0,0 +1,79 @@
+<html>
+<head>
+ <title>dijit.getViewport() test</title>
+ <style type="text/css">
+ @import "../../../dojo/resources/dojo.css";
+ @import "../css/dijitTests.css";
+ html, body { margin: 0px; padding: 0px; }
+ </style>
+ <script type="text/javascript" src="../../../dojo/dojo.js"
+ djConfig="isDebug: false, parseOnLoad: false"></script>
+ <script type="text/javascript" src="../_testCommon.js"></script>
+
+ <script type="text/javascript">
+ dojo.require("doh.runner");
+ dojo.require("dijit.dijit");
+
+ function compute(){
+ var d = dojo.marginBox(dojo.byId("documentBorder")),
+ v = dijit.getViewport();
+ dojo.byId("results").innerHTML +=
+ "Document is " + d.w + "px x " + d.h + "px" +
+ ", viewport is " + v.w + "px x " + v.h + "px" +
+ ", with scroll offset of (" + v.l + ", " + v.t + ")<br>";
+ }
+
+ function addText(){
+ dojo.byId("results").innerHTML += "Adding text...<br><br>";
+ var text="";
+ for(var i=0;i<100;i++){
+ text += "<span style='white-space: nowrap'>";
+ for(var j=0;j<3;j++){ text += "Now is the time for all good men to come to the aid of their country."; }
+ text += "</span><br>";
+ }
+ dojo.byId("documentBorder").innerHTML += text;
+ }
+
+ dojo.addOnLoad(function(){
+ doh.register("dijit._base.manager",
+ [
+ function initial(t){
+ console.log("calling compute");
+ compute();
+ console.log("called compute");
+ var d = dojo.marginBox(dojo.byId("documentBorder")),
+ v = dijit.getViewport();
+ doh.t(v.h > d.h);
+ },
+ function expand(t){
+ var v = dijit.getViewport();
+ addText();
+ compute();
+ var v2 = dijit.getViewport();
+ doh.t(v2.h <= v.h);
+ doh.t(v2.h+20 >= v.h);
+ }
+ ]
+ );
+ doh.run();
+ });
+
+ </script>
+</head>
+<body>
+ <div id="documentBorder" style="border: solid red 2px;">
+ <h1>dijit.getViewport() test</h1>
+ <div style="padding: 10px; border: solid blue 1px;">padding div</div>
+ <button onclick="addText(); compute();">add text and compute size</button>
+ <button onclick="compute();">recompute size</button>
+ <ol>
+ <li>check results div below to see that before adding text, document is smaller than viewport
+ <li>after adding text, document should be bigger than viewport,and check that viewport size hasn't changed,
+ except maybe being a little bit smaller (about 15px) because of the size of the scrollbars
+ <li>resize browser window and click the "recompute size" button; reported viewport size should change
+ <li>scroll the window and click "recompute size" to see that the scroll position is taken into effect
+ </ol>
+ <div id=results style="border: 5px solid blue;">
+ </div>
+</body>
+</html>
diff --git a/includes/js/dijit/tests/_base/viewport.js b/includes/js/dijit/tests/_base/viewport.js
new file mode 100644
index 0000000..8cee9c4
--- /dev/null
+++ b/includes/js/dijit/tests/_base/viewport.js
@@ -0,0 +1,10 @@
+if(!dojo._hasResource["dijit.tests._base.viewport"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
+dojo._hasResource["dijit.tests._base.viewport"] = true;
+dojo.provide("dijit.tests._base.viewport");
+
+if(dojo.isBrowser){
+ doh.registerUrl("dijit.tests._base.viewport", dojo.moduleUrl("dijit", "tests/_base/viewport.html"));
+ doh.registerUrl("dijit.tests._base.viewportStrict", dojo.moduleUrl("dijit", "tests/_base/viewportStrict.html"));
+}
+
+}
diff --git a/includes/js/dijit/tests/_base/viewportStrict.html b/includes/js/dijit/tests/_base/viewportStrict.html
new file mode 100644
index 0000000..812c796
--- /dev/null
+++ b/includes/js/dijit/tests/_base/viewportStrict.html
@@ -0,0 +1,81 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
+ "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+ <title>dijit.getViewport() test</title>
+ <style type="text/css">
+ @import "../../../dojo/resources/dojo.css";
+ @import "../css/dijitTests.css";
+ html, body { margin: 0px; padding: 0px; }
+ </style>
+ <script type="text/javascript" src="../../../dojo/dojo.js"
+ djConfig="isDebug: false, parseOnLoad: false"></script>
+ <script type="text/javascript" src="../_testCommon.js"></script>
+
+ <script type="text/javascript">
+ dojo.require("doh.runner");
+ dojo.require("dijit.dijit");
+
+ function compute(){
+ var d = dojo.marginBox(dojo.byId("documentBorder")),
+ v = dijit.getViewport();
+ dojo.byId("results").innerHTML +=
+ "Document is " + d.w + "px x " + d.h + "px" +
+ ", viewport is " + v.w + "px x " + v.h + "px" +
+ ", with scroll offset of (" + v.l + ", " + v.t + ")<br>";
+ }
+
+ function addText(){
+ dojo.byId("results").innerHTML += "Adding text...<br><br>";
+ var text="";
+ for(var i=0;i<100;i++){
+ text += "<span style='white-space: nowrap'>";
+ for(var j=0;j<3;j++){ text += "Now is the time for all good men to come to the aid of their country."; }
+ text += "</span><br>";
+ }
+ dojo.byId("documentBorder").innerHTML += text;
+ }
+
+ dojo.addOnLoad(function(){
+ doh.register("dijit._base.manager",
+ [
+ function initial(t){
+ console.log("calling compute");
+ compute();
+ console.log("called compute");
+ var d = dojo.marginBox(dojo.byId("documentBorder")),
+ v = dijit.getViewport();
+ doh.t(v.h > d.h);
+ },
+ function expand(t){
+ var v = dijit.getViewport();
+ addText();
+ compute();
+ var v2 = dijit.getViewport();
+ doh.t(v2.h <= v.h);
+ doh.t(v2.h+20 >= v.h);
+ }
+ ]
+ );
+ doh.run();
+ });
+
+ </script>
+</head>
+<body>
+ <div id="documentBorder" style="border: solid red 2px;">
+ <h1>dijit.getViewport() test</h1>
+ <div style="padding: 10px; border: solid blue 1px;">padding div</div>
+ <button onclick="addText(); compute();">add text and compute size</button>
+ <button onclick="compute();">recompute size</button>
+ <ol>
+ <li>check results div below to see that before adding text, document is smaller than viewport
+ <li>after adding text, document should be bigger than viewport,and check that viewport size hasn't changed,
+ except maybe being a little bit smaller (about 15px) because of the size of the scrollbars
+ <li>resize browser window and click the "recompute size" button; reported viewport size should change
+ <li>scroll the window and click "recompute size" to see that the scroll position is taken into effect
+ </ol>
+ <div id=results style="border: 5px solid blue;">
+ </div>
+</body>
+</html>
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>
diff --git a/includes/js/dijit/tests/_base/wai.js b/includes/js/dijit/tests/_base/wai.js
new file mode 100644
index 0000000..3bd299a
--- /dev/null
+++ b/includes/js/dijit/tests/_base/wai.js
@@ -0,0 +1,9 @@
+if(!dojo._hasResource["dijit.tests._base.wai"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
+dojo._hasResource["dijit.tests._base.wai"] = true;
+dojo.provide("dijit.tests._base.wai");
+
+if(dojo.isBrowser){
+ doh.registerUrl("dijit.tests._base.wai", dojo.moduleUrl("dijit", "tests/_base/wai.html"));
+}
+
+}