This commit is contained in:
Éric Lemoine
2013-02-20 10:38:25 +01:00
parent 17c3936ab6
commit 5d14b9e2d4
1919 changed files with 559755 additions and 2588 deletions

57
master/examples/7815.html Normal file
View File

@@ -0,0 +1,57 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>doh.robot #7815 regression test</title>
<style>
@import "../../../../util/doh/robot/robot.css";
</style>
<!-- required: dojo.js -->
<script type="text/javascript" src="../../../../dojo/dojo.js"
djConfig="isDebug: true"></script>
<script type="text/javascript">
dojo.require("dijit.robotx");
dojo.addOnLoad(function(){
doh.robot.initRobot('_DataGrid.html');
doh.register("#7815",[
{
name: "editor toolbar displays",
timeout:60000,
runTest: function(){
// see also "edit reordered columns" test below
var d = new doh.Deferred();
var grid=dijit.byId('markup_grid_1');
doh.robot.sequence(function(){
var initialFocus = dojo.byId('initialfocus');
initialFocus.focus();
});
// now move focus to first ID cell of markup grid
var tabCount = dojo.isIE? 3:(dojo.isFF?4:6);
for(var i=0; i<tabCount; i++){
doh.robot.keyPress(dojo.keys.TAB,500);
}
// precondition: cells still arranged to id date priority mark status message amount amount
for(var i=0; i<5; i++){
doh.robot.keyPress(dojo.keys.RIGHT_ARROW,500);
}
doh.robot.keyPress(dojo.keys.ENTER,500);
doh.robot.sequence(d.getTestCallback(function(){
doh.isNot(undefined,dijit.byId('dijit_Editor_0'),"Editing the 6th field of the 1st row did not open the expected dijit.Editor.");
doh.t(dijit.byId('dijit_Editor_0').focused);
doh.isNot(undefined,dijit.byId('dijit_Toolbar_0'),"Editor toolbar should have been created.");
doh.isNot(undefined,dijit.byId('dijit_Toolbar_0').domNode.parentNode,"Editor toolbar should have been attached to the DOM");
}),500);
return d;
}
}
]);
doh.run();
});
</script>
</head>
</html>

35
master/examples/8976.html Normal file
View File

@@ -0,0 +1,35 @@
<html>
<head>
<script type="text/javascript" src="../../../dojo.js"
djConfig="parseOnLoad: false, isDebug: true"></script>
</head>
<body>
<h1>Testcase for #8976</h1>
<p>Test case for <a href="http://bugs.dojotoolkit.org/ticket/8976">#8976</a>, an async load issue with Firefox even
though the loading should be synchronous. Click the button then check console log for output of test. If "count = 1, worked"
shows up instead of an error, then the test is successful.
</p>
<script>
var count = 0;
function wait(count){
console.log("count = "+count+", calling addOnLoad");
dojo.addOnLoad(function(){
try{
console.log("count = "+count+", testing");
var i = dijit.layout.TabController.constructor;
console.log("count = "+count+", worked");
}catch(e){ alert("failed: " + e) }
});
console.log("count = "+count+", addOnLoad returned");
}
function load(count){
console.log("count = "+count+", calling require");
dojo.require("dijit.dijit");
dojo.require("dijit.dijit-all");
console.log("count = "+count+", require returned");
}
</script>
<input type=button onmousedown="load(count++);return true" onmouseup="wait(count++);return true" value="click this button to load and wait">
</body>
</html>

View File

@@ -0,0 +1,408 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!--
Copyright 1999-2006 The Apache Software Foundation
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>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link rel="stylesheet" href="../style/style.css" type="text/css">
<meta name="author" content="The Apache Software Foundation" /><meta name="email" content="apache.AT.apache.DOT.org" />
<title>Apache License, Version 2.0 - The Apache Software Foundation</title>
</head>
<body>
<table border="0" width="100%" cellspacing="0">
<tr><!-- SITE BANNER AND PROJECT IMAGE -->
<td align="left" valign="top">
<a href="http://www.apache.org/"><img src="../images/asf_logo_wide.gif" alt="The Apache Software Foundation" align="left" border="0"/></a>
</td>
</tr>
</table>
<table border="0" width="100%" cellspacing="4">
<tr><td colspan="3"><hr noshade="noshade" size="1"/></td></tr>
<tr>
<!-- LEFT SIDE NAVIGATION -->
<td valign="top" nowrap="nowrap" class="navleft">
<div class="menuheader"><a
href="http://projects.apache.org/">Apache Projects</a></div>
<menu compact="compact">
<li><a href="http://httpd.apache.org/" title="Apache Web Server (httpd)">HTTP Server</a></li>
<li><a href="http://activemq.apache.org/" title="Distributed Messaging System">ActiveMQ</a></li>
<li><a href="http://ant.apache.org/" title="Java-based build tool">Ant</a></li>
<li><a href="http://apr.apache.org/" title="Apache Portable Runtime libraries">APR</a></li>
<li><a href="http://beehive.apache.org/" title="Metadata frameworks for enterprise applications">Beehive</a></li>
<li><a href="http://cayenne.apache.org/" title="User-friendly Java ORM with Tools">Cayenne</a></li>
<li><a href="http://cocoon.apache.org/" title="Web development framework: separation of concerns, component-based">Cocoon</a></li>
<li><a href="http://commons.apache.org/" title="Reusable Java components">Commons</a></li>
<li><a href="http://db.apache.org/" title="Database access">DB</a></li>
<li><a href="http://directory.apache.org/" title="Apache Directory Server">Directory</a></li>
<li><a href="http://excalibur.apache.org/" title="Embeddable software libraries related to component and service management access">Excalibur</a></li>
<li><a href="http://felix.apache.org/" title="OSGi Framework and components.">Felix</a></li>
<li><a href="http://forrest.apache.org/" title="Aggregated multi-channel documentation, separation of concerns">Forrest</a></li>
<li><a href="http://geronimo.apache.org/" title="Java2, Enterprise Edition (J2EE) container">Geronimo</a></li>
<li><a href="http://gump.apache.org/" title="Continuous integration of open source projects">Gump</a></li>
<li><a href="http://harmony.apache.org/" title="Open source implementation of Java SE">Harmony</a></li>
<li><a href="http://hivemind.apache.org/" title="A services and configuration microkernel">HiveMind</a></li>
<li><a href="http://ibatis.apache.org/" title="SQL Data Mapper for Java and .NET">iBATIS</a></li>
<li><a href="http://incubator.apache.org/" title="Shepherd for new projects">Incubator</a></li>
<li><a href="http://jackrabbit.apache.org/" title="Content Repository for Java">Jackrabbit</a></li>
<li><a href="http://jakarta.apache.org/" title="Server-side Java">Jakarta</a></li>
<li><a href="http://james.apache.org/" title="Java Apache Mail Enterprise Server">James</a></li>
<li><a href="http://labs.apache.org/" title="The Innovation Laboratories of the Apache Software Foundation">Labs</a></li>
<li><a href="http://lenya.apache.org/" title="Content Management System">Lenya</a></li>
<li><a href="http://logging.apache.org/" title="Cross-language logging services">Logging</a></li>
<li><a href="http://lucene.apache.org/" title="Search engine library">Lucene</a></li>
<li><a href="http://maven.apache.org/" title="Java project management and comprehension tools">Maven</a></li>
<li><a href="http://mina.apache.org/" title="Multipurpose Infrastructure for Network Application">Mina</a></li>
<li><a href="http://myfaces.apache.org/" title="JavaServer(tm) Faces implementation and components">MyFaces</a></li>
<li><a href="http://ode.apache.org/" title="Orchestration Director Engine: Business Process Management (BPM), Process Orchestration and Workflow through service compositioni.">ODE</a></li>
<li><a href="http://ofbiz.apache.org/" title="Open for Business: enterprise automation software">OFBiz</a></li>
<li><a href="http://openejb.apache.org/" title="OpenEJB: a modular, configurable, and extendable EJB Container System and Server">OpenEJB</a></li>
<li><a href="http://openjpa.apache.org/" title="OpenJPA: Object Relational Mapping for Java">OpenJPA</a></li>
<li><a href="http://perl.apache.org/" title="Dynamic websites using Perl">Perl</a></li>
<li><a href="http://poi.apache.org/" title="Java API for OLE 2 Compound Documents">POI</a></li>
<li><a href="http://portals.apache.org/" title="Portal technology">Portals</a></li>
<li><a href="http://roller.apache.org/" title="Java blog server">Roller</a></li>
<li><a href="http://santuario.apache.org/" title="XML Security in Java and C++">Santuario</a></li>
<li><a href="http://shale.apache.org/" title="Web application framework based on JavaServer(tm) Faces">Shale</a></li>
<li><a href="http://spamassassin.apache.org/" title="Mail filter to identify spam">SpamAssassin</a></li>
<li><a href="http://struts.apache.org/" title="Model 2 framework for building Java web applications">Struts</a></li>
<li><a href="http://tapestry.apache.org/" title="Component-based Java Web Application Framework">Tapestry</a></li>
<li><a href="http://tcl.apache.org/" title="Dynamic websites using TCL">TCL</a></li>
<li><a href="http://tiles.apache.org/" title="A templating framework for web application user interfaces">Tiles</a></li>
<li><a href="http://tomcat.apache.org/" title="A Java Servlet and JSP Container">Tomcat</a></li>
<li><a href="http://turbine.apache.org/" title="A Java Servlet Web Application Framework and associated component library">
Turbine</a></li>
<li><a href="http://velocity.apache.org/" title="A Java Templating Engine">Velocity</a></li>
<li><a href="http://wicket.apache.org/" title="Component-based Java Web Application Framework.">Wicket</a></li>
<li><a href="http://ws.apache.org/">Web Services</a></li>
<li><a href="http://xalan.apache.org/" title="XSLT processors in Java and C++">Xalan</a></li>
<li><a href="http://xerces.apache.org/" title="XML parsers in Java, C++ and Perl">Xerces</a></li>
<li><a href="http://xml.apache.org/" title="XML solutions focused on the web">XML</a></li>
<li><a href="http://xmlbeans.apache.org/" title="XML-Java binding tool">XMLBeans</a></li>
<li><a href="http://xmlgraphics.apache.org/" title="Conversion from XML to graphical output">XML Graphics</a></li>
</menu>
</td>
<!-- CONTENT -->
<td align="left" valign="top" class="content">
<h2><img src="/images/redarrow.gif" alt=" "/>
Apache License, Version 2.0
</h2>
<div class="section-content">
<p align="center">
Apache License<br />
Version 2.0, January 2004<br />
<a href="http://www.apache.org/licenses/">http://www.apache.org/licenses/</a>
</p>
<p>
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
</p>
<p><b><a name="definitions">1. Definitions</a></b>.</p>
<p>
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
</p>
<p>
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
</p>
<p>
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
</p>
<p>
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
</p>
<p>
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
</p>
<p>
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
</p>
<p>
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
</p>
<p>
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
</p>
<p>
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
</p>
<p>
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
</p>
<p><b><a name="copyright">2. Grant of Copyright License</a></b>.
Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
</p>
<p><b><a name="patent">3. Grant of Patent License</a></b>.
Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
</p>
<div><b><a name="redistribution">4. Redistribution</a></b>.
You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
<ol type="a">
<li>You must give any other recipients of the Work or
Derivative Works a copy of this License; and
<br /> <br /></li>
<li>You must cause any modified files to carry prominent notices
stating that You changed the files; and
<br /> <br /></li>
<li>You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
<br /> <br /></li>
<li>If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.</li>
</ol>
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
</div>
<p><b><a name="contributions">5. Submission of Contributions</a></b>.
Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
</p>
<p><b><a name="trademarks">6. Trademarks</a></b>.
This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
</p>
<p><b><a name="no-warranty">7. Disclaimer of Warranty</a></b>.
Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
</p>
<p><b><a name="no-liability">8. Limitation of Liability</a></b>.
In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
</p>
<p><b><a name="additional">9. Accepting Warranty or Additional Liability</a></b>.
While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
</p>
<p>
END OF TERMS AND CONDITIONS
</p>
</div>
<h2><img src="/images/redarrow.gif" alt=" "/>
<a name="apply">APPENDIX: How to apply the Apache License to your work</a>
</h2>
<div class="section-content">
<p>
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
</p>
<div class="source"><code>
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the &quot;License&quot;);
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 &quot;AS IS&quot; 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.
</code>
</div>
</div>
</td>
<!-- RIGHT SIDE NAVIGATION -->
<td valign="top" nowrap="nowrap" class="navright">
<div class="menuheader"><a
href="/foundation/">Foundation</a></div>
<menu compact="compact">
<li><a href="/foundation/faq.html">FAQ</a></li>
<li><a href="/licenses/">Licenses</a></li>
<li><a href="/foundation/news.html">News</a></li>
<li><a href="/foundation/records/">Public Records</a></li>
<li><a href="/foundation/sponsorship.html">Sponsorship</a></li>
<li><a href="/foundation/contributing.html">Donations</a></li>
<li><a href="/foundation/thanks.html">Thanks</a></li>
<li><a href="/foundation/contact.html">Contact</a></li>
</menu>
<div class="menuheader">Foundation Projects</div>
<menu compact="compact">
<li><a href="/foundation/conferences.html" title="Meetings of developers and users">Conferences</a></li>
<li><a href="/dev/" title="ASF Infrastructure: Operations and howto documents for PMCs and contributors">Infrastructure</a></li>
<li><a href="/jcp/" title="Apache and the Java Community Process">JCP</a></li>
</menu>
<div class="menuheader">How it works</div>
<menu compact="compact">
<li><a href="/foundation/how-it-works.html">Introduction</a></li>
<li><a href="/foundation/how-it-works.html#meritocracy">Meritocracy</a></li>
<li><a href="/foundation/how-it-works.html#structure">Structure</a></li>
<li><a href="/foundation/how-it-works.html#roles">Roles</a></li>
<li><a href="/foundation/how-it-works.html#management">Collaboration</a></li>
<li><a href="/foundation/how-it-works.html#infrastructure">Infrastructure</a></li>
<li><a href="/foundation/how-it-works.html#incubator">Incubator</a></li>
<li><a href="/foundation/how-it-works.html#other">Other entities</a></li>
<li><a href="/foundation/glossary.html">Glossary</a></li>
<li><a href="/foundation/voting.html">Voting</a></li>
</menu>
<div class="menuheader"><a
href="/foundation/getinvolved.html">Get Involved</a></div>
<menu compact="compact">
<li><a href="/foundation/mailinglists.html">Mailing Lists</a></li>
<li><a href="/dev/version-control.html">Version Control</a></li>
<li><a href="/dev/">Developer Info</a></li>
</menu>
<div class="menuheader">Download</div>
<menu compact="compact">
<li><a href="http://www.apache.org/dyn/closer.cgi">from a mirror</a></li>
</menu>
<div class="menuheader">Related Sites</div>
<menu compact="compact">
<li><a href="http://apachecon.com/" title="Official Apache Conference">ApacheCon</a></li>
<li><a href="http://apachebookstore.com/" title="Apache Books">Bookstore</a></li>
<li><a href="http://feathercast.org/" title="Apache Podcasts">Feathercast</a></li>
<li><a href="http://planetapache.org/" title="Apache Community Blogs">PlanetApache</a></li>
</menu>
<div class="menuheader">Search apache.org</div>
<div class="searchbox">
<form action="http://www.google.com/search" method="get">
<input value="*.apache.org" name="sitesearch" type="hidden"/>
<input size="10" name="q" id="query" type="text"/>
<input name="Search" value="Go" type="submit"/>
</form>
</div>
</td>
</tr>
<!-- FOOTER -->
<tr><td colspan="3"><hr noshade="noshade" size="1"/></td></tr>
<tr><td colspan="3" class="footer">
Copyright &#169; 2007 The Apache Software Foundation<br />
Licensed under the <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache License, Version 2.0</a>.
</td>
</tr>
</table>
</body>
</html>

View File

@@ -0,0 +1,10 @@
<div data-dojo-attach-event='onclick:_onTitleClick' class='dijitAccordionTitle' role="presentation">
<div data-dojo-attach-point='titleNode,focusNode' data-dojo-attach-event='onkeypress:_onTitleKeyPress'
class='dijitAccordionTitleFocus' role="tab" aria-expanded="false"
><span class='dijitInline dijitAccordionArrow' role="presentation"></span
><span class='arrowTextUp' role="presentation">+</span
><span class='arrowTextDown' role="presentation">-</span
><img src="${_blankGif}" alt="" class="dijitIcon" data-dojo-attach-point='iconNode' style="vertical-align: middle" role="presentation"/>
<span role="presentation" data-dojo-attach-point='titleTextNode' class='dijitAccordionText'></span>
</div>
</div>

View File

@@ -0,0 +1,510 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<title>Accordion Widget Automated Test</title>
<!-- only needed for test files: -->
<style type="text/css">
@import "../../themes/claro/document.css";
@import "../css/dijitTests.css";
</style>
<!-- required: the default dijit theme: -->
<link id="themeStyles" rel="stylesheet" href="../../../dijit/themes/claro/claro.css"/>
<!-- required: dojo.js -->
<script type="text/javascript" src="../../../dojo/dojo.js"
data-dojo-config="isDebug: true"></script>
<!-- only needed for alternate theme testing: -->
<script type="text/javascript" src="../_testCommon.js"></script>
<!-- helper methods -->
<script type="text/javascript" src="../helpers.js"></script>
<script type="text/javascript">
dojo.require("doh.runner");
dojo.require("dojo.parser");
dojo.require("dijit.registry");
dojo.require("dijit.form.Button");
dojo.require("dijit.layout.AccordionContainer");
dojo.require("dijit.layout.ContentPane");
var accordion;
dojo.ready(function(){
doh.register("basic",
[
{
name: "create",
runTest: function(t){
accordion = new dijit.layout.AccordionContainer({style: "width: 400px; height: 400px;"}).placeAt(dojo.body());
dojo.forEach([ "pane 1", "pane 2", "pane 3" ], function(title, i){
var content = new dijit.layout.ContentPane({id: title, title: title, selected: i==1});
content.containerNode.innerHTML = "this is " + title;
accordion.addChild(content);
});
accordion.startup();
var titles = dojo.query(".dijitAccordionText", accordion.domNode);
t.is(3, titles.length, "number of titles");
t.is("pane 3", titles[2].innerHTML);
var children = accordion.getChildren();
t.is(3, children.length, "number of children (ie, contentpanes)");
}
},
{
name: "initially open pane",
runTest: function(t){
// Pane 2 is initially open
var openPanes = dojo.query(".dijitAccordionChildWrapper > *", accordion.containerNode).filter(function(node){
return node.parentNode.style.display != "none";
});
t.is(1, openPanes.length, "exactly one open pane");
t.is("pane 2", dijit.byNode(openPanes[0]).title, "pane 2 is initially open");
// And others are closed
var closedPanes = dojo.query(".dijitAccordionChildWrapper > *", accordion.containerNode).filter(function(node){
return node.parentNode.style.display == "none";
});
t.is(2, closedPanes.length, "n-1 closed panes");
}
},
{
name: "addChild at end",
runTest: function(t){
var pane4 = new dijit.layout.ContentPane({title: "pane 4", content: "this is pane 4"});
accordion.addChild(pane4);
var titles = dojo.query(".dijitAccordionText", accordion.domNode);
t.is(4, titles.length, "number of titles");
t.is("pane 4", titles[3].innerHTML);
var children = accordion.getChildren();
t.is(4, children.length, "number of children (ie, contentpanes)");
t.is(pane4, children[3], "last child is the newly inserted one");
}
},
{
name: "addChild after pane 1",
runTest: function(t){
pane1half = new dijit.layout.ContentPane({id: "pane1half", title: "pane 1.5", content: "this is pane 1.5"});
accordion.addChild(pane1half, 1);
var titles = dojo.query(".dijitAccordionText", accordion.domNode);
t.is(5, titles.length, "number of titles");
t.is("pane 1.5", titles[1].innerHTML);
var children = accordion.getChildren();
t.is(5, children.length, "number of children (ie, contentpanes)");
t.is(pane1half, children[1], "second child is the newly inserted one");
}
},
{
name: "removeChild(pane 1.5)",
runTest: function(t){
accordion.removeChild(dijit.byId('pane1half'));
var titles = dojo.query(".dijitAccordionText", accordion.domNode);
t.is(4, titles.length, "number of titles");
t.is("pane 2", titles[1].innerHTML);
var children = accordion.getChildren();
t.is(4, children.length, "number of children (ie, contentpanes)");
t.is("pane 2", children[1].title, "second child is again 'pane 2'");
// spec is that removing a child shouldn't delete it
t.t(dijit.byId("pane1half"), "child removed but still exists");
}
},
{
name: "initially open pane (checking again)",
runTest: function(t){
// Pane 2 is initially open
var openPanes = dojo.query(".dijitAccordionChildWrapper > *", accordion.containerNode).filter(function(node){
return node.parentNode.style.display != "none";
});
t.is(1, openPanes.length, "exactly one open pane");
t.is("pane 2", dijit.byNode(openPanes[0]).title, "pane 2 is initially open");
// And others are closed
var closedPanes = dojo.query(".dijitAccordionChildWrapper > *", accordion.containerNode).filter(function(node){
return node.parentNode.style.display == "none";
});
t.is(3, closedPanes.length, "n-1 closed panes");
}
},
{
name: "select new pane",
runTest: function(t){
// Selecting pane 3 should open it and close pane 1
// select w/out animation
accordion.selectChild(dijit.byId('pane 3'));
// Pane 3 is now open
var openPanes = dojo.query(".dijitAccordionChildWrapper > *", accordion.containerNode).filter(function(node){
return node.parentNode.style.display != "none";
});
t.is(1, openPanes.length, "exactly one open pane");
t.is("pane 3", dijit.byNode(openPanes[0]).title, "pane 3 is now open");
// And others are closed
var closedPanes = dojo.query(".dijitAccordionChildWrapper > *", accordion.containerNode).filter(function(node){
return node.parentNode.style.display == "none";
});
t.is(3, closedPanes.length, "n-1 closed panes");
}
},
{
name: "select new pane with animation",
timeout: 3000,
setUp: function(t){
// Note that this kicks off an animation so it might be a while before the
// bottom setTimeout() fires, likely longer than the 300ms specified
accordion.selectChild(dijit.byId('pane 2'), true);
},
runTest: function(t){
// Selecting pane 2 should open it and close pane 3
var d = new doh.Deferred();
setTimeout(d.getTestCallback(function(){
// Pane 2 is now open
var openPanes = dojo.query(".dijitAccordionChildWrapper > *", accordion.containerNode).filter(function(node){
return node.parentNode.style.display != "none";
});
t.is(1, openPanes.length, "exactly one open pane");
t.is("pane 2", dijit.byNode(openPanes[0]).title, "pane 3 is now open");
// And others are closed
var closedPanes = dojo.query(".dijitAccordionChildWrapper > *", accordion.containerNode).filter(function(node){
return node.parentNode.style.display == "none";
});
t.is(3, closedPanes.length, "n-1 closed panes");
}), 300);
return d;
}
},
{
name: "destroy recursive",
runTest: function(t){
accordion.destroyRecursive();
t.is(1, dijit.registry.toArray().length, "accordion and subwidgets destroyed, pane1half remains");
}
}
]
);
doh.register("child events", function childEvents(t){
accordion = new dijit.layout.AccordionContainer({style: "width: 400px; height: 400px;"}).placeAt(dojo.body());
dojo.forEach([ "a", "b", "c" ], function(title, i){
var content = new dijit.layout.ContentPane({id: title, title: title, selected: i==1});
content.containerNode.innerHTML = "this is " + title;
accordion.addChild(content);
});
accordion.startup();
// Change title of a pane, should change corresponding button label
dijit.byId("b").set("title", "b changed");
var titles = dojo.query(".dijitAccordionText", accordion.domNode);
t.is(3, titles.length, "number of titles");
t.is("b changed", titles[1].innerHTML);
// Change tooltip of a pane, should change corresponding button tooltip
dijit.byId("c").set("tooltip", "c tooltip changed");
titles = dojo.query(".dijitAccordionText", accordion.domNode);
t.is(3, titles.length, "number of titles");
t.is("c tooltip changed", titles[2].title);
});
doh.register("zero children",
[
{
name: "create w/no children",
runTest: function(t){
accordion = new dijit.layout.AccordionContainer({style: "width: 400px; height: 400px;"}).placeAt(dojo.body());
accordion.startup();
var children = accordion.getChildren();
t.is(0, children.length, "no children");
accordion.resize();
t.t(true, "resize ran w/out exception");
}
},
{
name: "add children",
runTest: function(t){
dojo.forEach([ "pane 10", "pane 11"], function(title, i){
var content = new dijit.layout.ContentPane({id: title, title: title});
content.containerNode.innerHTML = "this is " + title;
accordion.addChild(content);
});
var children = accordion.getChildren();
t.is(2, children.length, "2 children");
}
},
{
name: "remove all children",
runTest: function(t){
var pane10 = dijit.byId("pane 10"),
pane11 = dijit.byId("pane 11");
t.is(pane10, accordion.selectedChildWidget, "pane 10 initially selected");
accordion.removeChild(pane10);
t.is(pane11, accordion.selectedChildWidget, "after pane 10 removed, pane 11 selected");
accordion.removeChild(pane11);
t.f(accordion.selectedChildWidget, "after pane 11 removed, no pane selected");
var children = accordion.getChildren();
t.is(0, children.length, "all children removed");
}
},
{
name: "add back children",
runTest: function(t){
dojo.forEach([ "pane 12", "pane 13"], function(title, i){
var content = new dijit.layout.ContentPane({id: title, title: title});
content.containerNode.innerHTML = "this is " + title;
accordion.addChild(content);
});
var children = accordion.getChildren();
t.is(2, children.length, "two new children");
t.is(dijit.byId("pane 12"), accordion.selectedChildWidget, "pane 12 selected");
}
}
]
);
// This section tests that the animation doesn't leave residual height=... settings on the
// node that interfere with future operations
doh.register("animation",
[
{
name: "create",
runTest: function(t){
accordion = new dijit.layout.AccordionContainer({style: "width: 400px; height: 400px;"}).placeAt(dojo.body());
dojo.forEach([ "pane 1", "pane 2", "pane 3" ], function(title, i){
var content = new dijit.layout.ContentPane({id: title, title: title, selected: i==1});
content.containerNode.innerHTML = "this is " + title;
accordion.addChild(content);
});
accordion.startup();
// make sure size of selected child is correct
doh.t(dojo.position(accordion.selectedChildWidget.domNode).h > 300, "child height > 300");
doh.t(dojo.position(accordion.selectedChildWidget.domNode).h < 400, "child height < 400");
doh.is(dojo.marginBox(accordion.selectedChildWidget.domNode).h, dojo.contentBox(accordion.selectedChildWidget._wrapperWidget.containerNode).h, "child height vs. wrapper height")
}
},
{
name: "select new pane with animation",
timeout: 3000,
setUp: function(t){
// Note that this kicks off an animation so it might be a while before the
// bottom setTimeout() fires, likely longer than the 300ms specified
accordion.selectChild(dijit.byId('pane 2'), true);
},
runTest: function(t){
// Selecting pane 2 should open it and close pane 3
var d = new doh.Deferred();
setTimeout(d.getTestCallback(function(){
doh.is("pane 2", accordion.selectedChildWidget.title);
// make sure size of selected child is correct
doh.t(dojo.position(accordion.selectedChildWidget.domNode).h > 300, "child height > 300");
doh.t(dojo.position(accordion.selectedChildWidget.domNode).h < 400, "child height < 400");
doh.is(dojo.marginBox(accordion.selectedChildWidget.domNode).h, dojo.contentBox(accordion.selectedChildWidget._wrapperWidget.containerNode).h, "child height vs. wrapper height")
}), 300);
return d;
}
},
// Make sure that the animation didn't leave a residual height: 1px that affect
// pane #1 when it is reselected w/out an animation
{
name: "remove pane #2, reselecting pane #1",
runTest: function(t){
accordion.removeChild(dijit.byId("pane 2"));
doh.is("pane 1", accordion.selectedChildWidget.title);
// make sure size of selected child is correct
doh.t(dojo.position(accordion.selectedChildWidget.domNode).h > 300, "child height > 300");
doh.t(dojo.position(accordion.selectedChildWidget.domNode).h < 400, "child height < 400");
doh.is(dojo.marginBox(accordion.selectedChildWidget.domNode).h, dojo.contentBox(accordion.selectedChildWidget._wrapperWidget.containerNode).h, "child height vs. wrapper height")
}
},
{
name: "select pane #3 with animation",
timeout: 3000,
setUp: function(t){
// Note that this kicks off an animation so it might be a while before the
// bottom setTimeout() fires, likely longer than the 300ms specified
accordion.selectChild(dijit.byId('pane 3'), true);
},
runTest: function(t){
// Selecting pane 2 should open it and close pane 3
var d = new doh.Deferred();
setTimeout(d.getTestCallback(function(){
doh.is("pane 3", accordion.selectedChildWidget.title);
// make sure size of selected child is correct
doh.t(dojo.position(accordion.selectedChildWidget.domNode).h > 300, "child height > 300");
doh.t(dojo.position(accordion.selectedChildWidget.domNode).h < 400, "child height < 400");
doh.is(dojo.marginBox(accordion.selectedChildWidget.domNode).h, dojo.contentBox(accordion.selectedChildWidget._wrapperWidget.containerNode).h, "child height vs. wrapper height")
}), 300);
return d;
}
},
// Make sure that the wipe-in animation didn't leave a residual height: 300px type
// setting that will interfere with resizing
{
name: "resize",
timeout: 3000,
runTest: function(t){
accordion.resize({h: 200});
// make sure size of selected child is correct
doh.t(dojo.position(accordion.selectedChildWidget.domNode).h > 100, "child height > 150");
doh.t(dojo.position(accordion.selectedChildWidget.domNode).h < 200, "child height < 200");
doh.is(dojo.marginBox(accordion.selectedChildWidget.domNode).h, dojo.contentBox(accordion.selectedChildWidget._wrapperWidget.containerNode).h, "child height vs. wrapper height")
}
}
]
);
doh.register("destroy", [
function setUp(){
accPane = new dijit.layout.ContentPane({
id: "accPane",
onContentError: function(msg){
throw new Error(msg);
}
});
accPane.placeAt(dojo.body());
html='<div data-dojo-type="dijit.layout.AccordionContainer" id="Accordion" style="height: 300px;">' +
'<div data-dojo-type="dijit.layout.ContentPane" title="first" id="first">' +
'<div data-dojo-type=dijit.form.Button id=myButton>hello world</div></div>' +
'<div data-dojo-type="dijit.layout.ContentPane" title="second" id="second">second</div>' +
'</div>';
},
function destroyUnstarted(){
// Since the wrapper ContentPane hasn't been started yet, the Accordion won't be started, and wrapper
// (AccordionInnerContainer) widgets won't be created...
accPane.set("content", html);
doh.t(dojo.byId("Accordion"), "accordion created #1");
accPane.set("content", html); //setting the content twice will initiate a destroy
dijit.byId("Accordion").destroy();
doh.is(undefined, dojo.byId("Accordion"), "accordion destroyed #1");
},
function destroyStarted(){
// Try same tests again when wrapper ContentPane is started
accPane.startup();
accPane.set("content", html);
doh.t(dojo.byId("Accordion"), "accordion created #2");
accPane.set("content", html); //setting the content twice will initiate a destroy
dijit.byId("Accordion").destroy();
doh.is(undefined, dojo.byId("Accordion"), "accordion destroyed #2");
}
]);
doh.register("markup", [
{
name: "create",
runTest: function(t){
dojo.parser.parse();
accordion = dijit.byId("markupAccordion");
var titles = dojo.query(".dijitAccordionText", accordion.domNode);
t.is(3, titles.length, "number of titles");
t.is("Other Lazy Load Pane", titles[2].innerHTML);
var children = accordion.getChildren();
t.is(3, children.length, "number of children (ie, contentpanes)");
}
},
{
name: "addChild after pane 1",
runTest: function(t){
pane1half = new dijit.layout.ContentPane({id: "otherPane1half", title: "pane 1.5", content: "this is pane 1.5"});
accordion.addChild(pane1half, 1);
var titles = dojo.query(".dijitAccordionText", accordion.domNode);
t.is(4, titles.length, "number of titles");
t.is("pane 1.5", titles[1].innerHTML);
var children = accordion.getChildren();
t.is(4, children.length, "number of children (ie, contentpanes)");
t.is(pane1half, children[1], "second child is the newly inserted one");
}
}
]);
doh.run();
});
</script>
</head>
<body class="claro" style="padding: 50px;">
<h1 class="testTitle">AccordionContainer Automated Tests</h1>
<h2 class="testTitle">Markup Accordion</h2>
<div id="markupAccordion" data-dojo-type="dijit.layout.AccordionContainer"
data-dojo-props='style:"width: 400px; height: 300px; overflow: hidden"'>
<div id="pane1" data-dojo-type="dijit.layout.ContentPane" data-dojo-props='selected:true,
title:"A Simple Pane", iconClass:"dijitEditorIcon dijitEditorIconSave", tooltip:"tooltip for simple pane" '>
<select>
<option>red</option>
<option>blue</option>
<option>green</option>
</select>
<p>
Nunc consequat nisi vitae quam. Suspendisse sed nunc. Proin
suscipit porta magna. Duis accumsan nunc in velit. Nam et nibh.
Nulla facilisi. Cras venenatis urna et magna. Aenean magna mauris,
bibendum sit amet, semper quis, aliquet nec, sapien. Aliquam
aliquam odio quis erat. Etiam est nisi, condimentum non, lacinia
ac, vehicula laoreet, elit. Sed interdum augue sit amet quam
dapibus semper. Nulla facilisi. Pellentesque lobortis erat nec
quam.
</p>
<p>
Sed arcu magna, molestie at, <input value="fringilla in, sodales"/> fringilla in, sodales eu, elit.
Curabitur mattis lorem et est. Quisque et tortor. Integer bibendum
vulputate odio. Nam nec ipsum. Vestibulum mollis eros feugiat
augue. Integer fermentum odio lobortis odio. Nullam mollis nisl non
metus. Maecenas nec nunc eget pede ultrices blandit. Ut non purus
ut elit convallis eleifend. Fusce tincidunt, justo quis tempus
euismod, magna nulla viverra libero, sit amet lacinia odio diam id
risus. Ut varius viverra turpis. Morbi urna elit, imperdiet eu,
porta ac, pharetra sed, nisi. Etiam ante libero, ultrices ac,
faucibus ac, cursus sodales, nisl. Praesent nisl sem, fermentum eu,
consequat quis, varius interdum, nulla. Donec neque tortor,
sollicitudin sed, consequat nec, facilisis sit amet, orci. Aenean
ut eros sit amet ante pharetra interdum.
</p>
</div>
<!-- test lazy loading. margin style for testing size calculations. -->
<div id="lazyLoadPane1" data-dojo-type="dijit.layout.ContentPane"
data-dojo-props='title:"Lazy Load Pane", href:"doc1.html"'></div>
<!-- test lazy loading. margin style for testing size calculations. -->
<div id="lazyLoadPane2" data-dojo-type="dijit.layout.ContentPane"
data-dojo-props='title:"Other Lazy Load Pane", href:"doc1.html"'></div>
</div>
<h2 class="testTitle">Programmatic Accordions</h2>
</body>
</html>

View File

@@ -0,0 +1,75 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>doh.robot AccordionContainer A11Y Test</title>
<style>
@import "../../../../util/doh/robot/robot.css";
</style>
<!-- required: dojo.js -->
<script type="text/javascript" src="../../../../dojo/dojo.js"
djConfig="isDebug: true"></script>
<!-- functions to help test -->
<script type="text/javascript" src="../../helpers.js"></script>
<script type="text/javascript">
dojo.require("dijit.robotx");
dojo.ready(function(){
doh.robot.initRobot('../test_AccordionContainer.html');
doh.register("Accordion A11Y tests", [
{
name: "basic operation",
timeout: 10000,
runTest: function(t){
var d = new doh.Deferred();
doh.robot.sequence(function(){
dojo.byId("beforeMarkupAccordion").focus();
}, 500, 500);
// Tab into accordion, landing on title of first pane
doh.robot.keyPress(dojo.keys.TAB, 500, {});
doh.robot.sequence(d.getTestErrback(function(){
doh.t(/A Simple Pane/.test(innerText(dojo.global.dijit.focus.curNode)), "tabbed to first pane's title");
}), 500);
// Use down arrow to get to second pane's title
doh.robot.keyPress(dojo.keys.DOWN_ARROW, 500, {});
doh.robot.sequence(d.getTestErrback(function(){
doh.f(/A Simple Pane/.test(innerText(dojo.global.dijit.focus.curNode)), "moved away from first pane's title");
doh.t(/Lazy Load Pane/.test(innerText(dojo.global.dijit.focus.curNode)), "moved to second pane's title");
doh.is("lazyLoadPane", dojo.global.dijit.byId("markupAccordion").get("selectedChildWidget").id, "second pane is now selected");
}), 500);
// Workaround FF4 bug where overflow:auto panes get focus even when
// they don't have a scrollbar, remove when
// https://bugzilla.mozilla.org/show_bug.cgi?id=616594 fixed
if(dojo.isFF == 4){
dojo.query("#lazyLoadPane").style("overflow", "hidden");
}
// Tab into second pane's content area, landing on link inside pane
doh.robot.keyPress(dojo.keys.TAB, 500, {});
doh.robot.sequence(d.getTestErrback(function(){
doh.is("WebA11y", innerText(dojo.global.dijit.focus.curNode), "tabbed into second pane");
}), 500);
// tab out of AccordionContainer
doh.robot.keyPress(dojo.keys.TAB, 500, {});
doh.robot.sequence(d.getTestCallback(function(){
doh.is("afterMarkupAccordion", dojo.global.dijit.focus.curNode.id, "tabbed out of accordion");
}), 500);
return d;
}
}
]);
doh.run();
});
</script>
</head>
</html>

View File

@@ -0,0 +1,53 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>doh.robot AccordionContainer Mouse Test</title>
<style>
@import "../../../../util/doh/robot/robot.css";
</style>
<!-- required: dojo.js -->
<script type="text/javascript" src="../../../../dojo/dojo.js"
djConfig="isDebug: true"></script>
<!-- functions to help test -->
<script type="text/javascript" src="../../helpers.js"></script>
<script type="text/javascript">
dojo.require("dijit.robotx");
dojo.ready(function(){
doh.robot.initRobot('../test_AccordionContainer.html');
doh.register("Accordion Mouse tests",[
{
name: "basic operation",
timeout: 10000,
runTest: function(t){
var d = new doh.Deferred();
// Click open second pane
doh.robot.mouseMoveAt("lazyLoadPane_button_title", 500, 1);
doh.robot.mouseClick({left: true}, 500);
doh.robot.sequence(d.getTestErrback(function(){
doh.is("lazyLoadPane", dojo.global.dijit.byId("markupAccordion").get("selectedChildWidget").id, "second pane is now selected");
}), 500);
// Click open fourth pane
doh.robot.mouseMoveAt("embeddedLayoutPane_button_title", 500, 1);
doh.robot.mouseClick({left: true}, 500);
doh.robot.sequence(d.getTestCallback(function(){
doh.is("embeddedLayoutPane", dojo.global.dijit.byId("markupAccordion").get("selectedChildWidget").id, "fourth pane is now selected");
}), 2000);
return d;
}
}
]);
doh.run();
});
</script>
</head>
</html>

147
master/examples/Action.html Normal file
View File

@@ -0,0 +1,147 @@
<html>
<head>
<title>Test Action</title>
<script type="text/javascript" src="../../../../dojo/dojo.js" djConfig="isDebug: true, parseOnLoad: true"></script>
<script type="text/javascript">
dojo.provide("dojox.wire.ml.tests.markup.Action");
dojo.require("dojo.parser");
dojo.require("doh.runner");
dojo.require("dojox.wire.ml.Action");
dojo.require("dojox.wire.ml.Transfer");
dojox.wire.ml.tests.markup.Action = {
transfer: function(){},
source: {a: "A", b: "B"}
};
dojo.addOnLoad(function(){
doh.register("dojox.wire.ml.tests.markup.Action", [
function test_Action_triggerEvent(t){
dojox.wire.ml.tests.markup.Action.target = {};
dojox.wire.ml.tests.markup.Action.transfer();
t.assertEqual(dojox.wire.ml.tests.markup.Action.source.a, dojox.wire.ml.tests.markup.Action.target.a);
t.assertEqual(dojox.wire.ml.tests.markup.Action.source.b, dojox.wire.ml.tests.markup.Action.target.b);
},
function test_Action_triggerTopic(t){
dojox.wire.ml.tests.markup.Action.target = {};
dojo.publish("transfer");
t.assertEqual(dojox.wire.ml.tests.markup.Action.source.a, dojox.wire.ml.tests.markup.Action.target.a);
},
function test_ActionFilter_required(t){
dojox.wire.ml.tests.markup.Action.target = {};
dojo.publish("transferFilter");
t.assertEqual(undefined, dojox.wire.ml.tests.markup.Action.target.a);
t.assertEqual("no required", dojox.wire.ml.tests.markup.Action.error);
dojox.wire.ml.tests.markup.Action.required = true;
dojo.publish("transferFilter");
t.assertEqual(dojox.wire.ml.tests.markup.Action.source.a, dojox.wire.ml.tests.markup.Action.target.a);
},
function test_ActionFilter_requiredSpecificNumber(t){
dojox.wire.ml.tests.markup.Action.value = null
dojox.wire.ml.tests.markup.Action.target = {};
dojo.publish("transferFilterNumber");
t.assertEqual(undefined, dojox.wire.ml.tests.markup.Action.target.a);
dojox.wire.ml.tests.markup.Action.value = 20;
dojo.publish("transferFilterNumber");
t.assertEqual(dojox.wire.ml.tests.markup.Action.source.a, dojox.wire.ml.tests.markup.Action.target.a);
},
function test_ActionFilter_requiredSpecificBoolean(t){
dojox.wire.ml.tests.markup.Action.value = null;
dojox.wire.ml.tests.markup.Action.target = {};
dojo.publish("transferFilterBoolean");
t.assertEqual(undefined, dojox.wire.ml.tests.markup.Action.target.a);
dojox.wire.ml.tests.markup.Action.value = true;
dojo.publish("transferFilterBoolean");
t.assertEqual(dojox.wire.ml.tests.markup.Action.source.a, dojox.wire.ml.tests.markup.Action.target.a);
},
function test_ActionFilter_requiredSpecificString(t){
dojox.wire.ml.tests.markup.Action.target = {};
dojox.wire.ml.tests.markup.Action.value = null;
dojo.publish("transferFilterString");
t.assertEqual(undefined, dojox.wire.ml.tests.markup.Action.target.a);
dojox.wire.ml.tests.markup.Action.value = "executeThis";
dojo.publish("transferFilterString");
t.assertEqual(dojox.wire.ml.tests.markup.Action.source.a, dojox.wire.ml.tests.markup.Action.target.a);
}
]);
doh.run();
});
</script>
</head>
<body>
<div dojoType="dojox.wire.ml.Action"
trigger="dojox.wire.ml.tests.markup.Action"
triggerEvent="transfer">
<div dojoType="dojox.wire.ml.Transfer"
source="dojox.wire.ml.tests.markup.Action.source.a"
target="dojox.wire.ml.tests.markup.Action.target.a"></div>
<div dojoType="dojox.wire.ml.Transfer"
source="dojox.wire.ml.tests.markup.Action.source.b"
target="dojox.wire.ml.tests.markup.Action.target.b"></div>
</div>
<div dojoType="dojox.wire.ml.Action"
triggerTopic="transfer">
<div dojoType="dojox.wire.ml.Transfer"
source="dojox.wire.ml.tests.markup.Action.source.a"
target="dojox.wire.ml.tests.markup.Action.target.a"></div>
</div>
<div dojoType="dojox.wire.ml.Action"
triggerTopic="transferFilter">
<div dojoType="dojox.wire.ml.ActionFilter"
required="dojox.wire.ml.tests.markup.Action.required"
message="no required"
error="dojox.wire.ml.tests.markup.Action.error"></div>
<div dojoType="dojox.wire.ml.Transfer"
source="dojox.wire.ml.tests.markup.Action.source.a"
target="dojox.wire.ml.tests.markup.Action.target.a"></div>
</div>
<div dojoType="dojox.wire.ml.Action"
triggerTopic="transferFilterNumber">
<div dojoType="dojox.wire.ml.ActionFilter"
required="dojox.wire.ml.tests.markup.Action.value"
requiredValue="20"
type="number">
</div>
<div dojoType="dojox.wire.ml.Transfer"
source="dojox.wire.ml.tests.markup.Action.source.a"
target="dojox.wire.ml.tests.markup.Action.target.a"></div>
</div>
<div dojoType="dojox.wire.ml.Action"
triggerTopic="transferFilterBoolean">
<div dojoType="dojox.wire.ml.ActionFilter"
required="dojox.wire.ml.tests.markup.Action.value"
requiredValue="true"
type="boolean">
</div>
<div dojoType="dojox.wire.ml.Transfer"
source="dojox.wire.ml.tests.markup.Action.source.a"
target="dojox.wire.ml.tests.markup.Action.target.a"></div>
</div>
<div dojoType="dojox.wire.ml.Action"
triggerTopic="transferFilterString">
<div dojoType="dojox.wire.ml.ActionFilter"
required="dojox.wire.ml.tests.markup.Action.value"
requiredValue="executeThis">
</div>
<div dojoType="dojox.wire.ml.Transfer"
source="dojox.wire.ml.tests.markup.Action.source.a"
target="dojox.wire.ml.tests.markup.Action.target.a"></div>
</div>
</body>
</html>

View File

@@ -0,0 +1,62 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>doh.robot Tooltip Mouse Quirks Test</title>
<style>
@import "../../../../util/doh/robot/robot.css";
</style>
<!-- required: dojo.js -->
<script type="text/javascript" src="../../../../dojo/dojo.js"
djConfig="isDebug: true"></script>
<!-- functions to help test -->
<!-- script type="text/javascript" src="../helpers.js"></script -->
<script type="text/javascript">
dojo.require("dojo.parser");
dojo.require("dijit.robotx");
dojo.require("dojox.mobile");
dojo.require("dojox.mobile.IconContainer");
dojo.require("doh.runner");
dojo.addOnLoad(function(){
doh.robot.initRobot("../test_iPhone-Animation.html");
doh.register("dojox.mobile.Animation mouse tests", [
{
name: "Animation mouse tests",
timeout: 40000,
runTest: function(){
var d = new doh.Deferred();
doh.robot.mouseMoveAt(dojo.query(".mblListItemAnchor", dijit.byId("dojox_mobile_ListItem_0").domNode)[0], 1000);
doh.robot.mouseClick({left: true}, 500);
doh.robot.mouseMoveAt(dojo.query(".mblArrowButtonBody", dijit.byId("dojox_mobile_Heading_1").domNode)[0], 1000);
doh.robot.mouseClick({left: true}, 500);
doh.robot.mouseMoveAt(dojo.query(".mblListItemAnchor", dijit.byId("dojox_mobile_ListItem_1").domNode)[0], 1000);
doh.robot.mouseClick({left: true}, 500);
doh.robot.mouseMoveAt(dojo.query(".mblArrowButtonBody", dijit.byId("dojox_mobile_Heading_1").domNode)[0], 1000);
doh.robot.mouseClick({left: true}, 500);
doh.robot.mouseMoveAt(dojo.query(".mblListItemAnchor", dijit.byId("dojox_mobile_ListItem_2").domNode)[0], 1000);
doh.robot.mouseClick({left: true}, 500);
doh.robot.sequence(d.getTestCallback(function(){
doh.assertEqual("Search Result", dijit.byId("dojox_mobile_Heading_1").get("label"));
}), 500);
return d;
}
}
]);
doh.run();
});
</script>
</head>
</html>

View File

@@ -0,0 +1,62 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>doh.robot Tooltip Mouse Quirks Test</title>
<style>
@import "../../../../util/doh/robot/robot.css";
</style>
<!-- required: dojo.js -->
<script type="text/javascript" src="../../../../dojo/dojo.js"
djConfig="isDebug: true"></script>
<!-- functions to help test -->
<!-- script type="text/javascript" src="../helpers.js"></script -->
<script type="text/javascript">
dojo.require("dojo.parser");
dojo.require("dijit.robotx");
dojo.require("dojox.mobile");
dojo.require("dojox.mobile.IconContainer");
dojo.require("doh.runner");
dojo.addOnLoad(function(){
doh.robot.initRobot("../test_iPhone-Animation.html");
doh.register("dojox.mobile.Animation mouse tests", [
{
name: "Animation mouse tests",
timeout: 40000,
runTest: function(){
var d = new doh.Deferred();
doh.robot.mouseMoveAt(dojo.query(".mblListItemAnchor", dijit.byId("dojox_mobile_ListItem_0").domNode)[0], 1000);
doh.robot.mouseClick({left: true}, 500);
doh.robot.mouseMoveAt(dojo.query(".mblArrowButtonBody", dijit.byId("dojox_mobile_Heading_1").domNode)[0], 1000);
doh.robot.mouseClick({left: true}, 500);
doh.robot.mouseMoveAt(dojo.query(".mblListItemAnchor", dijit.byId("dojox_mobile_ListItem_1").domNode)[0], 1000);
doh.robot.mouseClick({left: true}, 500);
doh.robot.mouseMoveAt(dojo.query(".mblArrowButtonBody", dijit.byId("dojox_mobile_Heading_1").domNode)[0], 1000);
doh.robot.mouseClick({left: true}, 500);
doh.robot.mouseMoveAt(dojo.query(".mblListItemAnchor", dijit.byId("dojox_mobile_ListItem_2").domNode)[0], 1000);
doh.robot.mouseClick({left: true}, 500);
doh.robot.sequence(d.getTestCallback(function(){
doh.assertEqual("Search Result", dijit.byId("dojox_mobile_Heading_1").get("label"));
}), 500);
return d;
}
}
]);
doh.run();
});
</script>
</head>
</html>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,187 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1"> <!-- Use Chrome Frame in IE -->
<meta name="viewport" content="width=device-width, height=device-height, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no">
<meta name="description" content="Apply animation effects to primitives such as polygons and sensors.">
<title>Cesium Demo</title>
<script type="text/javascript" src="../Sandcastle-header.js"></script>
<script data-dojo-config="async: 1, tlmSiblingOfDojo: 0" src="../../../ThirdParty/dojo-release-1.7.2-src/dojo/dojo.js"></script>
<script type="text/javascript">
require({
baseUrl : '../../..',
packages: [
{ name: 'dojo', location: 'ThirdParty/dojo-release-1.7.2-src/dojo' },
{ name: 'dijit', location: 'ThirdParty/dojo-release-1.7.2-src/dijit' },
{ name: 'dojox', location: 'ThirdParty/dojo-release-1.7.2-src/dojox' },
{ name: 'Assets', location: 'Source/Assets' },
{ name: 'Core', location: 'Source/Core' },
{ name: 'DynamicScene', location: 'Source/DynamicScene' },
{ name: 'Renderer', location: 'Source/Renderer' },
{ name: 'Scene', location: 'Source/Scene' },
{ name: 'Shaders', location: 'Source/Shaders' },
{ name: 'ThirdParty', location: 'Source/ThirdParty' },
{ name: 'Widgets', location: 'Source/Widgets' },
{ name: 'Workers', location: 'Source/Workers' }
]
});
</script>
<link rel="Stylesheet" href="../../../ThirdParty/dojo-release-1.7.2-src/dijit/themes/claro/claro.css" type="text/css">
<link rel="Stylesheet" href="../../../Source/Widgets/Dojo/CesiumViewerWidget.css" type="text/css">
</head>
<body class="claro" data-sandcastle-bucket="bucket-dojo.html" data-sandcastle-title="Cesium + Dojo">
<style>
body {
background: #000;
color: #eee;
font-family: sans-serif;
font-size: 9pt;
padding: 0;
margin: 0;
width: 100%;
height: 100%;
overflow: hidden;
}
.fullSize {
display: block;
position: absolute;
top: 0;
left: 0;
border: none;
width: 100%;
height: 100%;
}
#toolbar {
margin: 5px;
padding: 2px 5px;
position: absolute;
}
</style>
<div id="cesiumContainer" class="fullSize"></div>
<div id="toolbar">Loading...</div>
<script id="cesium_sandcastle_script">
require([
'Source/Cesium', 'Widgets/Dojo/CesiumWidget',
'dojo/on', 'dojo/dom', 'dijit/form/Button'
], function(
Cesium, CesiumWidget,
on, dom, Button)
{
"use strict";
var polygon;
var rectangularSensor;
function addAlphaAnimation(primitive, scene) {
Sandcastle.declare(addAlphaAnimation); // For highlighting in Sandcastle.
scene.getAnimations().addAlpha(primitive.material, 0.0, 0.7);
}
function addErosionAnimation(primitive, scene) {
Sandcastle.declare(addErosionAnimation); // For highlighting in Sandcastle.
scene.getAnimations().addProperty(primitive, 'erosion', 0.0, 1.0, {
duration: 1000
});
}
function addHeightAnimation(primitive, scene) {
Sandcastle.declare(addHeightAnimation); // For highlighting in Sandcastle.
scene.getAnimations().addProperty(primitive, 'height', 5000000.0, 0.0, {
duration: 1000
});
}
function addStripeAnimation(primitive, scene) {
Sandcastle.declare(addStripeAnimation); // For highlighting in Sandcastle.
scene.getAnimations().addOffsetIncrement(primitive.material);
}
function resetPolygonPropeties(polygon) {
polygon.erosion = 1.0;
polygon.height = 0.0;
polygon.material.uniforms.color = new Cesium.Color(1.0, 0.0, 0.0, 0.5);
}
function createPrimitives(widget) {
var ellipsoid = widget.ellipsoid;
var scene = widget.scene;
var primitives = scene.getPrimitives();
polygon = new Cesium.Polygon();
polygon.configureExtent(new Cesium.Extent(
Cesium.Math.toRadians(-120.0),
Cesium.Math.toRadians(20.0),
Cesium.Math.toRadians(-80.0),
Cesium.Math.toRadians(50.0)));
polygon.material = new Cesium.Material.fromType(scene.getContext(), 'Color');
primitives.add(polygon);
var modelMatrix = Cesium.Transforms.northEastDownToFixedFrame(ellipsoid.cartographicToCartesian(Cesium.Cartographic.fromDegrees(-45.0, 45.0)));
modelMatrix = modelMatrix.multiply(Cesium.Matrix4.fromTranslation(new Cesium.Cartesian3(200000.0, 0.0, -3000000.0)));
var material = Cesium.Material.fromType(scene.getContext(), 'Stripe'); // Use default colors
material.uniforms.repeat = 10;
var sensors = new Cesium.SensorVolumeCollection(undefined);
rectangularSensor = sensors.addRectangularPyramid({
modelMatrix : modelMatrix,
radius : 10000000.0,
xHalfAngle : Cesium.Math.toRadians(30.0),
yHalfAngle : Cesium.Math.toRadians(20.0),
material : material
});
primitives.add(sensors);
}
function createButtons(scene) {
new Button({
label: 'Alpha Animation',
onClick: function() {
scene.getAnimations().removeAll();
resetPolygonPropeties(polygon);
addAlphaAnimation(polygon, scene);
Sandcastle.highlight(addAlphaAnimation);
}
}).placeAt('toolbar');
new Button({
label: 'Erosion Animation',
onClick: function() {
scene.getAnimations().removeAll();
resetPolygonPropeties(polygon);
addErosionAnimation(polygon, scene);
Sandcastle.highlight(addErosionAnimation);
}
}).placeAt('toolbar');
new Button({
label: 'Height Animation',
onClick: function() {
scene.getAnimations().removeAll();
resetPolygonPropeties(polygon);
addHeightAnimation(polygon, scene);
Sandcastle.highlight(addHeightAnimation);
}
}).placeAt('toolbar');
new Button({
label: 'Stripe Animation',
onClick: function() {
scene.getAnimations().removeAll();
addStripeAnimation(rectangularSensor, scene);
Sandcastle.highlight(addStripeAnimation);
}
}).placeAt('toolbar');
}
var widget = new CesiumWidget();
widget.placeAt(dom.byId('cesiumContainer'));
widget.startup();
dom.byId('toolbar').innerHTML = '';
createPrimitives(widget);
createButtons(widget.scene);
});
</script>
</body>
</html>

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,110 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Area Manager - Unit Tests</title>
<style type="text/css">
.item{
border:1px solid black;
background-color:#fff;
margin:5px 2px;
}
.area{
position:absolute;
top:10px;
border:5px solid #AAA;
background-color:#DDD;
margin-left:0;
padding:0px;
}
#area1{
left:130px;
width : 300px;
height: 1250px;
}
#area2{
left:10px;
width : 100px;
height: 1250px;
}
#area3{
left:450px;
width : 200px;
height: 1250px;
}
</style>
<script type="text/javascript" src="../../../../../dojo/dojo.js" djConfig="isDebug: true, parseOnLoad: true"></script>
<script type="text/javascript">
dojo.require("doh.runner");
dojo.require("dojox.mdnd.AreaManager");
dojo.require("dojox.mdnd.dropMode.VerticalDropMode");
dojo.require("dojox.mdnd.DropIndicator");
dojo.require("dojox.mdnd.AutoScroll");
dojo.require("dojo.parser");
dojo.addOnLoad(function(){
// initialize the singleton areaManager
var mgr = dojox.mdnd.areaManager();
mgr.init();
var area1,area2,area3;
area1 = dojo.byId("area1");
area2 = dojo.byId("area2");
area3 = dojo.byId("area3");
doh.register("AreaManagerCoverPresence",
[
{
// move the item 2_1 to verify cover presence
name : "testCoverPresence",
runTest : function(t){
// get Coords of item_2_1
var item = dojo.byId("item_2_1");
var coord ={x:item.offsetLeft,y:item.offsetTop};
var size ={h:item.offsetHeight, w:item.offsetWidth};
mgr.onDragStart(item,coord,size);
// Check 2 covers presence into body
var listCover = dojo.query(".dndCover");
doh.assertEqual(2,listCover.length);
// Check cover2 presence
doh.assertEqual(1,dojo.query(".dndCover2").length);
// check covers height
var dndCover = listCover[0];
var dndCover2 = listCover[1];
//var height = (dojo.isWebKit)? document.body.scrollHeight : document.body.parentNode.scrollHeight;
doh.assertFalse(0,dndCover.offsetHeight);
doh.assertFalse(0,dndCover2.offsetHeight);
// drop the item to his initial position
mgr.onDrop(item);
}
}
]
);
doh.run();
});
</script>
</head>
<body class="tundra">
<div id="area2" class="dojoxDndArea area">
<div id="item_2_1" class="item">Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Donec ante eros, dignissim quis, facilisis nec, euismod vitae, metus. Nunc dolor sapien, euismod eget, consectetuer id, egestas ut, neque.</div>
</div>
<div id="area1" class="dojoxDndArea area"></div>
<div id="area3" class="dojoxDndArea area"></div>
</body>
</html>

View File

@@ -0,0 +1,149 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>AreaManager</title>
<script type="text/javascript" src="../../../../../dojo/dojo.js" djConfig="isDebug: true, parseOnLoad: true"></script>
<link rel="stylesheet" type="text/css" href="../../../../../dojo/resources/dojo.css" />
<link rel="stylesheet" type="text/css" href="../../../../../dijit/themes/tundra/tundra.css" />
<script type="text/javascript"><!--
dojo.require("doh.runner");
dojo.require("dojox.mdnd.AreaManager");
dojo.require("dojox.mdnd.DropIndicator");
dojo.require("dojox.mdnd.dropMode.VerticalDropMode");
dojo.declare("AreaManagerTestFixture", null, {
constructor:function(testName, test) {
this.name = testName;
this.runTest = test;
},
setUp:function() {
this.mgr = dojox.mdnd.areaManager();
this.areaA = dojo.byId("areaA");
this.areaB = dojo.byId("areaB");
this.areaC = dojo.byId("areaC");
this.itemA = createItem("itemA");
this.itemB = createItem("itemB");
this.itemC = createItem("itemC");
},
tearDown:function() {
//reinit DOM
var areas = [this.areaA,this.areaB,this.areaC];
for (var i = 0; i < areas.length; i++) {
while (areas[i].firstChild) {
dojo.destroy(areas[i].removeChild(areas[i].lastChild));
}
this.mgr.unregister(areas[i]);
}
delete this.areaA;
delete this.areaB;
delete this.areaC;
delete this.itemA;
delete this.itemB;
delete this.itemC;
}
});
function createItem(id){
return dojo.create('div',{'class':'item', 'id': id});
};
//--------------------------------------
dojo.addOnLoad(function(){
doh.register("AreaManagerManagingDragItems",
[
/*
* Default test of adding an item
*/
new AreaManagerTestFixture("addDragItem",function(){
this.mgr.registerByNode(this.areaA);
this.mgr.addDragItem(this.areaA, this.itemA);
doh.assertEqual(1, this.mgr._areaList.length, "One area should be register!");
var areaItem = this.mgr._areaList[0];
doh.assertEqual(areaItem.items.length, 1, "The register area should contain one item!");
}),
new AreaManagerTestFixture("unregisteredArea",function(){
this.mgr.addDragItem(this.areaB, this.itemA);
doh.assertEqual(0, this.mgr._areaList.length, "An item shouldn't add to an unregitered area");
}),
new AreaManagerTestFixture("addDragItemWithDomAppendedNode",function(){
this.mgr.registerByNode(this.areaB);
this.areaC.appendChild(this.itemA);
this.mgr.addDragItem(this.areaB, this.itemA);
doh.assertEqual(0, this.mgr._areaList[0].items.length, "Item shouldn't append to a node before add");
}),
new AreaManagerTestFixture("addDragItemWithInsideAreaNode",function(){
this.mgr.registerByNode(this.areaC);
this.areaC.appendChild(this.itemA);
this.mgr.addDragItem(this.areaC, this.itemA);
var areaItem = this.mgr._areaList[0];
doh.assertTrue(1, areaItem.items.length);
}),
new AreaManagerTestFixture("addDragItemWithNegativeIndex",function(){
this.mgr.registerByNode(this.areaA);
this.mgr.addDragItem(this.areaA, this.itemA, -1);
var areaItem = this.mgr._areaList[0];
doh.assertEqual(1, areaItem.items.length);
}),
new AreaManagerTestFixture("addDragItemWithOutsideIndex",function(){
this.mgr.registerByNode(this.areaB);
this.mgr.addDragItem(this.areaB, this.itemA);
this.mgr.addDragItem(this.areaB, this.itemB, 100);
var areaItem = this.mgr._areaList[0];
doh.assertEqual(2, areaItem.items.length);
}),
/*
* Default test of removing an item
*/
new AreaManagerTestFixture("removeDragItem",function(){
this.mgr.registerByNode(this.areaA);
this.mgr.addDragItem(this.areaA, this.itemA);
doh.assertEqual(1, this.mgr._areaList[0].items.length);
this.mgr.removeDragItem(this.areaA, this.itemA);
var areaItem = this.mgr._areaList[0];
doh.assertEqual(0, this.mgr._areaList[0].items.length);
}),
new AreaManagerTestFixture("removeWrongDragItem",function(){
this.mgr.registerByNode(this.areaA);
this.mgr.registerByNode(this.areaB);
this.mgr.addDragItem(this.areaA, this.itemA);
this.mgr.removeDragItem(this.areaB, this.itemA);
doh.assertEqual(1, this.mgr._areaList[0].items.length);
doh.assertEqual(0, this.mgr._areaList[1].items.length);
})
]
);
doh.run();
});
//--------------------------------------
--></script>
</head>
<body class="tundra">
<div class="area" id="areaA"></div>
<div class="area" id="areaB"></div>
<div class="area" id="areaC"></div>
</body>
</html>

View File

@@ -0,0 +1,124 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>AreaManager</title>
<script type="text/javascript" src="../../../../../dojo/dojo.js" djConfig="isDebug: true, parseOnLoad: true"></script>
<script type="text/javascript">
dojo.require("doh.runner");
dojo.require("dojo.parser");
dojo.require("dojox.mdnd.AreaManager");
dojo.require("dojox.mdnd.DropIndicator");
dojo.require("dojox.mdnd.dropMode.VerticalDropMode");
dojo.declare("AreaManagerTestFixture", null, {
constructor:function(testName, test) {
this.name = testName;
this.runTest = test;
},
setUp:function() {
this.mgr = new dojox.mdnd.AreaManager();
this.mgr._dropMode = new dojox.mdnd.dropMode.VerticalDropMode(this.mgr);
this.mgr._dropIndicator = new dojox.mdnd.DropIndicator();
this.area1 = dojo.byId("area1");
this.area2 = dojo.byId("area2");
this.area3 = dojo.byId("area3");
},
tearDown:function() {
delete this.mgr;
delete this.area1;
delete this.area2;
delete this.area3;
}
});
//--------------------------------------
dojo.addOnLoad(function(){
doh.register("AreaManagerRegistering",
[
new AreaManagerTestFixture("registerByNodeNull",function(){
this.mgr.registerByNode(null);
doh.assertEqual(0, this.mgr._areaList.length, 'No area should be register.');
}),
new AreaManagerTestFixture("registerByNodeArea",function(){
this.mgr.registerByNode(this.area2);
this.mgr.registerByNode(this.area1);
doh.assertEqual(2, this.mgr._areaList.length, 'Two areas should be register.');
doh.assertEqual(this.area1, this.mgr._areaList[0].node);
doh.assertEqual(this.area2, this.mgr._areaList[1].node);
}),
new AreaManagerTestFixture("unregisterArea",function(){
this.mgr.registerByNode(this.area1);
this.mgr.unregister(this.area1);
doh.assertEqual(0, this.mgr._areaList.length, 'Area1 should be unregister.');
}),
new AreaManagerTestFixture("registerByNodeRegisteredArea",function(){
this.mgr.registerByNode(this.area2);
this.mgr.registerByNode(this.area2);
doh.assertEqual(1, this.mgr._areaList.length, 'One area should be register.');
doh.assertEqual(this.area2, this.mgr._areaList[0].node, 'Area1 should be register once.');
}),
new AreaManagerTestFixture("registerByNodeAreaWithChildren",function(){
this.mgr.registerByNode(this.area3);
doh.assertEqual(this.area3, this.mgr._areaList[0].node, 'Area3 should be register.');
var areaItem = this.mgr._areaList[0];
doh.assertEqual(1, areaItem.items.length, 'One item should be register.');
}),
new AreaManagerTestFixture("registerByClassArea",function(){
this.mgr.registerByClass();
doh.assertEqual(2, this.mgr._areaList.length, '2 area should be register.');
}),
new AreaManagerTestFixture("registerByClassRegisteredArea",function(){
this.mgr.registerByClass();
this.mgr.registerByNode(this.area1);
doh.assertEqual(2, this.mgr._areaList.length);
})
]
);
doh.run();
});
//--------------------------------------
</script>
<style type="text/css">
.area{
position:absolute;
top:10px;
border:5px solid #AAA;
background-color:#DDD;
margin-left:0;
padding:0px;
height: 400px;
}
#area1{
left:10px;
width : 300px;
}
#area2{
left:330px;
width : 100px;
}
#area3{
left:450px;
width : 200px;
}
</style>
</head>
<body class="tundra">
<div id="area2" class="dojoxDndArea area"></div>
<div id="area1" class="dojoxDndArea area"></div>
<div id="area3" class="area">
<div class="item">
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Donec ante eros, dignissim quis, facilisis nec, euismod vitae, metus. Nunc dolor sapien, euismod eget, consectetuer id, egestas ut, neque.
</div>
</div>
</body>
</html>

View File

@@ -0,0 +1,286 @@
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,minimum-scale=1,user-scalable=no"/>
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<title>_AutoCompleterMixin tests</title>
<style type="text/css">
@import "../../themes/claro/document.css";
@import "../../themes/dijit.css";
@import "../../themes/claro/claro.css";
@import "../../../dojox/mobile/themes/iphone/TextBox.css";
@import "../../../dojox/mobile/themes/iphone/ComboBox.css";
#table {
margin: 0;
padding: 2px;
}
#table .layout {
padding: 2px;
font-size: 100%;
margin: 0;
}
</style>
<script type="text/javascript" src="../../../dojo/dojo.js"
data-dojo-config="parseOnLoad: true, isDebug: true"></script>
<script type="text/javascript">
dojo.require("doh.runner");
dojo.require("dijit.dijit"); // optimize: load dijit layer
dojo.require("dijit.form.DataList");
dojo.require("dijit.form.ComboBox");
dojo.require("dojox.mobile.ComboBox");
dojo.ready(function(){
doh.register("attributes", [
{
name: "dijit",
runTest: function(){
var dijit_attributes = dijit.byId('dijit_attributes');
doh.is("", dijit_attributes.textbox.value, "dijit original value");
doh.is("", dijit_attributes.get('value'), "dijit original get('value')");
doh.is(Infinity, dijit_attributes.get('pageSize'), "dijit original get('pageSize')");
dijit_attributes.set('pageSize', 9);
dijit_attributes.set('value', "test");
doh.is("test", dijit_attributes.textbox.value, "dijit value");
doh.is("test", dijit_attributes.get('value'), "dijit get('value')");
doh.is(9, dijit_attributes.get('pageSize'), "dijit get('pageSize')");
}
},
{
name: "mobile",
runTest: function(){
var mobile_attributes = dijit.byId('mobile_attributes');
doh.is("", mobile_attributes.textbox.value, "mobile original value");
doh.is("", mobile_attributes.get('value'), "mobile original get('value')");
doh.is(Infinity, mobile_attributes.get('pageSize'), "mobile original get('pageSize')");
mobile_attributes.set('pageSize', 9);
mobile_attributes.set('value', "test");
doh.is("test", mobile_attributes.textbox.value, "mobile value");
doh.is("test", mobile_attributes.get('value'), "mobile get('value')");
doh.is(9, mobile_attributes.get('pageSize'), "mobile get('pageSize')");
}
}
]);
doh.register("events", [
{
name: "dijit",
timeout: 2000,
runTest: function(){
var
d = new doh.Deferred(),
dijit_events = dijit.byId('dijit_events'),
nop = function(){ return false; };
function onFocus(){
dijit_events.set('onFocus', nop);
dijit_events.set('displayedValue', "Focus");
dijit_events.set('onChange', onChange);
dijit_events.set('onBlur', onBlur);
dijit.byId('mobile_events').focus();
}
function onBlur(){
dijit_events.set('onBlur', nop);
dijit_events.set('displayedValue', dijit_events.get('displayedValue')+"Blur");
}
function onChange(){
dijit_events.set('onChange', nop);
dijit_events.set('displayedValue', dijit_events.get('displayedValue')+"Change");
dijit_events.focus();
d.getTestCallback(function(){
doh.is("FocusBlurChange", dijit_events.textbox.value);
})();
}
doh.is(nop.toString(), dijit_events.get('onFocus').toString(), "get('onFocus')");
doh.is(nop.toString(), dijit_events.get('onBlur').toString(), "get('onBlur')");
doh.is(nop.toString(), dijit_events.get('onChange').toString(), "get('onChange')");
dijit_events.set('onFocus', onFocus);
setTimeout(dojo.hitch(dijit_events, "focus"), 0);
return d;
}
},
{
name: "mobile",
timeout: 2000,
runTest: function(){
var
d = new doh.Deferred(),
mobile_events = dijit.byId('mobile_events'),
focusHandle, blurhandle,
nop = function(){ return false; };
function onFocus(){
mobile_events.disconnect(focusHandle);
mobile_events.set('displayedValue', "Focus");
mobile_events.set('onChange', onChange);
blurhandle = mobile_events.connect(mobile_events.textbox, 'onblur', onBlur);
dijit.byId('dijit_events').focus();
}
function onBlur(){
mobile_events.disconnect(blurhandle);
mobile_events.set('displayedValue', mobile_events.get('displayedValue')+"Blur");
}
function onChange(){
mobile_events.set('onChange', nop);
mobile_events.set('displayedValue', mobile_events.get('displayedValue')+"Change");
mobile_events.focus();
d.getTestCallback(function(){
doh.is("FocusBlurChange", mobile_events.textbox.value);
})();
}
doh.is(nop.toString(), mobile_events.get('onChange').toString(), "get('onChange')");
focusHandle = mobile_events.connect(mobile_events.textbox, 'onfocus', onFocus);
setTimeout(dojo.hitch(mobile_events, "focus"), 0);
return d;
}
}
]);
doh.register("programmatic", [
{
name: "dijit",
timeout: 2000,
runTest: function(){
new dijit.form.ComboBox({id:"dijit_programmatic", list:"states"}).placeAt("dijit_programmatic_container", "first");
var dijit_programmatic = dijit.byId('dijit_programmatic');
var focushandle = dijit_programmatic.connect(dijit_programmatic, '_onFocus',
function(){
d.getTestCallback(function(){
dijit_programmatic.disconnect(focushandle);
var pos = dojo.position(dijit_programmatic.domNode, true);
doh.t(pos.w > 0 && pos.h > 0 && pos.x > 0 && pos.y > 0, 'dijit position');
doh.is("Alabama", dijit_programmatic.textbox.value, 'dijit textbox value');
doh.is("Alabama", dijit_programmatic.get('value'), 'dijit widget value');
})();
}
);
var d = new doh.Deferred();
setTimeout(dojo.hitch(dijit_programmatic, "focus"), 0);
return d;
}
},
{
name: "mobile",
timeout: 2000,
runTest: function(){
new dojox.mobile.ComboBox({id:"mobile_programmatic", list:"states"}).placeAt("mobile_programmatic_container", "first");
var mobile_programmatic = dijit.byId('mobile_programmatic');
var focushandle = mobile_programmatic.connect(mobile_programmatic.textbox, 'onfocus',
function(){
d.getTestCallback(function(){
mobile_programmatic.disconnect(focushandle);
var pos = dojo.position(mobile_programmatic.domNode, true);
doh.t(pos.w > 0 && pos.h > 0 && pos.x > 0 && pos.y > 0, 'mobile position');
doh.is("Alabama", mobile_programmatic.textbox.value, 'mobile textbox value');
doh.is("Alabama", mobile_programmatic.get('value'), 'mobile widget value');
})();
}
);
var d = new doh.Deferred();
setTimeout(dojo.hitch(mobile_programmatic, "focus"), 0);
return d;
}
}
]);
doh.run();
});
</script>
</head>
<body class="claro">
<h1 class="testTitle">_AutoCompleterMixin (dijit and mobile) non-robot tests</h1>
<datalist id="states">
<select data-dojo-type="dijit.form.DataList" data-dojo-props='id:"states"' >
<option value="AL">Alabama</option>
<option value="AK">Alaska</option>
<option value="AS">American Samoa</option>
<option value="AZ">Arizona</option>
<option value="AR">Arkansas</option>
<option value="AE">Armed Forces Europe</option>
<option value="AP">Armed Forces Pacific</option>
<option value="AA">Armed Forces the Americas</option>
<option value="CA">California</option>
<option value="CO">Colorado</option>
<option value="CT">Connecticut</option>
<option value="DE">Delaware</option>
<option value="DC">District of Columbia</option>
<option value="FM">Federated States of Micronesia</option>
<option value="FL">Florida</option>
<option value="GA">Georgia</option>
<option value="GU">Guam</option>
<option value="HI">Hawaii</option>
<option value="ID">Idaho</option>
<option value="IL">Illinois</option>
<option value="IN">Indiana</option>
<option value="IA">Iowa</option>
<option value="KS">Kansas</option>
<option value="KY">Kentucky</option>
<option value="LA">Louisiana</option>
<option value="ME">Maine</option>
<option value="MH">Marshall Islands</option>
<option value="MD">Maryland</option>
<option value="MA">Massachusetts</option>
<option value="MI">Michigan</option>
<option value="MN">Minnesota</option>
<option value="MS">Mississippi</option>
<option value="MO">Missouri</option>
<option value="MT">Montana</option>
<option value="NE">Nebraska</option>
<option value="NV">Nevada</option>
<option value="NH">New Hampshire</option>
<option value="NJ">New Jersey</option>
<option value="NM">New Mexico</option>
<option value="NY">New York</option>
<option value="NC">North Carolina</option>
<option value="ND">North Dakota</option>
<option value="MP">Northern Mariana Islands</option>
<option value="OH">Ohio</option>
<option value="OK">Oklahoma</option>
<option value="OR">Oregon</option>
<option value="PA">Pennsylvania</option>
<option value="PR">Puerto Rico</option>
<option value="RI">Rhode Island</option>
<option value="SC">South Carolina</option>
<option value="SD">South Dakota</option>
<option value="TN">Tennessee</option>
<option value="TX">Texas</option>
<option value="UT">Utah</option>
<option value="VT">Vermont</option>
<option value="VI">Virgin Islands, U.S.</option>
<option value="VA">Virginia</option>
<option value="WA">Washington</option>
<option value="WV">West Virginia</option>
<option value="WI">Wisconsin</option>
<option value="WY">Wyoming</option>
</select>
</datalist>
<table id="table">
<tr>
<th class="layout">&nbsp;</th>
<th class="layout">dijit</th>
<th class="layout">mobile</th>
</tr>
<tr>
<td class="layout">attributes</td>
<td class="layout"><input id="dijit_attributes" data-dojo-type="dijit.form.ComboBox" data-dojo-props='value:"", list:"states"'/></td>
<td class="layout"><input id="mobile_attributes" data-dojo-type="dojox.mobile.ComboBox" data-dojo-props='value:"", list:"states"'></td>
</tr>
<tr>
<td class="layout">Events</td>
<td class="layout"><input id="dijit_events" data-dojo-type="dijit.form.ComboBox" data-dojo-props='value:"", list:"states", onFocus:function(){ return false; }, onBlur:function(){ return false; }, onChange:function(){ return false; }'/></td>
<td class="layout"><input id="mobile_events" data-dojo-type="dojox.mobile.ComboBox" data-dojo-props='value:"", list:"states", onChange:function(){ return false; }'></td>
</tr>
<tr>
<td class="layout">Programmatic</td>
<td class="layout" id="dijit_programmatic_container"></td>
<td class="layout" id="mobile_programmatic_container"></td>
</tr>
</table>
</body>
</html>

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,130 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>doh.robot Editor/Back Button Restore Test</title>
<style>
@import "../../../../util/doh/robot/robot.css";
</style>
<!-- required: dojo.js -->
<script type="text/javascript" src="../../../../dojo/dojo.js"></script>
<!-- functions to help test -->
<script type="text/javascript" src="../../helpers.js"></script>
<script type="text/javascript">
dojo.require("dojo.DeferredList");
dojo.require("dijit.robotx");
// This page tests that the editor's value won't be lost if the user
// accidentlly navigates to a different page, and then returns to the
// page w/the editor by pressing the back button.
dojo.ready(function(){
doh.robot.initRobot('../BackForwardState.html');
doh.register("back button restore", [
{
name: "wait for editors to load",
timeout: 5000,
runTest: function(){
return new dojo.DeferredList(
dijit.registry.filter(function(w){ return w.onLoadDeferred; }).map(function(w){return w.onLoadDeferred;})
);
}
},
{
name: "set editor value",
timeout: 10000,
runTest: function(){
var d = new doh.Deferred();
var editor0 = dijit.byId("editor0"),
editor1 = dijit.byId("editor1");
doh.is("editor0 original contents", editor0.get('value'));
doh.is("editor1 original contents", editor1.get('value'));
editor0.set('value', 'hello');
editor1.set('value', 'goodbye');
doh.robot.sequence(d.getTestCallback(function(){
doh.is("hello", editor0.get('value'));
doh.is("goodbye", editor1.get('value'));
}), 500);
return d;
}
},
{
name: "navigate away",
timeout: 10000,
runTest: function(){
return doh.robot.waitForPageToLoad(function(){
// On most browsers just focusing causes navigation. On safari
// need to click...
var away = dojo.byId("away");
dojo.byId("away").focus();
doh.robot.keyPress(dojo.keys.ENTER, 500);
});
}
},
{
name: "confirm navigation to new page worked",
runTest: function(){
// Confirm that we successfully navigated away
doh.is("Back/forward test helper page", (dojo.query("h1")[0]||{}).innerHTML);
}
},
{
name: "go back to original page",
timeout: 10000,
runTest: function(){
return doh.robot.waitForPageToLoad(function(){
// On most browsers just focusing causes navigation. On safari
// need to click...
var back = dojo.byId("back");
back.focus();
doh.robot.keyPress(dojo.keys.ENTER, 500);
});
}
},
{
name: "wait for editors to load again",
timeout: 5000,
runTest: function(){
return new dojo.DeferredList(
dijit.registry.filter(function(w){ return w.onLoadDeferred; }).map(function(w){return w.onLoadDeferred;})
);
}
},
{
name: "check that editor values restored",
timeout: 10000,
runTest: function(){
var d = new doh.Deferred();
doh.robot.sequence(d.getTestCallback(function(){
var editor0 = dijit.byId("editor0"),
editor1 = dijit.byId("editor1");
doh.t(editor0, "editor0 found");
doh.is("hello", editor0.get('value'));
doh.t(editor1, "editor1 found");
doh.is("goodbye", editor1.get('value'));
}), 500);
return d;
}
}
]);
doh.run();
});
</script>
</head>
</html>

View File

@@ -0,0 +1,11 @@
<h1>Back/forward test helper page</h1>
<p>
You've navigated to this page from <a href="BackForwardState.html">backForward.html</a>.
Press the "Go back" link below to return, or your browser's back button,
and check that the editors' values were restored to the test data you entered.
</p>
<p>
Note that pressing the link above will not work, since the browser doesn't consider it
as "returning" to the previous page.
</p>
<a href="javascript:history.go(-1)" id="back">Go Back</a>

View File

@@ -0,0 +1,141 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>doh.robot bgIframe Test</title>
<style>
@import "../../../util/doh/robot/robot.css";
</style>
<!-- required: dojo.js -->
<script type="text/javascript" src="../../../dojo/dojo.js"></script>
<script type="text/javascript" src="../helpers.js"></script>
<script type="text/javascript">
dojo.require("dijit.robotx");
dojo.ready(function(){
doh.robot.initRobot('../test_bgIframe.html');
dojo.forEach(["applet", "xapp"], function(xId){
doh.register(xId, [
{
name: "dialog_" + xId,
timeout: 15000,
runTest: function(){
if(dojo.isWebKit){ return; } // TODO: Remove skip-test for non-WebKit after #11822 is fixed
var d = new doh.Deferred();
var wasClicked = false;
var connection;
//Show the dialog
doh.robot.mouseMoveAt("showDialog", 500, 1);
doh.robot.mouseClick({left:true}, 500);
//drag the dialog on top of the applet
doh.robot.mouseMoveAt(dijit.byId("dialog").titleNode, 2000, 1);
doh.robot.mousePress({left:true}, 500);
doh.robot.mouseMoveAt(xId, 500, 1000);
doh.robot.mouseRelease({left:true}, 500);
doh.robot.sequence(function(){
connection = dojo.connect(dijit.byId("dialog").containerNode, "onclick", function(e){ wasClicked = true; });
}, 500);
//Click on the dialog
doh.robot.mouseMoveAt(dijit.byId("dialog").containerNode, 1, 1);
doh.robot.mouseClick({left:true}, 500);
doh.robot.sequence(d.getTestCallback(function(){
dojo.disconnect(connection);
//verify the native select did not disappear
doh.t(isVisible(dojo.byId("dropDown_" + xId)), "The native select is not visible");
dijit.byId("dialog").hide();
doh.t(wasClicked, "Dialog was not visible because the onclick did not fire.");
}), 1000);
return d;
}
},
{
name: "tooltip_" + xId,
timeout: 8000,
runTest: function(){
if(!dojo.isIE){ return; } // TODO: Remove skip-test for non-IE after #11822 is fixed
var d = new doh.Deferred();
var tooltipWasClicked = false;
var connection, oldHide;
//Show the tooltip
doh.robot.mouseMoveAt("two_" + xId, 500, 1);
doh.robot.sequence(function(){
var tooltip = dijit.byId("dijit__MasterTooltip_0");
oldHide = tooltip.hide;
tooltip.hide = function(aroundNode){
//don't allow the tooltip to be hidden
};
connection = dojo.connect(tooltip.domNode, "onclick",
function(e){
tooltipWasClicked = true;
tooltip.hide = oldHide;
tooltip.hide(tooltip.aroundNode);
}
);
}, 2000);
//Click on the tooltip
doh.robot.mouseMoveAt("dijit__MasterTooltip_0", 1, 1);
doh.robot.mouseClick({left:true}, 500);
doh.robot.sequence(d.getTestCallback(function(){
dojo.disconnect(connection);
doh.t(tooltipWasClicked, "The tooltip is not visible because the onclick event was not fired.");
}), 1000);
return d;
}
},
{
name: "dateTextBox_" + xId,
timeout: 7000,
runTest: function(){
if(!dojo.isIE){ return; } // TODO: Remove skip-test for non-IE after #11822 is fixed
var d = new doh.Deferred();
var wasClicked = false;
var connection;
//Show the popup
doh.robot.mouseMoveAt("dateText_" + xId, 500, 1);
doh.robot.mouseClick({left:true}, 500);
doh.robot.sequence(function(){
connection = dojo.connect(dijit.byId("dateText_"+xId+"_popup").domNode, "onclick", function(e){ wasClicked = true; });
}, 2000);
//Click on the popup
doh.robot.mouseMoveAt("dateText_"+xId+"_popup", 1, 1, 10, 10);
doh.robot.mouseClick({left:true}, 500);
doh.robot.sequence(d.getTestCallback(function(){
dojo.disconnect(connection);
doh.t(wasClicked);
}), 1000);
return d;
}
}
]);
});
doh.run();
});
</script>
</head>
</html>

374
master/examples/Bidi.html Normal file
View File

@@ -0,0 +1,374 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>Multi-directional document test</title>
<style type="text/css">
@import "../themes/claro/document.css";
@import "css/dijitTests.css";
</style>
<!-- required: a default dijit theme: -->
<link id="themeStyles" rel="stylesheet" href="../../dijit/themes/claro/claro.css"/>
<!-- required: dojo.js -->
<script type="text/javascript" src="../../dojo/dojo.js"
data-dojo-config="extraLocale: ['en','ar','he'], isDebug: true"></script>
<!-- not needed, for testing alternate themes -->
<script type="text/javascript" src="_testCommon.js"></script>
<script type="text/javascript">
dojo.require("dojo.data.ItemFileReadStore");
dojo.require("dijit.dijit"); // optimize: load dijit layer
dojo.require("dijit.Tree");
dojo.require("dijit.tree.ForestStoreModel");
dojo.require("dijit.Menu");
dojo.require("dijit.MenuItem");
dojo.require("dijit.PopupMenuItem");
dojo.require("dijit.form.Button");
dojo.require("dijit.form.DropDownButton");
dojo.require("dijit.form.ComboButton");
dojo.require("dijit.form.ToggleButton");
dojo.require("dijit.ColorPalette");
dojo.require("dijit.Toolbar");
dojo.require("dijit.TooltipDialog");
dojo.require("dijit.form.TextBox");
dojo.require("dijit.form.DateTextBox");
dojo.require("dijit.form.NumberSpinner");
dojo.require("dijit.form.ComboBox");
dojo.require("dijit.layout.TabContainer");
dojo.require("dijit.layout.ContentPane");
dojo.require("dojo.parser");
dojo.require("doh.runner");
function checkLeft(/*Widget*/ left, /*Widget*/ right){
if(left.domNode) left = left.domNode;
if(right.domNode) right = right.domNode;
var lp = dojo.position(left, true),
rp = dojo.position(right, true);
doh.t(lp.x+lp.w-0.1 <= rp.x,
left.id + " to left of " + right.id + dojo.toJson(lp) + dojo.toJson(rp)
);
}
dojo.ready(function(){
doh.register("parse", function(){
dojo.parser.parse();
});
doh.register("Test bidi toolbar", [
{
name: "toolbar checkLeft",
runTest: function(){
//Check that the order of the menu buttons is correct
checkLeft(dijit.byId("ltr_ToolbarCutButton"), dijit.byId("ltr_ToolbarDropDown"));
checkLeft(dijit.byId("ltr_ToolbarDropDown"), dijit.byId("ltr_ToolbarColorDropDown"));
checkLeft(dijit.byId("ltr_ToolbarColorDropDown"), dijit.byId("ltr_ToolbarComboButton"));
checkLeft(dijit.byId("rtl_ToolbarComboButton"), dijit.byId("rtl_ToolbarColorDropDown"));
checkLeft(dijit.byId("rtl_ToolbarColorDropDown"), dijit.byId("rtl_ToolbarDropDown"));
checkLeft(dijit.byId("rtl_ToolbarDropDown"), dijit.byId("rtl_ToolbarCutButton"));
}
},
{
name: "ltr_ToolbarDropDown",
runTest: function(){
dijit.byId("ltr_ToolbarDropDown").openDropDown();
checkLeft(dojo.byId("ltr_l1"), dijit.byId("ltr_i1"));
checkLeft(dojo.byId("ltr_l2"), dijit.byId("ltr_i2"));
checkLeft(dojo.byId("ltr_l3"), dijit.byId("ltr_i3"));
doh.is("ltr", dojo.byId("widget_ltr_i1").dir);
doh.is("ltr", dojo.byId("widget_ltr_i2").dir);
doh.is("ltr", dojo.byId("widget_ltr_i3").dir);
doh.is("ltr", dijit.byId("ltr_button").dir);
}
},
{
name: "rtl_ToolbarDropDown",
runTest: function(){
dijit.byId("rtl_ToolbarDropDown").openDropDown();
checkLeft(dijit.byId("rtl_i1"), dojo.byId("rtl_l1"));
checkLeft(dijit.byId("rtl_i2"), dojo.byId("rtl_l2"));
checkLeft(dijit.byId("rtl_i3"), dojo.byId("rtl_l3"));
doh.is("rtl", dojo.byId("widget_rtl_i1").dir);
doh.is("rtl", dojo.byId("widget_rtl_i2").dir);
doh.is("rtl", dojo.byId("widget_rtl_i3").dir);
doh.is("rtl", dijit.byId("rtl_button").dir);
}
},
{
name: "ltr_ToolbarColorDropDown",
runTest: function(){
dijit.byId("ltr_ToolbarColorDropDown").openDropDown();
var white = dojo.query("img[alt='white']", dojo.byId("ltr_colorPalette"))[0];
var plum = dojo.query("img[alt='plum']", dojo.byId("ltr_colorPalette"))[0];
checkLeft(white, plum);
}
},
{
name: "rtl_ToolbarColorDropDown",
runTest: function(){
dijit.byId("rtl_ToolbarColorDropDown").openDropDown();
var white = dojo.query("img[alt='white']", dojo.byId("rtl_colorPalette"))[0];
var plum = dojo.query("img[alt='plum']", dojo.byId("rtl_colorPalette"))[0];
checkLeft(plum, white);
}
},
{
name: "ltr_ToolbarMenuDropDown",
runTest: function(){
dijit.byId("ltr_ToolbarComboButton").openDropDown();
var icon = dijit.byId("ltr_mi1").iconNode;
var label = dijit.byId("ltr_mi1").containerNode;
checkLeft(icon, label);
}
},
{
name: "ltr_Toolbar_nested_menu",
runTest: function(){
dijit.byId("ltr_popup_mi1")._onClick({preventDefault: function(){}, stopPropagation: function(){}});
var icon = dijit.byId("ltr_popup_mi1").iconNode;
var label = dijit.byId("ltr_popup_mi1").containerNode;
checkLeft(icon, label);
}
},
{
name: "rtl_ToolbarMenuDropDown",
runTest: function(){
dijit.byId("rtl_ToolbarComboButton").openDropDown();
var icon = dijit.byId("rtl_mi1").iconNode;
var label = dijit.byId("rtl_mi1").containerNode;
checkLeft(label, icon);
}
},
{
name: "rtl_Toolbar_nested_menu",
runTest: function(){
dijit.byId("rtl_popup_mi1")._onClick({preventDefault: function(){}, stopPropagation: function(){}});
var icon = dijit.byId("rtl_popup_mi1").iconNode;
var label = dijit.byId("rtl_popup_mi1").containerNode;
checkLeft(label, icon);
}
}
]);
doh.register("Test bidi tab container", [
{
name: "ltr TabContainer",
runTest: function(){
// Check that the order of the tabs is correct
checkLeft(dijit.byId("ltr_tc_tablist_ltr_tc_cp"), dijit.byId("ltr_tc_tablist_ltr_tc_tree"));
// Check the fields on each of the first tabs
doh.is("ltr", dijit.byId("ltr_tc_cp").dir);
var combo = dojo.query("input[value='dijit']", dojo.byId("ltr_tc_cp"))[0];
var arrow = dojo.query(".dijitButtonNode", dojo.byId("ltr_tc_cp"))[0];
checkLeft(combo, arrow);
}
},
{
name: "rtl TabContainer",
runTest: function(){
// Check that the order of the tabs is correct
checkLeft(dijit.byId("rtl_tc_tablist_rtl_tc_tree"), dijit.byId("rtl_tc_tablist_rtl_tc_cp"));
// Check the fields on each of the first tabs
doh.is("rtl", dijit.byId("rtl_tc_cp").dir);
combo = dojo.query("input[value='dijit']", dojo.byId("rtl_tc_cp"))[0];
arrow = dojo.query(".dijitButtonNode", dojo.byId("rtl_tc_cp"))[0];
checkLeft(arrow, combo);
}
}
]);
doh.register("Tree", [
{
name: "ltr_tree",
runTest: function(){
dijit.byId("ltr_tc").selectChild("ltr_tc_tree");
var rowNodes = dojo.query(".dijitTreeRow", dojo.byId("ltr_tc_tree"));
dojo.forEach(rowNodes, function(rowNode){
var expando = dojo.query(".dijitTreeExpando", rowNode)[0];
var label = dojo.query(".dijitTreeContent", rowNode)[0];
checkLeft(expando, label);
});
}
},
{
name: "rtl_tree",
runTest: function(){
dijit.byId("rtl_tc").selectChild("rtl_tc_tree");
var rowNodes = dojo.query(".dijitTreeRow", dojo.byId("rtl_tc_tree"));
dojo.forEach(rowNodes, function(rowNode){
var expando = dojo.query(".dijitTreeExpando", rowNode)[0];
var label = dojo.query(".dijitTreeContent", rowNode)[0];
checkLeft(label, expando);
});
}
}
]);
doh.run();
});
</script>
</head>
<body class="claro">
<h1 class="testTitle">Multi-directional document test</h1>
<div data-dojo-id="continentStore" data-dojo-type="dojo.data.ItemFileReadStore" data-dojo-props='url:"_data/countries.json"'></div>
<div data-dojo-id="continentModel" data-dojo-type="dijit.tree.ForestStoreModel" data-dojo-props='store:continentStore, query:{type:"continent"},
rootId:"continentRoot", rootLabel:"Continents", childrenAttrs:["children"]'></div>
<div id="right" dir="rtl" lang="ar-eg" style="float: right; width: 500px;">
<h2>RTL</h2>
<div data-dojo-type="dijit.Toolbar"
><div id="rtl_ToolbarCutButton" data-dojo-type="dijit.form.Button" data-dojo-props='iconClass:"dijitEditorIcon dijitEditorIconCut", showLabel:false'>Cut</div
><div id="rtl_ToolbarDropDown" data-dojo-type="dijit.form.DropDownButton" data-dojo-props='iconClass:"plusIcon", showLabel:true'>
<span>שיח</span>
<div data-dojo-type="dijit.TooltipDialog" data-dojo-props='title:"Enter Login information"'>
<table>
<tr>
<td><label id="rtl_l1">שם:</label></td>
<td><input id="rtl_i1" data-dojo-type="dijit.form.TextBox"/></td>
</tr>
<tr>
<td><label id="rtl_l2">תאריך:</label></td>
<td><input id="rtl_i2" data-dojo-type="dijit.form.DateTextBox"/></td>
</tr>
<tr>
<td><label id="rtl_l3">גיל:</label></td>
<td><input id="rtl_i3" data-dojo-type="dijit.form.NumberSpinner"/></td>
</tr>
<tr>
<td colspan="2" style="text-align:center;">
<button id="rtl_button" data-dojo-type="dijit.form.Button" data-dojo-props='type:"submit", name:"submit"'>כניסה</button>
</td>
</tr>
</table>
</div
></div
><div id="rtl_ToolbarColorDropDown" data-dojo-type="dijit.form.DropDownButton" data-dojo-props='iconClass:"dijitEditorIcon dijitEditorIconBackColor", showLabel:true'>
<span>لوحة الألوان</span>
<div id="rtl_colorPalette" data-dojo-type="dijit.ColorPalette" data-dojo-props='style:"display:none;", palette:"7x10", onChange:function(){ console.log(this.value); }'></div>
</div
><div id="rtl_ToolbarComboButton" data-dojo-type="dijit.form.ComboButton" data-dojo-props='optionsTitle:"save options", iconClass:"plusIcon", showLabel:true'>
<span>القائمة</span>
<div data-dojo-type="dijit.Menu" data-dojo-props='style:"display:none;"'>
<div id="rtl_mi1" data-dojo-type="dijit.MenuItem" data-dojo-props='iconClass:"dijitEditorIcon dijitEditorIconSave"'>حفظ</div>
<div data-dojo-type="dijit.MenuItem">حفظ ك</div>
<div id="rtl_popup_mi1" data-dojo-type="dijit.PopupMenuItem" data-dojo-props='iconClass:"dijitEditorIcon dijitEditorIconForeColor"'>
<span>فرعية</span>
<div data-dojo-type="dijit.Menu">
<div data-dojo-type="dijit.MenuItem">Submenu Item One</div>
<div data-dojo-type="dijit.MenuItem">Submenu Item Two</div>
<div data-dojo-type="dijit.PopupMenuItem">
<span>Deeper Submenu</span>
<div data-dojo-type="dijit.Menu">
<div data-dojo-type="dijit.MenuItem">Sub-sub-menu Item One</div>
<div data-dojo-type="dijit.MenuItem">Sub-sub-menu Item Two</div>
</div>
</div>
</div>
</div>
</div>
</div
></div>
<div id="rtl_tc" data-dojo-type="dijit.layout.TabContainer" data-dojo-props='style:"width: 450px; height: 300px; margin-top: 1em;"'>
<div id="rtl_tc_cp" data-dojo-type="dijit.layout.ContentPane" data-dojo-props='title:"رابط", closable:true, href:"layout/doc0.html"'></div>
<div id="rtl_tc_tree" data-dojo-type="dijit.Tree" data-dojo-props='model:continentModel, openOnClick:true, title:"עץ", closable:true'></div>
</div>
</div>
<div id="left" dir="ltr" lang="en-us" style="width: 500px; float: left;">
<h2>LTR</h2>
<div data-dojo-type="dijit.Toolbar"
><div id="ltr_ToolbarCutButton" data-dojo-type="dijit.form.Button" data-dojo-props='iconClass:"dijitEditorIcon dijitEditorIconCut", showLabel:false'>Cut</div
><div id="ltr_ToolbarDropDown" data-dojo-type="dijit.form.DropDownButton" data-dojo-props='iconClass:"plusIcon", showLabel:true'>
<span>TooltipDialog</span>
<div data-dojo-type="dijit.TooltipDialog" data-dojo-props='title:"Enter Login information"'>
<table>
<tr>
<td><label id="ltr_l1">Name:</label></td>
<td><input id="ltr_i1" data-dojo-type="dijit.form.TextBox"/></td>
</tr>
<tr>
<td><label id="ltr_l2">Date:</label></td>
<td><input id="ltr_i2" data-dojo-type="dijit.form.DateTextBox"/></td>
</tr>
<tr>
<td><label id="ltr_l3">Age:</label></td>
<td><input id="ltr_i3" data-dojo-type="dijit.form.NumberSpinner"/></td>
</tr>
<tr>
<td colspan="2" style="text-align:center;">
<button id="ltr_button" data-dojo-type="dijit.form.Button" data-dojo-props='type:"submit", name:"submit"'>Login</button></td>
</tr>
</table>
</div
></div
><div id="ltr_ToolbarColorDropDown" data-dojo-type="dijit.form.DropDownButton" data-dojo-props='iconClass:"dijitEditorIcon dijitEditorIconBackColor", showLabel:true'>
<span>ColorPalette</span>
<div id="ltr_colorPalette" data-dojo-type="dijit.ColorPalette" data-dojo-props='style:"display:none;", palette:"7x10", onChange:function(){ console.log(this.value); }'></div>
</div
><div id="ltr_ToolbarComboButton" data-dojo-type="dijit.form.ComboButton" data-dojo-props='optionsTitle:"save options", iconClass:"plusIcon", showLabel:true'>
<span>Menu</span>
<div data-dojo-type="dijit.Menu" data-dojo-props='style:"display none;"'>
<div id="ltr_mi1" data-dojo-type="dijit.MenuItem" data-dojo-props='iconClass:"dijitEditorIcon dijitEditorIconSave"'>Save</div>
<div data-dojo-type="dijit.MenuItem">Save As</div>
<div id="ltr_popup_mi1" data-dojo-type="dijit.PopupMenuItem">
<span>Enabled Submenu</span>
<div data-dojo-type="dijit.Menu">
<div data-dojo-type="dijit.MenuItem">Submenu Item One</div>
<div data-dojo-type="dijit.MenuItem">Submenu Item Two</div>
<div data-dojo-type="dijit.PopupMenuItem">
<span>Deeper Submenu</span>
<div data-dojo-type="dijit.Menu">
<div data-dojo-type="dijit.MenuItem">Sub-sub-menu Item One</div>
<div data-dojo-type="dijit.MenuItem">Sub-sub-menu Item Two</div>
</div>
</div>
</div>
</div>
</div>
</div
></div>
<div id="ltr_tc" data-dojo-type="dijit.layout.TabContainer" data-dojo-props='style:"width: 450px; height: 300px; margin-top: 1em;"'>
<div id="ltr_tc_cp" data-dojo-type="dijit.layout.ContentPane" data-dojo-props='title:"Href", closable:true, href:"layout/doc0.html"'></div>
<div id="ltr_tc_tree" data-dojo-type="dijit.Tree" data-dojo-props='model:continentModel, openOnClick:true, title:"Tree", closable:true'></div>
</div>
</div>
</body>
</html>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,411 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1"> <!-- Use Chrome Frame in IE -->
<meta name="viewport" content="width=device-width, height=device-height, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no">
<meta name="description" content="Add billboard images, points, and markers to the scene.">
<title>Cesium Demo</title>
<script type="text/javascript" src="../Sandcastle-header.js"></script>
<script data-dojo-config="async: 1, tlmSiblingOfDojo: 0" src="../../../ThirdParty/dojo-release-1.7.2-src/dojo/dojo.js"></script>
<script type="text/javascript">
require({
baseUrl : '../../..',
packages: [
{ name: 'dojo', location: 'ThirdParty/dojo-release-1.7.2-src/dojo' },
{ name: 'dijit', location: 'ThirdParty/dojo-release-1.7.2-src/dijit' },
{ name: 'dojox', location: 'ThirdParty/dojo-release-1.7.2-src/dojox' },
{ name: 'Assets', location: 'Source/Assets' },
{ name: 'Core', location: 'Source/Core' },
{ name: 'DynamicScene', location: 'Source/DynamicScene' },
{ name: 'Renderer', location: 'Source/Renderer' },
{ name: 'Scene', location: 'Source/Scene' },
{ name: 'Shaders', location: 'Source/Shaders' },
{ name: 'ThirdParty', location: 'Source/ThirdParty' },
{ name: 'Widgets', location: 'Source/Widgets' },
{ name: 'Workers', location: 'Source/Workers' }
]
});
</script>
<link rel="Stylesheet" href="../../../ThirdParty/dojo-release-1.7.2-src/dijit/themes/claro/claro.css" type="text/css">
<link rel="Stylesheet" href="../../../Source/Widgets/Dojo/CesiumViewerWidget.css" type="text/css">
</head>
<body class="claro" data-sandcastle-bucket="bucket-dojo.html" data-sandcastle-title="Cesium + Dojo">
<style>
body {
background: #000;
color: #eee;
font-family: sans-serif;
font-size: 9pt;
padding: 0;
margin: 0;
width: 100%;
height: 100%;
overflow: hidden;
}
.fullSize {
display: block;
position: absolute;
top: 0;
left: 0;
border: none;
width: 100%;
height: 100%;
}
#toolbar {
margin: 5px;
padding: 2px 5px;
position: absolute;
}
</style>
<div id="cesiumContainer" class="fullSize"></div>
<div id="toolbar">Loading...</div>
<script id="cesium_sandcastle_script">
require([
'Source/Cesium', 'Widgets/Dojo/CesiumWidget',
'dojo/on', 'dojo/dom', 'dijit/form/Button'
], function(
Cesium, CesiumWidget,
on, dom, Button)
{
"use strict";
function addBillboard(scene, ellipsoid) {
Sandcastle.declare(addBillboard); // For highlighting in Sandcastle.
var image = new Image();
image.onload = function() {
var billboards = new Cesium.BillboardCollection();
var textureAtlas = scene.getContext().createTextureAtlas({image : image});
billboards.setTextureAtlas(textureAtlas);
billboards.add({
position : ellipsoid.cartographicToCartesian(Cesium.Cartographic.fromDegrees(-75.59777, 40.03883)),
imageIndex : 0
});
scene.getPrimitives().add(billboards);
};
image.src = '../images/Cesium_Logo_overlay.png';
}
function setBillboardPropertiesAtCreation(scene, ellipsoid) {
Sandcastle.declare(setBillboardPropertiesAtCreation); // For highlighting in Sandcastle.
var image = new Image();
image.onload = function() {
var billboards = new Cesium.BillboardCollection();
var textureAtlas = scene.getContext().createTextureAtlas({image : image});
billboards.setTextureAtlas(textureAtlas);
billboards.add({
show : true, // default
position : ellipsoid.cartographicToCartesian(Cesium.Cartographic.fromDegrees(-75.59777, 40.03883)),
pixelOffset : new Cesium.Cartesian2(0, 50), // default: (0, 0)
eyeOffset : new Cesium.Cartesian3(0.0, 0.0, 0.0), // default
horizontalOrigin : Cesium.HorizontalOrigin.CENTER, // default
verticalOrigin : Cesium.VerticalOrigin.BOTTOM, // default: CENTER
scale : 2.0, // default : 1.0
imageIndex : 0, // default
color : { red : 0.0, green : 1.0, blue : 0.0, alpha : 1.0 } // default: all 255
});
scene.getPrimitives().add(billboards);
};
image.src = '../images/Cesium_Logo_overlay.png';
}
function setBillboardProperties(scene, ellipsoid) {
Sandcastle.declare(setBillboardProperties); // For highlighting in Sandcastle.
var image = new Image();
image.onload = function() {
var billboards = new Cesium.BillboardCollection(undefined);
var textureAtlas = scene.getContext().createTextureAtlas({image : image});
billboards.setTextureAtlas(textureAtlas);
// add() returns a Billboard object containing functions to change
// the billboard's position and appearance.
var b = billboards.add({
position : ellipsoid.cartographicToCartesian(Cesium.Cartographic.fromDegrees(-75.59777, 40.03883)),
imageIndex : 0
});
b.setPosition(ellipsoid.cartographicToCartesian(Cesium.Cartographic.fromDegrees(-75.59777, 40.03883, 300000.0)));
b.setScale(3.0);
b.setColor({ red : 1.0, green : 1.0, blue : 1.0, alpha : 0.25 });
scene.getPrimitives().add(billboards);
};
image.src = '../images/Cesium_Logo_overlay.png';
}
function addMultipleBillboards(scene, ellipsoid) {
Sandcastle.declare(addMultipleBillboards); // For highlighting in Sandcastle.
Cesium.when.all([
Cesium.loadImage('../images/Cesium_Logo_overlay.png'),
Cesium.loadImage('../images/facility.gif')
])
.then(function(images) {
// Once both images are downloaded, they are combined into one image,
// called a texture atlas, which is assigned to a billboard-collection.
// Several billboards can be added to the same collection; each billboard
// references an image in the texture atlas.
var billboards = new Cesium.BillboardCollection();
var textureAtlas = scene.getContext().createTextureAtlas({
images : images
});
billboards.setTextureAtlas(textureAtlas);
billboards.add({
position : ellipsoid.cartographicToCartesian(Cesium.Cartographic.fromDegrees(-75.59777, 40.03883)),
imageIndex : 0 // Logo
});
billboards.add({
position : ellipsoid.cartographicToCartesian(Cesium.Cartographic.fromDegrees(-80.50, 35.14)),
imageIndex : 1 // Facility
});
billboards.add({
position : ellipsoid.cartographicToCartesian(Cesium.Cartographic.fromDegrees(-80.12, 25.46)),
imageIndex : 1 // Facility
});
scene.getPrimitives().add(billboards);
});
}
function addPointBillboards(scene, ellipsoid) {
Sandcastle.declare(addPointBillboards); // For highlighting in Sandcastle.
// A white circle is drawn into a 2D canvas. The canvas is used as
// a texture for billboards, each of which applies a different color
// and scale to change the point's appearance.
//
// The 2D canvas can draw much more than circles. See:
// https://developer.mozilla.org/en/Canvas_tutorial
var canvas = document.createElement('canvas');
canvas.width = 16;
canvas.height = 16;
var context2D = canvas.getContext('2d');
context2D.beginPath();
context2D.arc(8, 8, 8, 0, Cesium.Math.TWO_PI, true);
context2D.closePath();
context2D.fillStyle='rgb(255, 255, 255)';
context2D.fill();
var billboards = new Cesium.BillboardCollection();
var textureAtlas = scene.getContext().createTextureAtlas({image : canvas});
billboards.setTextureAtlas(textureAtlas);
billboards.add({
position : ellipsoid.cartographicToCartesian(Cesium.Cartographic.fromDegrees(-75.59777, 40.03883)),
color : { red : 1.0, blue : 0.0, green : 0.0, alpha : 1.0 },
scale : 0.5,
imageIndex : 0
});
billboards.add({
position : ellipsoid.cartographicToCartesian(Cesium.Cartographic.fromDegrees(-80.50, 35.14)),
color : { red : 0.0, blue : 1.0, green : 0.0, alpha : 1.0 },
imageIndex : 0
});
billboards.add({
position : ellipsoid.cartographicToCartesian(Cesium.Cartographic.fromDegrees(-80.12, 25.46)),
color : { red : 0.0, blue : 0.0, green : 1.0, alpha : 1.0 },
scale : 2,
imageIndex : 0
});
scene.getPrimitives().add(billboards);
}
function addMarkerBillboards(scene, ellipsoid) {
Sandcastle.declare(addMarkerBillboards); // For highlighting in Sandcastle.
var image = new Image();
image.onload = function() {
var billboards = new Cesium.BillboardCollection(undefined);
var textureAtlas = scene.getContext().createTextureAtlas({borderWidthInPixels : 0});
// Break one image full of markers into many subregions.
textureAtlas.addSubRegions(image, [
// Dots, small to large, imageIndex 1 to 6
{ x:91, y:11, width:6, height:6 },
{ x:81, y:9, width:10, height:10 },
{ x:67, y:7, width:14, height:14 },
{ x:49, y:5, width:18, height:18 },
{ x:27, y:3, width:22, height:22 },
{ x:1, y:1, width:26, height:26 },
// Up-Triangles, small to large, imageIndex 7 to 12
{ x:91, y:49, width:6, height:6 },
{ x:81, y:47, width:10, height:10 },
{ x:67, y:45, width:14, height:14 },
{ x:49, y:43, width:18, height:18 },
{ x:27, y:41, width:22, height:22 },
{ x:1, y:39, width:26, height:26 },
// Down-Triangles, small to large, imageIndex 13 to 18
{ x:31, y:29, width:6, height:6 },
{ x:37, y:27, width:10, height:10 },
{ x:47, y:25, width:14, height:14 },
{ x:61, y:23, width:18, height:18 },
{ x:79, y:21, width:22, height:22 },
{ x:101, y:19, width:26, height:26 },
// Up-Arrows, small to large, imageIndex 19 to 24
{ x:91, y:84, width:6, height:6 },
{ x:81, y:82, width:10, height:10 },
{ x:67, y:80, width:14, height:14 },
{ x:49, y:78, width:18, height:18 },
{ x:27, y:76, width:22, height:22 },
{ x:1, y:74, width:26, height:26 },
// Down-Arrows, small to large, imageIndex 25 to 30
{ x:31, y:66, width:6, height:6 },
{ x:37, y:64, width:10, height:10 },
{ x:47, y:62, width:14, height:14 },
{ x:61, y:60, width:18, height:18 },
{ x:79, y:58, width:22, height:22 },
{ x:101, y:56, width:26, height:26 },
// X's, small to large, imageIndex 31 to 36
{ x:91, y:111, width:6, height:6 },
{ x:81, y:109, width:10, height:10 },
{ x:67, y:107, width:14, height:14 },
{ x:49, y:105, width:18, height:18 },
{ x:27, y:103, width:22, height:22 },
{ x:1, y:101, width:26, height:26 },
// Plus's, small to large, imageIndex 37 to 42
{ x:92, y:120, width:5, height:5 },
{ x:109, y:109, width:10, height:10 },
{ x:107, y:107, width:14, height:14 },
{ x:105, y:105, width:18, height:18 },
{ x:103, y:103, width:22, height:22 },
{ x:101, y:101, width:26, height:26 }
]);
billboards.setTextureAtlas(textureAtlas);
// Add several billboards based on the above marker definitions.
billboards.add({
position: ellipsoid.cartographicToCartesian(Cesium.Cartographic.fromDegrees(-75.59777, 40.03883)),
imageIndex: 10,
scale: 1,
color: { red: 0, green: 1, blue: 0, alpha: 1 }
});
billboards.add({
position: ellipsoid.cartographicToCartesian(Cesium.Cartographic.fromDegrees(-84.0, 39.0)),
imageIndex: 16,
scale: 1,
color: { red: 0, green: 0.5, blue: 1, alpha: 1 }
});
billboards.add({
position: ellipsoid.cartographicToCartesian(Cesium.Cartographic.fromDegrees(-70.0, 41.0)),
imageIndex: 21,
scale: 1,
color: { red: 0.5, green: 0.9, blue: 1, alpha: 1 }
});
billboards.add({
position: ellipsoid.cartographicToCartesian(Cesium.Cartographic.fromDegrees(-73.0, 37.0)),
imageIndex: 35,
scale: 1,
color: { red: 1, green: 0, blue: 0, alpha: 1 }
});
billboards.add({
position: ellipsoid.cartographicToCartesian(Cesium.Cartographic.fromDegrees(-79.0, 35.0)),
imageIndex: 40,
scale: 1,
color: { red: 1, green: 1, blue: 0, alpha: 1 }
});
scene.getPrimitives().add(billboards);
};
image.src = '../images/whiteShapes.png';
}
function addBillboardsInReferenceframe(scene, ellipsoid) {
Sandcastle.declare(addBillboardsInReferenceframe); // For highlighting in Sandcastle.
var image = new Image();
image.onload = function() {
var billboards = new Cesium.BillboardCollection();
var textureAtlas = scene.getContext().createTextureAtlas({image : image});
billboards.setTextureAtlas(textureAtlas);
var center = ellipsoid.cartographicToCartesian(Cesium.Cartographic.fromDegrees(-75.59777, 40.03883));
billboards.modelMatrix = Cesium.Transforms.eastNorthUpToFixedFrame(center);
billboards.add({ imageIndex : 0, position : new Cesium.Cartesian3(0.0, 0.0, 0.0) }); // center
billboards.add({ imageIndex : 0, position : new Cesium.Cartesian3(1000000.0, 0.0, 0.0) }); // east
billboards.add({ imageIndex : 0, position : new Cesium.Cartesian3(0.0, 1000000.0, 0.0) }); // north
billboards.add({ imageIndex : 0, position : new Cesium.Cartesian3(0.0, 0.0, 1000000.0) }); // up
scene.getPrimitives().add(billboards);
};
image.src = '../images/facility.gif';
}
function createButtons(widget) {
var ellipsoid = widget.ellipsoid;
var scene = widget.scene;
var primitives = scene.getPrimitives();
new Button({
label: 'Add billboard',
onClick: function() {
primitives.removeAll();
addBillboard(scene, ellipsoid);
Sandcastle.highlight(addBillboard);
}
}).placeAt('toolbar');
new Button({
label: 'Set billboard properties at creation',
onClick: function() {
primitives.removeAll();
setBillboardPropertiesAtCreation(scene, ellipsoid);
Sandcastle.highlight(setBillboardPropertiesAtCreation);
}
}).placeAt('toolbar');
new Button({
label: 'Change billboard properties',
onClick: function() {
primitives.removeAll();
setBillboardProperties(scene, ellipsoid);
Sandcastle.highlight(setBillboardProperties);
}
}).placeAt('toolbar');
new Button({
label: 'Add multiple billboards',
onClick: function() {
primitives.removeAll();
addMultipleBillboards(scene, ellipsoid);
Sandcastle.highlight(addMultipleBillboards);
}
}).placeAt('toolbar');
new Button({
label: 'Add point billboards',
onClick: function() {
primitives.removeAll();
addPointBillboards(scene, ellipsoid);
Sandcastle.highlight(addPointBillboards);
}
}).placeAt('toolbar');
new Button({
label: 'Add marker billboards',
onClick: function() {
primitives.removeAll();
addMarkerBillboards(scene, ellipsoid);
Sandcastle.highlight(addMarkerBillboards);
}
}).placeAt('toolbar');
new Button({
label: 'Add billboards in reference frame',
onClick: function() {
primitives.removeAll();
addBillboardsInReferenceframe(scene, ellipsoid);
Sandcastle.highlight(addBillboardsInReferenceframe);
}
}).placeAt('toolbar');
}
var widget = new CesiumWidget();
widget.placeAt(dom.byId('cesiumContainer'));
widget.startup();
dom.byId('toolbar').innerHTML = '';
createButtons(widget);
addBillboard(widget.scene, widget.ellipsoid);
});
</script>
</body>
</html>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,103 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1"> <!-- Use Chrome Frame in IE -->
<meta name="viewport" content="width=device-width, height=device-height, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no">
<meta name="description" content="NASA Black Marble imagery.">
<title>Cesium Demo</title>
<script type="text/javascript" src="../Sandcastle-header.js"></script>
<script data-dojo-config="async: 1, tlmSiblingOfDojo: 0" src="../../../ThirdParty/dojo-release-1.7.2-src/dojo/dojo.js"></script>
<script type="text/javascript">
require({
baseUrl : '../../..',
packages: [
{ name: 'dojo', location: 'ThirdParty/dojo-release-1.7.2-src/dojo' },
{ name: 'dijit', location: 'ThirdParty/dojo-release-1.7.2-src/dijit' },
{ name: 'dojox', location: 'ThirdParty/dojo-release-1.7.2-src/dojox' },
{ name: 'Assets', location: 'Source/Assets' },
{ name: 'Core', location: 'Source/Core' },
{ name: 'DynamicScene', location: 'Source/DynamicScene' },
{ name: 'Renderer', location: 'Source/Renderer' },
{ name: 'Scene', location: 'Source/Scene' },
{ name: 'Shaders', location: 'Source/Shaders' },
{ name: 'ThirdParty', location: 'Source/ThirdParty' },
{ name: 'Widgets', location: 'Source/Widgets' },
{ name: 'Workers', location: 'Source/Workers' }
]
});
</script>
<link rel="Stylesheet" href="../../../ThirdParty/dojo-release-1.7.2-src/dijit/themes/claro/claro.css" type="text/css">
<link rel="Stylesheet" href="../../../Source/Widgets/Dojo/CesiumViewerWidget.css" type="text/css">
</head>
<body class="claro" data-sandcastle-bucket="bucket-dojo.html" data-sandcastle-title="Cesium + Dojo">
<style>
body {
background: #000;
color: #eee;
font-family: sans-serif;
font-size: 9pt;
padding: 0;
margin: 0;
width: 100%;
height: 100%;
overflow: hidden;
}
.fullSize {
display: block;
position: absolute;
top: 0;
left: 0;
border: none;
width: 100%;
height: 100%;
}
#toolbar {
margin: 5px;
padding: 2px 5px;
position: absolute;
}
</style>
<div id="cesiumContainer" class="fullSize"></div>
<div id="toolbar">Loading...</div>
<script id="cesium_sandcastle_script">
require([
'Source/Cesium', 'Widgets/Dojo/CesiumWidget',
'dojo/on', 'dojo/dom', 'dojo/io-query'
], function(
Cesium, CesiumWidget,
on, dom, ioQuery)
{
"use strict";
// Ask Dojo to parse URL configuration options
var endUserOptions = {};
if (window.location.search) {
endUserOptions = ioQuery.queryToObject(window.location.search.substring(1));
}
// Initialize a viewer capable of drag-and-drop
// and user customizations.
var widget = new CesiumWidget({
endUserOptions : endUserOptions,
enableDragDrop : true
});
widget.placeAt(dom.byId('cesiumContainer'));
widget.startup();
var centralBody = widget.centralBody;
var imageryLayerCollection = centralBody.getImageryLayers();
imageryLayerCollection.removeAll();
imageryLayerCollection.addImageryProvider(new Cesium.TileMapServiceImageryProvider({
url : 'http://cesium.agi.com/blackmarble',
maximumLevel : 8,
credit : 'Black Marble imagery courtesy NASA Earth Observatory'
}));
dom.byId('toolbar').innerHTML = '';
});
</script>
</body>
</html>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,178 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>doh.robot BorderContainer Test</title>
<style>
@import "../../../../util/doh/robot/robot.css";
</style>
<!-- required: dojo.js -->
<script type="text/javascript" src="../../../../dojo/dojo.js"
djConfig="isDebug: true"></script>
<!-- functions to help test -->
<script type="text/javascript" src="../../helpers.js"></script>
<script type="text/javascript" src="./borderContainerTestFunctions.js"></script>
<script type="text/javascript">
dojo.require("dijit.robotx");
dojo.ready(function(){
doh.robot.initRobot('../test_BorderContainer.html');
doh.register("mouse", [
{
name: "expand right pane",
timeout: 10000,
runTest: function(t){
var d = new doh.Deferred();
var oTop = dojo.position(dojo.byId("border2-top")),
oCenter = dojo.position(dojo.byId("border2-center")),
oRight = dojo.position(dojo.byId("border2-trailing")),
oBottom = dojo.position(dojo.byId("border2-bottom"));
// Drag slider to expand pane
var size = dojo.position("border2-trailing_splitter");
doh.robot.mouseMoveAt("border2-trailing_splitter", 500);
doh.robot.mousePress({left: true}, 500);
doh.robot.mouseMoveAt("border2-trailing_splitter", 500, 100,
size.w/2 + (dojo._isBodyLtr() ? -100 : 100), size.h/2);
doh.robot.mouseRelease({left: true}, 500);
doh.robot.sequence(d.getTestCallback(function(){
var nTop = dojo.position(dojo.byId("border2-top")),
nCenter = dojo.position(dojo.byId("border2-center")),
nRight = dojo.position(dojo.byId("border2-trailing")),
nBottom = dojo.position(dojo.byId("border2-bottom"));
doh.t(within(oRight.w + 100, nRight.w, 10), "right width went from " + oRight.w + " to " + nRight.w);
doh.t(within(oTop.w - 100, nTop.w, 10), "top width went from " + oTop.w + " to " + nTop.w);
doh.t(within(oCenter.w - 100, nCenter.w, 10), "center width went from " + oCenter.w + " to " + nCenter.w);
doh.t(within(oBottom.w - 100, nBottom.w, 10), "bottom width went from " + nBottom.w + " to " + nBottom.w);
}), 500);
return d;
}
},
{
name: "shrink bottom pane",
timeout: 10000,
runTest: function(t){
var d = new doh.Deferred();
var oTop = dojo.position(dojo.byId("border2-top")),
oCenter = dojo.position(dojo.byId("border2-center")),
oRight = dojo.position(dojo.byId("border2-trailing")),
oBottom = dojo.position(dojo.byId("border2-bottom"));
// Drag slider to shrink pane
var size = dojo.position("border2-bottom_splitter");
doh.robot.mouseMoveAt("border2-bottom_splitter", 500);
doh.robot.mousePress({left: true}, 500);
doh.robot.mouseMoveAt("border2-bottom_splitter", 500, 100, size.w/2, size.h/2 + 10);
doh.robot.mouseRelease({left: true}, 500);
doh.robot.sequence(d.getTestCallback(function(){
var nTop = dojo.position(dojo.byId("border2-top")),
nCenter = dojo.position(dojo.byId("border2-center")),
nRight = dojo.position(dojo.byId("border2-trailing")),
nBottom = dojo.position(dojo.byId("border2-bottom"));
doh.t(within(oBottom.h - 10, nBottom.h, 10), "bottom height went from " + oBottom.h + " to " + nBottom.h);
doh.t(within(oCenter.h + 10, nCenter.h, 10), "center height went from " + oCenter.h + " to " + nCenter.h);
}), 500);
return d;
}
}
]);
doh.register("keyboard", [
function setup(){
// Workaround FF4 bug where overflow:auto panes get focus even when
// they don't have a scrollbar, remove when
// https://bugzilla.mozilla.org/show_bug.cgi?id=616594 fixed
if(dojo.isFF == 4){
dojo.query(".dijitContentPane").style("overflow", "hidden");
}
},
{
name: "tabIndex",
timeout: 10000,
runTest: function(t){
var d = new doh.Deferred();
doh.robot.sequence(function(){
dojo.byId("toggleLeftButton").focus();
}, 500, 500);
// Tab into second BorderContainer, landing on link
doh.robot.keyPress(dojo.keys.TAB, 500, {});
doh.robot.sequence(d.getTestErrback(function(){
doh.is("a link", innerText(dojo.global.dijit.focus.curNode), "tabbed to link");
}), 500);
// Tab past ComboBox to get to splitter for bottom panel
doh.robot.keyPress(dojo.keys.TAB, 500, {});
doh.robot.keyPress(dojo.keys.TAB, 500, {});
doh.robot.sequence(d.getTestErrback(function(){
doh.is("border2-bottom_splitter", dojo.global.dijit.focus.curNode.id, "focus on bottom splitter");
}), 500);
// Tab to get to splitter for right panel
doh.robot.keyPress(dojo.keys.TAB, 500, {});
doh.robot.sequence(d.getTestErrback(function(){
doh.is("border2-trailing_splitter", dojo.global.dijit.focus.curNode.id, "focus on bottom splitter");
}), 500);
// tab out of BorderContainer, into the next one
doh.robot.keyPress(dojo.keys.TAB, 500, {});
doh.robot.sequence(d.getTestCallback(function(){
doh.is("a link", innerText(dojo.global.dijit.focus.curNode), "tabbed to link in next BC");
}), 500);
return d;
}
},
{
name: "expand/contract",
timeout: 10000,
runTest: function(t){
var d = new doh.Deferred();
var oSize, nSize;
// contract bottom pane
doh.robot.sequence(function(){
dojo.byId("border2-bottom_splitter").focus();
oSize = dojo.position("border2-bottom");
}, 500, 500);
doh.robot.keyPress(dojo.keys.DOWN_ARROW, 500, {});
doh.robot.sequence(d.getTestErrback(function(){
nSize = dojo.position("border2-bottom");
doh.t(nSize.h < oSize.h, "contracted bottom pane");
}), 500);
// expand trailing pane
doh.robot.sequence(function(){
dojo.byId("border2-trailing_splitter").focus();
oSize = dojo.position("border2-trailing");
}, 500, 500);
doh.robot.keyPress(dojo._isBodyLtr() ? dojo.keys.LEFT_ARROW : dojo.keys.RIGHT_ARROW, 500, {});
doh.robot.sequence(d.getTestCallback(function(){
nSize = dojo.position("border2-trailing");
doh.t(nSize.w > oSize.w, "expanded trailing pane");
}), 500);
return d;
}
}
]);
doh.run();
});
</script>
</head>
</html>

View File

@@ -0,0 +1,313 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>doh.robot BorderContainer complex Test</title>
<style>
@import "../../../../util/doh/robot/robot.css";
</style>
<!-- required: dojo.js -->
<script type="text/javascript" src="../../../../dojo/dojo.js"
djConfig="isDebug: true"></script>
<!-- functions to help test -->
<script type="text/javascript" src="../../helpers.js"></script>
<script type="text/javascript" src="./borderContainerTestFunctions.js"></script>
<script type="text/javascript">
dojo.require("dijit.robotx");
dojo.ready(function(){
doh.robot.initRobot('../test_BorderContainer_complex.html');
doh.register("API", [
function initialConditions(){
checkBCpanes(dijit.byId("border1"));
}
]);
//test some basic functionality of the complex widgets to get a feel for whether they work inside the border container
doh.register("tabContainer", [
{
name: "tab2Selected",
runTest: function(t){
doh.t(dijit.byId("tab2").selected, "tab2 was not selected");
doh.f(dijit.byId("tab1").selected, "tab1 was selected");
doh.f(dijit.byId("tab3").selected, "tab3 was selected");
doh.f(dijit.byId("tab4").selected, "tab4 was selected");
doh.f(dijit.byId("tab5").selected, "tab5 was selected");
doh.f(dijit.byId("tab6").selected, "tab6 was selected");
}
},
{
name: "tabsCanBeShownWhenSelected_tab1",
timeout: 3000,
runTest: function(t){
var d = new doh.Deferred();
doh.robot.mouseMoveAt("mainTabContainer_tablist_tab1", 500, 1);
doh.robot.mouseClick({left:true}, 500);
doh.robot.sequence(d.getTestCallback(function(){
doh.is("mainTabContainer_tablist_tab1", dojo.global.dijit.focus.curNode.id, "current focus was not tab1");
doh.is("tab1", dijit.byId("mainTabContainer").selectedChildWidget.id, "Tab1 pane is not the selected pane");
doh.t(isVisible(dijit.byId("tab1")), "Tab1 is hidden");
doh.t(isHidden(dijit.byId("tab2")), "Tab2 is visible");
}), 1000);
return d;
}
},
{
name: "tabsCanBeShownWhenSelected_tab2",
timeout: 3000,
runTest: function(t){
var d = new doh.Deferred();
doh.robot.keyPress(dojo.keys.RIGHT_ARROW, 1000, {});
doh.robot.sequence(d.getTestCallback(function(){
doh.is("mainTabContainer_tablist_tab2", dojo.global.dijit.focus.curNode.id, "current focus was not tab2");
doh.is("tab2", dijit.byId("mainTabContainer").selectedChildWidget.id, "Tab2 pane is not the selected pane");
doh.t(isVisible(dijit.byId("tab2")), "Tab2 is hidden");
doh.t(isHidden(dijit.byId("tab1")), "Tab1 is visible");
}), 1000);
return d;
}
},
{
name: "tabsCanBeShownWhenSelected_tab3",
timeout: 3000,
runTest: function(t){
var d = new doh.Deferred();
doh.robot.keyPress(dojo.keys.RIGHT_ARROW, 1000, {});
doh.robot.sequence(d.getTestCallback(function(){
doh.is("mainTabContainer_tablist_tab3", dojo.global.dijit.focus.curNode.id, "current focus was not tab3");
doh.is("tab3", dijit.byId("mainTabContainer").selectedChildWidget.id, "Tab3 pane is not the selected pane");
doh.t(isVisible(dijit.byId("tab3")), "Tab3 is hidden");
doh.t(isHidden(dijit.byId("tab2")), "Tab2 is visible");
}), 1000);
return d;
}
},
{
name: "tabsCanBeShownWhenSelected_tab4",
timeout: 3000,
runTest: function(t){
var d = new doh.Deferred();
doh.robot.keyPress(dojo.keys.RIGHT_ARROW, 1000, {});
doh.robot.sequence(d.getTestCallback(function(){
doh.is("mainTabContainer_tablist_tab4", dojo.global.dijit.focus.curNode.id, "current focus was not tab4");
doh.is("tab4", dijit.byId("mainTabContainer").selectedChildWidget.id, "Tab4 pane is not the selected pane");
doh.t(isVisible(dijit.byId("tab4")), "Tab4 is hidden");
doh.t(isHidden(dijit.byId("tab3")), "Tab3 is visible");
}), 1000);
return d;
}
},
{
name: "tabsCanBeShownWhenSelected_tab5",
timeout: 3000,
runTest: function(t){
var d = new doh.Deferred();
doh.robot.keyPress(dojo.keys.RIGHT_ARROW, 1000, {});
doh.robot.sequence(d.getTestCallback(function(){
doh.is("mainTabContainer_tablist_tab5", dojo.global.dijit.focus.curNode.id, "current focus was not tab5");
doh.is("tab5", dijit.byId("mainTabContainer").selectedChildWidget.id, "Tab5 pane is not the selected pane");
doh.t(isVisible(dijit.byId("tab5")), "Tab5 is hidden");
doh.t(isHidden(dijit.byId("tab4")), "Tab4 is visible");
}), 1000);
return d;
}
},
{
name: "tabsCanBeShownWhenSelected_tab6",
timeout: 3000,
runTest: function(t){
var d = new doh.Deferred();
doh.robot.keyPress(dojo.keys.RIGHT_ARROW, 1000, {});
doh.robot.sequence(d.getTestCallback(function(){
doh.is("mainTabContainer_tablist_tab6", dojo.global.dijit.focus.curNode.id, "current focus was not tab6");
doh.is("tab6", dijit.byId("mainTabContainer").selectedChildWidget.id, "Tab6 pane is not the selected pane");
doh.t(isVisible(dijit.byId("tab6")), "Tab6 is hidden");
doh.t(isHidden(dijit.byId("tab5")), "Tab5 is visible");
}), 1000);
return d;
}
}
]);
doh.register("AccordionContainer", [
{
name: "pane1Selected",
runTest: function(t){
doh.t(dijit.byId("ap1").selected, "ap1 selected");
doh.f(dijit.byId("ap2").selected, "ap2 not selected");
doh.f(dijit.byId("ap3").selected, "ap3 not selected");
doh.t(isVisible(dijit.byId("ap1")), "ap1 is visible");
doh.t(isHidden(dijit.byId("ap2")), "ap2 is hidden");
doh.t(isHidden(dijit.byId("ap3")), "ap3 is hidden");
}
},
{
name: "focus ap1 title bar",
runTest: function(t){
dijit.byId("ap1_button").focusNode.focus();
}
},
{
name: "select ap2",
timeout: 3000,
runTest: function(t){
var d = new doh.Deferred();
// Connect to _hideChild() as a trick to tell when animation is finished
handle = dojo.connect(dijit.byId("ac1"), "_hideChild", function(){
setTimeout(d.getTestCallback(function(){
doh.is("ap2_button", dojo.global.dijit.focus.curNode.parentNode.id, "current focus was not ap2");
doh.is("ap2", dijit.byId("ac1").selectedChildWidget.id, "ap2 is not the selected pane");
doh.t(isVisible(dijit.byId("ap2")), "ap2 is visible");
doh.t(isHidden(dijit.byId("ap1")), "ap1 is hidden");
}), 0);
});
doh.robot.keyPress(dojo.keys.DOWN_ARROW, 1000, {});
return d;
},
tearDown: function(){
dojo.disconnect(handle);
}
},
{
name: "select ap3",
timeout: 3000,
runTest: function(t){
var d = new doh.Deferred();
// Connect to _hideChild() as a trick to tell when animation is finished
handle = dojo.connect(dijit.byId("ac1"), "_hideChild", function(){
setTimeout(d.getTestCallback(function(){
doh.is("ap3_button", dojo.global.dijit.focus.curNode.parentNode.id, "current focus was not ap3");
doh.is("ap3", dijit.byId("ac1").selectedChildWidget.id, "ap3 is not the selected pane");
doh.t(isVisible(dijit.byId("ap3")), "ap3 is visible");
doh.t(isHidden(dijit.byId("ap2")), "ap2 is hidden");
}), 0);
});
doh.robot.keyPress(dojo.keys.DOWN_ARROW, 1000, {});
return d;
},
tearDown: function(){
dojo.disconnect(handle);
}
},
{
name: "resize accordion",
timeout: 6000,
runTest: function(t){
var d = new doh.Deferred();
var accordion = dojo.position(dojo.byId("ac1"));
var centerPane = dojo.position(dojo.byId("mainCP"));
var centerPaneRight = centerPane.x + centerPane.w;
var filteringSelectWidth = dojo.position(dijit.byId("filteringSelect").domNode).w;
var move = filteringSelectWidth - centerPane.w + 30;
// Drag slider to shrink pane
var size = dojo.position("ac1_splitter");
doh.robot.mouseMoveAt("ac1_splitter", 0, 1);
doh.robot.mousePress({left: true}, 500);
doh.robot.mouseMoveAt("ac1_splitter", 500, 1, size.w/2-move, size.h/2);
doh.robot.sequence(function(){
var newCenterPane = dojo.position(dojo.byId("mainCP"));
var newCenterPaneRight = newCenterPane.x + newCenterPane.w;
// center could overlap right pane
var move2 = centerPaneRight - newCenterPaneRight;
doh.robot.mouseMoveAt("ac1_splitter", 500, 1, size.w/2-move2, size.h/2);
move += move2;
doh.robot.mouseRelease({left: true}, 500);
doh.robot.sequence(d.getTestCallback(function(){
// test that the margin box for the accordion pane grows the same size as the splitter moved
var newAccordion = dojo.position(dojo.byId("ac1"));
doh.is(newAccordion.w, accordion.w-move, 'old accordion w = ' + accordion.w + ', new w = ' + newAccordion.w);
// test that the center content got smaller by the same size that the splitter moved
var newCenterPane = dojo.position(dojo.byId("mainCP"));
var newCenterPaneRight = newCenterPane.x + newCenterPane.w;
doh.is(newCenterPane.w, centerPane.w+move-centerPaneRight+newCenterPaneRight, 'old center pane w = ' + centerPane.w + ', new w = ' + newCenterPane.w);
}), 500);
}, 500);
return d;
}
}
]);
var filteringSelect, handler;
doh.register("filteringSelect", [
{
name: "changeValue",
timeout: 10000,
runTest: function(t){
var d = new doh.Deferred();
filteringSelect = dijit.byId("filteringSelect");
handler = filteringSelect.connect(filteringSelect, "onChange", function(e){
d.callback(true);
});
filteringSelect.focus();
doh.robot.keyPress(dojo.keys.DOWN_ARROW, 1000, {});
doh.robot.keyPress(dojo.keys.DOWN_ARROW, 1000, {});
doh.robot.keyPress(dojo.keys.DOWN_ARROW, 500, {});
doh.robot.keyPress(dojo.keys.ENTER, 500, {});
return d;
},
tearDown: function(t){
filteringSelect.disconnect(handler);
}
}
]);
doh.register("editor", [
{
name: "changeValue",
timeout: 3000,
runTest: function(t){
var d = new doh.Deferred();
doh.robot.sequence(function(){
var editor = dijit.byId("editor1");
editor.setValue("<div id='myDiv'>This is my new text</div>");
}, 1000);
doh.robot.sequence(d.getTestCallback(function(){
var myDiv = dijit.byId("editor1").editNode.childNodes[0];
doh.is("myDiv", myDiv.id, "myDiv was not the first child node as expectd");
doh.t(isVisible(myDiv), "myDiv is visible");
}), 1000);
return d;
}
}
]);
doh.run();
});
</script>
</head>
</html>

View File

@@ -0,0 +1,110 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>doh.robot BorderContainer full Test</title>
<style>
@import "../../../../util/doh/robot/robot.css";
</style>
<!-- required: dojo.js -->
<script type="text/javascript" src="../../../../dojo/dojo.js"
djConfig="isDebug: true"></script>
<!-- functions to help test -->
<script type="text/javascript" src="../../helpers.js"></script>
<script type="text/javascript" src="./borderContainerTestFunctions.js"></script>
<script type="text/javascript">
dojo.require("dijit.robotx");
dojo.ready(function(){
doh.robot.initRobot('../test_BorderContainer_full.html');
doh.register("API", [
function initialConditions(){
var bc = dijit.byId("main");
checkBCpanes(bc);
doh.t(bc.getChildren().length==5);
},
function testFullScreen(){
var borderContainerPos = dojo.position(dojo.byId("main"));
var view = dojo.window.getBox();
doh.t( borderContainerPos.h-view.h < 3);
doh.t( borderContainerPos.w-view.w < 3);
}
]);
doh.register("mouse", [
{
name: "expand right pane",
timeout: 10000,
runTest: function(t){
var d = new doh.Deferred();
var oTop = dojo.position(dojo.byId("main-top")),
oCenter = dojo.position(dojo.byId("main-center")),
oRight = dojo.position(dojo.byId("main-trailing")),
oBottom = dojo.position(dojo.byId("main-bottom"));
// Drag slider to expand pane
var size = dojo.position("main-trailing_splitter");
doh.robot.mouseMoveAt("main-trailing_splitter", 500);
doh.robot.mousePress({left: true}, 500);
doh.robot.mouseMoveAt("main-trailing_splitter", 500, 100,
size.w/2 + (dojo._isBodyLtr() ? -100 : 100), size.h/2);
doh.robot.mouseRelease({left: true}, 500);
doh.robot.sequence(d.getTestCallback(function(){
var nTop = dojo.position(dojo.byId("main-top")),
nCenter = dojo.position(dojo.byId("main-center")),
nRight = dojo.position(dojo.byId("main-trailing")),
nBottom = dojo.position(dojo.byId("main-bottom"));
doh.t(within(oRight.w + 100, nRight.w, 10), "right width went from " + oRight.w + " to " + nRight.w);
doh.t(within(oTop.w - 100, nTop.w, 10), "top width went from " + oTop.w + " to " + nTop.w);
doh.t(within(oCenter.w - 100, nCenter.w, 10), "center width went from " + oCenter.w + " to " + nCenter.w);
doh.t(within(oBottom.w - 100, nBottom.w, 10), "bottom width went from " + nBottom.w + " to " + nBottom.w);
}), 500);
return d;
}
},
{
name: "shrink bottom pane",
timeout: 10000,
runTest: function(t){
var d = new doh.Deferred();
var oTop = dojo.position(dojo.byId("main-top")),
oCenter = dojo.position(dojo.byId("main-center")),
oRight = dojo.position(dojo.byId("main-trailing")),
oBottom = dojo.position(dojo.byId("main-bottom"));
// Drag slider to shrink pane
var size = dojo.position("main-bottom_splitter");
doh.robot.mouseMoveAt("main-bottom_splitter", 500);
doh.robot.mousePress({left: true}, 500);
doh.robot.mouseMoveAt("main-bottom_splitter", 500, 100, size.w/2, size.h/2 + 10);
doh.robot.mouseRelease({left: true}, 500);
doh.robot.sequence(d.getTestCallback(function(){
var nTop = dojo.position(dojo.byId("main-top")),
nCenter = dojo.position(dojo.byId("main-center")),
nRight = dojo.position(dojo.byId("main-trailing")),
nBottom = dojo.position(dojo.byId("main-bottom"));
doh.t(within(oBottom.h - 10, nBottom.h, 10), "bottom height went from " + oBottom.h + " to " + nBottom.h);
doh.t(within(oCenter.h + 10, nCenter.h, 10), "center height went from " + oCenter.h + " to " + nCenter.h);
}), 500);
return d;
}
}
]);
doh.run();
});
</script>
</head>
</html>

View File

@@ -0,0 +1,148 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>doh.robot BorderContainer nested Test</title>
<style>
@import "../../../../util/doh/robot/robot.css";
</style>
<!-- required: dojo.js -->
<script type="text/javascript" src="../../../../dojo/dojo.js"
djConfig="isDebug: true"></script>
<!-- functions to help test -->
<script type="text/javascript" src="../../helpers.js"></script>
<script type="text/javascript" src="./borderContainerTestFunctions.js"></script>
<script type="text/javascript">
dojo.require("dijit.robotx");
function checkLayoutPriorityBC(){
checkAbove("top bar above second top bar", "top1", "top2");
checkAbove("second top bar above inner top bar", "top2", "top3");
checkLeft("outer left vs. inner left", "left1", "left2");
checkLeft("inner left vs. inner top", "left2", "top3");
checkLeft("inner left vs. inner bottom", "left2", "bottom3");
checkAbove("inner top vs. center", "top3", "center");
checkAbove("center vs. inner bottom", "center", "bottom3");
checkLeft("inner right vs. inner top", "top3", "right2");
checkLeft("inner right vs. center", "center", "right2");
checkAbove("inner bottom bar above second bottom bar", "bottom3", "bottom2");
checkAbove("second bottom bar above bottom bar", "bottom2", "bottom1");
}
dojo.ready(function(){
doh.robot.initRobot('../test_BorderContainer_nested.html');
doh.register("initial layout", [
function nestedBC(){
checkBCpanes(dijit.byId("nbc"));
doh.t(isVisible(dijit.byId("nbc")));
checkInside("nbc", "tc");
},
function layoutPriorityBC(){
dijit.byId("tc").selectChild(dijit.byId("pbc"));
doh.t(isVisible(dijit.byId("pbc")), "second pane visible");
// Check layout of BorderContainer panes relative to each other
checkLayoutPriorityBC();
// Check that all panes within BC borders
var children = dijit.byId("pbc").getChildren();
doh.is(11, children.length, "# of children");
dojo.forEach(children, function(child){
checkInside(child, dijit.byId("pbc"));
});
}
]);
// Verify that tab stops are as per original markup (i.e., children are still in the
// logical order specified in the original markup)
doh.register("tabIndex", function tabstops(){
var tabstops = tabOrder(dijit.byId("pbc").domNode);
doh.is(21, tabstops.length);
doh.is("tabstop #1", tabstops[0].value);
doh.is("tabstop #3", tabstops[2].value);
doh.is("tabstop #5", tabstops[4].value);
doh.is("tabstop #7", tabstops[6].value);
doh.is("tabstop #9", tabstops[8].value);
doh.is("tabstop #11", tabstops[10].value);
doh.is("tabstop #12", tabstops[11].value);
doh.is("tabstop #14", tabstops[13].value);
doh.is("tabstop #16", tabstops[15].value);
doh.is("tabstop #18", tabstops[17].value);
doh.is("tabstop #20", tabstops[19].value);
});
doh.register("keyboard", [
{
name: "top1",
timeout: 10000,
runTest: function(){
var d = new doh.Deferred();
var top1Size, centerSize;
doh.robot.sequence(function(){
dojo.byId("top1_splitter").focus();
top1Size = dojo.position("top1");
centerSize = dojo.position("center");
}, 500, 500);
doh.robot.keyPress(dojo.keys.DOWN_ARROW, 500, {});
doh.robot.keyPress(dojo.keys.DOWN_ARROW, 500, {});
doh.robot.keyPress(dojo.keys.DOWN_ARROW, 500, {});
doh.robot.sequence(d.getTestCallback(function(){
doh.t(within(top1Size.h + 3, dojo.position("top1").h, 0.5), "top size increased");
doh.t(within(centerSize.h - 3, dojo.position("center").h, 0.5), "center size decreased");
}), 500);
return d;
}
},
{
name: "right1",
timeout: 10000,
runTest: function(){
var d = new doh.Deferred();
var right1Size, centerSize, top2Size, bottom1Size;
doh.robot.sequence(function(){
dojo.byId("right1_splitter").focus();
right1Size = dojo.position("right1");
centerSize = dojo.position("center");
top2Size = dojo.position("top2");
bottom1Size = dojo.position("bottom1");
}, 500, 500);
doh.robot.keyPress(dojo.keys.LEFT_ARROW, 500, {});
doh.robot.keyPress(dojo.keys.LEFT_ARROW, 500, {});
doh.robot.keyPress(dojo.keys.LEFT_ARROW, 500, {});
doh.robot.sequence(d.getTestCallback(function(){
doh.t(within(right1Size.w + 3, dojo.position("right1").w, 0.5), "right size increased");
doh.t(within(centerSize.w - 3, dojo.position("center").w, 0.5), "center size decreased");
doh.t(within(centerSize.w - 3, dojo.position("top3").w, 0.5), "inner top size decreased");
doh.t(within(centerSize.w - 3, dojo.position("bottom3").w, 0.5), "inner bottom size decreased");
doh.t(within(top2Size.h, dojo.position("top2").h, 0.5), "top2 height unchanged");
doh.t(within(top2Size.w, dojo.position("top2").w, 0.5), "top2 width unchanged");
doh.t(within(bottom1Size.h, dojo.position("bottom1").h, 0.5), "bottom1 height unchanged");
doh.t(within(bottom1Size.w, dojo.position("bottom1").w, 0.5), "bottom1 width unchanged");
}), 500);
return d;
}
}
]);
doh.run();
});
</script>
</head>
</html>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

838
master/examples/Buffer.html Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,505 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Builder Perf Arguments Tests</title>
<script type="text/javascript" src="../../../dojo/dojo.js" djConfig="isDebug: true"></script>
<script type="text/javascript" src="../Builder.js"></script>
<script type="text/javascript" src="lipsum.js"></script>
<script type="text/javascript">
dojo.addOnLoad(function(){
dojo.byId("run").disabled="";
dojo.connect(dojo.byId("run"),
"onclick",
function(evt) {
setTimeout(function() {
var words = parseInt(dojo.byId("numWords").value) || 10;
var iters = parseInt(dojo.byId("numIters").value) || 1000;
var dict = eval(dojo.byId("dict").value);
buildAndRunSet(words, dict, iters);
}, 0);
});
});
function element(tag, textOrChildOrArray) {
var e = document.createElement(tag);
function append(n) {
if(dojo.isString(n)){
n = document.createTextNode(n);
}
e.appendChild(n);
}
if(dojo.isArray(textOrChildOrArray)) {
dojo.forEach(textOrChildOrArray, append);
}else{
append(textOrChildOrArray);
}
return e;
}
function log(t) {
dojo.byId("mess").innerHTML = t;
console.log(t);
}
function reportRun(results){
var runs = results.runs
var report = element("dl",
element("dt",
"Run with " + results.words + " words, " +
results.iterations + " iterations, for loop overhead of " +
results.overhead + ", average phrase of " +
results.wordSize + " characters"));
// runs.sort(function(a,b) { return a.time - b.time; });
dojo.forEach(runs, function(r) {
report.appendChild(element("dd", r.time + " - " + r.name));
});
dojo.body().appendChild(report);
}
function runTest(test, iterations, expected) {
var i;
if(expected != test()) throw new Error("Test failed expecting " + expected + ", got " + test());
var start = new Date().getTime(), end;
for(i=0; i < iterations; i++){
test();
}
end = new Date().getTime();
return end-start;
}
function runSet(set, iterations){
function averagePhraseLen(words) {
var sizes = dojo.map(words, function(w) { return w.length; });
var total = 0;
dojo.forEach(sizes, function(s) { total += s; });
return total / sizes.length;
}
var tests = set.tests.concat(); //copy tests
var resultSet = {};
resultSet.words = set.words.length;
resultSet.overhead = runTest(set.overhead, iterations);
resultSet.iterations = iterations;
resultSet.wordSize = averagePhraseLen(set.words);
var runs = [];
function _run() {
var t = tests.pop();
try {
log("Running " + t.name);
if(t) runs.push({ name: t.name, time: runTest(t.test, iterations, set.expected)});
} catch(e) {
console.error("Error running " + t.name);
console.error(e);
}
if(tests.length > 0) {
setTimeout(_run, 0);
}
else {
log("Done!");
resultSet.runs = runs;
reportRun(resultSet);
dojo.publish("perf/run/done");
}
}
setTimeout(_run, 25);
}
function buildTestSet(numWords, dict) {
var words = [], i, dl = dict.length;
for(i = numWords; i > 0; i-=dl) {
if(i >= dl) { words = words.concat(dict); }
else { words = words.concat(dict.slice(-i)); }
}
if(words.length != numWords) throw new Error("wrong number of words, got " + words.length + ", expected " + numWords);
var expected = words.join("");
var _builder = new dojox.string.Builder();
return {
tests: [
/*
{
name: "concatFor",
test: function() {
var s = "";
for(var i = 0; i < words.length; i++) {
s = s.concat(words[i]);
}
return s;
}
},
{
name: "concatForAlias",
test: function() {
var s = "", w = words, l = w.length;
for(var i = 0; i < l; i++) {
s = s.concat(w[i]);
}
return s;
}
},
{
name: "concatForEach",
test: function() {
var s = "";
dojo.forEach(words, function(w) {
s = s.concat(w);
});
return s;
}
},
{
name: "concatOnce",
test: function() {
var s = "";
s = String.prototype.concat.apply(s, words);
return s;
}
},
*/
{
name: "builderFor",
test: function() {
var b = new dojox.string.Builder();
for(var i = 0; i < words.length; i++) {
b.append(words[i]);
}
return b.toString();
}
},
{
name: "builderFor2Args",
test: function() {
var b = new dojox.string.Builder(), l=words.length, r=words.length%2;
for(var i = 0; i < words.length; i+=2) {
b.append(words[i], words[i+1]);
}
for(i=l-r; i<l; i++){
b.append(words[i]);
}
return b.toString();
}
},
{
name: "builderFor3Args",
test: function() {
var b = new dojox.string.Builder(), l=words.length, r=words.length%3;
for(var i = 0; i < l-r; i+=3) {
b.append(words[i], words[i+1], words[i+2]);
}
for(i=l-r; i<l; i++){
b.append(words[i]);
}
return b.toString();
}
},
{
name: "builderFor4Args",
test: function() {
var b = new dojox.string.Builder(), l=words.length, r=words.length%4;
for(var i = 0; i < l-r; i+=4) {
b.append(words[i], words[i+1], words[i+2], words[i+3]);
}
for(i=l-r; i<l; i++){
b.append(words[i]);
}
return b.toString();
}
},
{
name: "builderFor5Args",
test: function() {
var b = new dojox.string.Builder(), l=words.length, r=words.length%5;
for(var i = 0; i < l-r; i+=5) {
b.append(words[i], words[i+1], words[i+2], words[i+3], words[i+4]);
}
for(i=l-r; i<l; i++){
b.append(words[i]);
}
return b.toString();
}
},
{
name: "builderFor6Args",
test: function() {
var b = new dojox.string.Builder(), l=words.length, r=words.length%6;
for(var i = 0; i < l-r; i+=6) {
b.append(words[i], words[i+1], words[i+2], words[i+3], words[i+4], words[i+5]);
}
for(i=l-r; i<l; i++){
b.append(words[i]);
}
return b.toString();
}
},
{
name: "builderFor7Args",
test: function() {
var b = new dojox.string.Builder(), l=words.length, r=words.length%7;
for(var i = 0; i < l-r; i+=7) {
b.append(words[i], words[i+1], words[i+2], words[i+3], words[i+4], words[i+5], words[i+6]);
}
for(i=l-r; i<l; i++){
b.append(words[i]);
}
return b.toString();
}
},
{
name: "builderFor8Args",
test: function() {
var b = new dojox.string.Builder(), l=words.length, r=words.length%8;
for(var i = 0; i < l-r; i+=8) {
b.append(words[i], words[i+1], words[i+2], words[i+3], words[i+4], words[i+5], words[i+6], words[i+7]);
}
for(i=l-r; i<l; i++){
b.append(words[i]);
}
return b.toString();
}
},
{
name: "builderFor9Args",
test: function() {
var b = new dojox.string.Builder(), l=words.length, r=words.length%9;
for(var i = 0; i < l-r; i+=9) {
b.append(words[i], words[i+1], words[i+2], words[i+3], words[i+4], words[i+5], words[i+6], words[i+7], words[i+8]);
}
for(i=l-r; i<l; i++){
b.append(words[i]);
}
return b.toString();
}
} /*,
{
name: "builderForEach",
test: function() {
var b = new dojox.string.Builder();
dojo.forEach(words, function(w) {
b.append(w);
});
return b.toString();
}
},
{
name: "builderReusedFor",
test: function() {
_builder.clear();
for(var i = 0; i < words.length; i++) {
_builder.append(words[i]);
}
return _builder.toString();
}
},
{
name: "builderOnce",
test: function() {
var b = new dojox.string.Builder();
b.appendArray(words);
return b.toString();
}
},
{
name: "builderReusedOnce",
test: function() {
_builder.clear();
_builder.appendArray(words);
return _builder.toString();
}
},
{
name: "plusFor",
test: function() {
var s = "";
for(var i = 0; i < words.length; i++) {
s += words[i];
}
return s;
}
},
{
name: "plusForAlias",
test: function() {
var s = "", w = words, l = w.length;
for(var i = 0; i < l; i++) {
s += w[i];
}
return s;
}
},
{
name: "plusForEach",
test: function() {
var s = "";
dojo.forEach(words, function(w) { s += w; });
return s;
}
},
{
name: "joinOnce",
test: function() {
return words.join("");
}
},
{
name: "joinFor",
test: function() {
var a = [];
for(var i = 0; i < words.length; i++) {
a.push(words[i]);
}
return a.join("");
}
},
{
name: "joinForAlias",
test: function() {
var a = [], w = words, l = w.length;
for(var i = 0; i <l; i++) {
a.push(w[i]);
}
return a.join("");
}
},
{
name: "joinForEach",
test: function() {
var a = [];
dojo.forEach(words, function(w) { a.push(w); });
return a.join("");
}
}
*/
],
words: words,
expected: expected,
overhead: function() {
var w = words;
var l = w.length;
for(var i=0; i < l; i++) {
ident(w[i]);
}
}
};
}
function buildAndRunSet(words, dict, times) {
runSet(buildTestSet(words, dict), times);
}
function runSuite() {
var suite = [
{
words: 2,
times: 10000
},
{
words: 4,
times: 10000
},
{
words: 8,
times: 10000
},
{
words: 16,
times: 10000
},
{
words: 32,
times: 10000
},
{
words: 64,
times: 10000
},
{
words: 128,
times: 1000
},
{
words: 256,
times: 1000
},
{
words: 512,
times: 1000
},
{
words: 1024,
times: 1000
},
{
words: 2048,
times: 1000
},
{
words: 4096,
times: 100
},
{
words: 8192,
times: 100
}
];
var totalSuite = dojo.map(suite, function(s) { var n = {}; dojo.mixin(n,s); n.dict = lipsum; return n; });
totalSuite = totalSuite.concat(dojo.map(suite, function(s) { var n = {}; dojo.mixin(n,s); n.dict = lipsumLong; return n; }));
console.log(totalSuite);
var handle = dojo.subscribe("perf/run/done", _run);
dojo.subscribe("perf/run/done", function(){ console.log("perf run done"); });
function _run() {
var t = totalSuite.shift();
if(t) buildAndRunSet(t.words, t.dict, t.times);
if(totalSuite.length == 0) dojo.unsubscribe(handle);
}
_run();
}
function ident(i) { return i; }
</script>
<style type="text/css">
html {
font-family: Lucida Grande, Tahoma;
}
div { margin-bottom: 1em; }
#results {
border: 1px solid #999;
border-collapse: collapse;
}
#results caption {
font-size: medium;
font-weight: bold;
}
#results td, #results th {
text-align: right;
width: 10em;
font-size: small;
white-space: nowrap;
}
#wordsCol { background: yellow; }
td.max { color: red; font-weight: bold; }
td.min { color: green; font-weight: bold; }
</style>
</head>
<body>
<table>
<tr><td><label for="numWords">Words</label></td><td><input type="text" id="numWords" value="100"/></td></tr>
<tr><td><label for="numIters">Iterations</label></td><td><input type="text" id="numIters" value="1000"/></td></tr>
<tr><td><label for="dict">Dictionary</label></td><td><input type="text" id="dict" value="lipsum"></td></tr>
<tr><td></td><td><button id="run" disabled>Run Tests!</button></td></tr>
</table>
<div id="mess"></div>
</body>
</html>

View File

@@ -0,0 +1,413 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Builder Perf Tests</title>
<script type="text/javascript" src="../../../dojo/dojo.js"></script>
<script type="text/javascript" src="../Builder.js"></script>
<script type="text/javascript" src="lipsum.js"></script>
<script type="text/javascript">
dojo.addOnLoad(function(){
dojo.byId("run").disabled="";
dojo.connect(dojo.byId("run"),
"onclick",
function(evt) {
setTimeout(function() {
var words = parseInt(dojo.byId("numWords").value) || 10;
var iters = parseInt(dojo.byId("numIters").value) || 1000;
var dict = eval(dojo.byId("dict").value);
buildAndRunSet(words, dict, iters);
}, 0);
});
});
function element(tag, textOrChildOrArray) {
var e = document.createElement(tag);
function append(n) {
if(dojo.isString(n)){
n = document.createTextNode(n);
}
e.appendChild(n);
}
if(dojo.isArray(textOrChildOrArray)) {
dojo.forEach(textOrChildOrArray, append);
}else{
append(textOrChildOrArray);
}
return e;
}
function log(t) {
dojo.byId("mess").innerHTML = t;
console.log(t);
}
function reportRun(results){
var runs = results.runs
var report = element("dl",
element("dt",
"Run with " + results.words + " words, " +
results.iterations + " iterations, for loop overhead of " +
results.overhead + ", average phrase of " +
results.wordSize + " characters"));
runs.sort(function(a,b) { return a.time - b.time; });
dojo.forEach(runs, function(r) {
report.appendChild(element("dd", r.time + " - " + r.name));
});
dojo.body().appendChild(report);
}
function runTest(test, iterations, expected) {
var i;
if(expected != test()) throw new Error("Test failed expecting " + expected + ", got " + test());
var start = new Date().getTime(), end;
for(i=0; i < iterations; i++){
test();
}
end = new Date().getTime();
return end-start;
}
function runSet(set, iterations){
function averagePhraseLen(words) {
var sizes = dojo.map(words, function(w) { return w.length; });
var total = 0;
dojo.forEach(sizes, function(s) { total += s; });
return total / sizes.length;
}
var tests = set.tests.concat(); //copy tests
var resultSet = {};
resultSet.words = set.words.length;
resultSet.overhead = runTest(set.overhead, iterations);
resultSet.iterations = iterations;
resultSet.wordSize = averagePhraseLen(set.words);
var runs = [];
function _run() {
var t = tests.pop();
try {
log("Running " + t.name);
if(t) runs.push({ name: t.name, time: runTest(t.test, iterations, set.expected)});
} catch(e) {
console.error("Error running " + t.name);
console.error(e);
}
if(tests.length > 0) {
setTimeout(_run, 0);
}
else {
log("Done!");
resultSet.runs = runs;
reportRun(resultSet);
dojo.publish("perf/run/done");
}
}
setTimeout(_run, 25);
}
function buildTestSet(numWords, dict) {
var words = [], i, dl = dict.length;
for(i = numWords; i > 0; i-=dl) {
if(i >= dl) { words = words.concat(dict); }
else { words = words.concat(dict.slice(-i)); }
}
if(words.length != numWords) throw new Error("wrong number of words, got " + words.length + ", expected " + numWords);
var expected = words.join("");
var _builder = new dojox.string.Builder();
return {
tests: [
{
name: "concatFor",
test: function() {
var s = "";
for(var i = 0; i < words.length; i++) {
s = s.concat(words[i]);
}
return s;
}
},
/*
{
name: "concatForAlias",
test: function() {
var s = "", w = words, l = w.length;
for(var i = 0; i < l; i++) {
s = s.concat(w[i]);
}
return s;
}
},
{
name: "concatForEach",
test: function() {
var s = "";
dojo.forEach(words, function(w) {
s = s.concat(w);
});
return s;
}
},
*/
{
name: "concatOnce",
test: function() {
var s = "";
s = String.prototype.concat.apply(s, words);
return s;
}
},
{
name: "builderFor",
test: function() {
var b = new dojox.string.Builder();
for(var i = 0; i < words.length; i++) {
b.append(words[i]);
}
return b.toString();
}
},
{
name: "builderForMulti",
test: function() {
var b = new dojox.string.Builder();
for(var i = 0; i < words.length; i+=2) {
b.append(words[i], words[i+1]);
}
return b.toString();
}
},
/*
{
name: "builderForEach",
test: function() {
var b = new dojox.string.Builder();
dojo.forEach(words, function(w) {
b.append(w);
});
return b.toString();
}
},
*/
{
name: "builderReusedFor",
test: function() {
_builder.clear();
for(var i = 0; i < words.length; i++) {
_builder.append(words[i]);
}
return _builder.toString();
}
},
{
name: "builderOnce",
test: function() {
var b = new dojox.string.Builder();
b.appendArray(words);
return b.toString();
}
},
{
name: "builderReusedOnce",
test: function() {
_builder.clear();
_builder.appendArray(words);
return _builder.toString();
}
},
{
name: "plusFor",
test: function() {
var s = "";
for(var i = 0; i < words.length; i++) {
s += words[i];
}
return s;
}
},
/*
{
name: "plusForAlias",
test: function() {
var s = "", w = words, l = w.length;
for(var i = 0; i < l; i++) {
s += w[i];
}
return s;
}
},
{
name: "plusForEach",
test: function() {
var s = "";
dojo.forEach(words, function(w) { s += w; });
return s;
}
},*/
{
name: "joinOnce",
test: function() {
return words.join("");
}
},
{
name: "joinFor",
test: function() {
var a = [];
for(var i = 0; i < words.length; i++) {
a.push(words[i]);
}
return a.join("");
}
}/*,
{
name: "joinForAlias",
test: function() {
var a = [], w = words, l = w.length;
for(var i = 0; i <l; i++) {
a.push(w[i]);
}
return a.join("");
}
},
{
name: "joinForEach",
test: function() {
var a = [];
dojo.forEach(words, function(w) { a.push(w); });
return a.join("");
}
}
*/
],
words: words,
expected: expected,
overhead: function() {
var w = words;
var l = w.length;
for(var i=0; i < l; i++) {
ident(w[i]);
}
}
};
}
function buildAndRunSet(words, dict, times) {
runSet(buildTestSet(words, dict), times);
}
function runSuite() {
var suite = [
{
words: 2,
times: 10000
},
{
words: 4,
times: 10000
},
{
words: 8,
times: 10000
},
{
words: 16,
times: 10000
},
{
words: 32,
times: 10000
},
{
words: 64,
times: 10000
},
{
words: 128,
times: 1000
},
{
words: 256,
times: 1000
},
{
words: 512,
times: 1000
},
{
words: 1024,
times: 1000
},
{
words: 2048,
times: 1000
},
{
words: 4096,
times: 100
},
{
words: 8192,
times: 100
}
];
var totalSuite = dojo.map(suite, function(s) { var n = {}; dojo.mixin(n,s); n.dict = lipsum; return n; });
totalSuite = totalSuite.concat(dojo.map(suite, function(s) { var n = {}; dojo.mixin(n,s); n.dict = lipsumLong; return n; }));
console.log(totalSuite);
var handle = dojo.subscribe("perf/run/done", _run);
dojo.subscribe("perf/run/done", function(){ console.log("perf run done"); });
function _run() {
var t = totalSuite.shift();
if(t) buildAndRunSet(t.words, t.dict, t.times);
if(totalSuite.length == 0) dojo.unsubscribe(handle);
}
_run();
}
function ident(i) { return i; }
</script>
<style type="text/css">
html {
font-family: Lucida Grande, Tahoma;
}
div { margin-bottom: 1em; }
#results {
border: 1px solid #999;
border-collapse: collapse;
}
#results caption {
font-size: medium;
font-weight: bold;
}
#results td, #results th {
text-align: right;
width: 10em;
font-size: small;
white-space: nowrap;
}
#wordsCol { background: yellow; }
td.max { color: red; font-weight: bold; }
td.min { color: green; font-weight: bold; }
</style>
</head>
<body>
<table>
<tr><td><label for="numWords">Words</label></td><td><input type="text" id="numWords" value="100"/></td></tr>
<tr><td><label for="numIters">Iterations</label></td><td><input type="text" id="numIters" value="1000"/></td></tr>
<tr><td><label for="dict">Dictionary</label></td><td><input type="text" id="dict" value="lipsum"></td></tr>
<tr><td></td><td><button id="run" disabled>Run Tests!</button></td></tr>
</table>
<div id="mess"></div>
</body>
</html>

View File

@@ -0,0 +1,17 @@
<span class="dijit dijitReset dijitInline" role="presentation"
><span class="dijitReset dijitInline dijitButtonNode"
data-dojo-attach-event="ondijitclick:_onClick" role="presentation"
><span class="dijitReset dijitStretch dijitButtonContents"
data-dojo-attach-point="titleNode,focusNode"
role="button" aria-labelledby="${id}_label"
><span class="dijitReset dijitInline dijitIcon" data-dojo-attach-point="iconNode"></span
><span class="dijitReset dijitToggleButtonIconChar">&#x25CF;</span
><span class="dijitReset dijitInline dijitButtonText"
id="${id}_label"
data-dojo-attach-point="containerNode"
></span
></span
></span
><input ${!nameAttrSetting} type="${type}" value="${value}" class="dijitOffScreen"
tabIndex="-1" role="presentation" data-dojo-attach-point="valueNode"
/></span>

View File

@@ -0,0 +1,50 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>doh.robot Tooltip Mouse Quirks Test</title>
<style>
@import "../../../../util/doh/robot/robot.css";
</style>
<!-- required: dojo.js -->
<script type="text/javascript" src="../../../../dojo/dojo.js"
djConfig="isDebug: true"></script>
<!-- functions to help test -->
<!-- script type="text/javascript" src="../helpers.js"></script -->
<script type="text/javascript">
dojo.require("dijit.robotx");
dojo.addOnLoad(function(){
doh.robot.initRobot("../test_Android-ButtonList.html");
doh.register("dojox.mobile.ButtonList mouse tests", [
{
name: "ButtonList mouse tests",
timeout: 4000,
runTest: function(){
var d = new doh.Deferred();
doh.robot.mouseMoveAt(dojo.query(".mblDomButton", dijit.byId("dojox_mobile_ListItem_0").domNode)[0], 1000);
doh.robot.mouseClick({left: true}, 500);
doh.robot.mouseMoveAt(dojo.query(".mblDomButton", dijit.byId("dojox_mobile_ListItem_1").domNode)[0], 500);
doh.robot.mouseClick({left: true}, 500);
doh.robot.sequence(d.getTestCallback(function(){
doh.assertTrue(dojo.hasClass(dojo.query(".mblDomButton", dijit.byId("dojox_mobile_ListItem_0").domNode)[0], "mblDomButtonCheckboxOn"));
doh.assertTrue(dojo.hasClass(dojo.query(".mblDomButton", dijit.byId("dojox_mobile_ListItem_1").domNode)[0], "mblDomButtonCheckboxOff"));
}), 500);
return d;
}
}
]);
doh.run();
});
</script>
</head>
</html>

View File

@@ -0,0 +1,50 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>doh.robot Tooltip Mouse Quirks Test</title>
<style>
@import "../../../../util/doh/robot/robot.css";
</style>
<!-- required: dojo.js -->
<script type="text/javascript" src="../../../../dojo/dojo.js"
djConfig="isDebug: true"></script>
<!-- functions to help test -->
<!-- script type="text/javascript" src="../helpers.js"></script -->
<script type="text/javascript">
dojo.require("dijit.robotx");
dojo.addOnLoad(function(){
doh.robot.initRobot("../test_iPhone-ButtonList.html");
doh.register("dojox.mobile.ButtonList mouse tests", [
{
name: "ButtonList mouse tests",
timeout: 4000,
runTest: function(){
var d = new doh.Deferred();
doh.robot.mouseMoveAt(dojo.query(".mblDomButton", dijit.byId("dojox_mobile_ListItem_0").domNode)[0], 1000);
doh.robot.mouseClick({left: true}, 500);
doh.robot.mouseMoveAt(dojo.query(".mblDomButton", dijit.byId("dojox_mobile_ListItem_1").domNode)[0], 500);
doh.robot.mouseClick({left: true}, 500);
doh.robot.sequence(d.getTestCallback(function(){
doh.assertTrue(dojo.hasClass(dojo.query(".mblDomButton", dijit.byId("dojox_mobile_ListItem_0").domNode)[0], "mblDomButtonRedMinus"));
doh.assertTrue(dojo.hasClass(dojo.query(".mblDomButton", dijit.byId("dojox_mobile_ListItem_1").domNode)[0], "mblDomButtonBluePlus"));
}), 500);
return d;
}
}
]);
doh.run();
});
</script>
</head>
</html>

View File

@@ -0,0 +1,168 @@
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,minimum-scale=1,user-scalable=no"/>
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<title>_ButtonMixin tests</title>
<style type="text/css">
@import "../../themes/claro/document.css";
@import "../../themes/dijit.css";
#table {
margin: 0;
padding: 2px;
}
#table, .dijit, BUTTON {
font-family: monospace;
font-size: 12pt;
}
#table .layout {
padding: 2px;
font-size: 100%;
margin: 0;
}
</style>
<link id="themeStyles" rel="stylesheet" href="../../../dijit/themes/claro/claro.css"/>
<script type="text/javascript" src="../../../dojo/dojo.js"
data-dojo-config="parseOnLoad: true, isDebug: true"></script>
<script type="text/javascript">
dojo.require("doh.runner");
dojo.require("dijit.dijit"); // optimize: load dijit layer
dojo.require("dijit.form.Button");
dojo.require("dojox.mobile.Button");
dojo.ready(function(){
doh.register("attributes", [
{
name: "dijit",
runTest: function(){
var dijit_attributes = dijit.byId('dijit_attributes');
doh.is("original", dijit_attributes.get('label'), "dijit original get('label')");
dijit_attributes.set('label', "label");
doh.is("label", dijit_attributes.get('label'), "dijit get('label')");
doh.t(dojo.hasClass(dijit_attributes.domNode, dijit_attributes.baseClass), "dijit baseClass");
doh.t(dojo.hasClass(dijit_attributes.domNode, "mblRedButton"), "dijit original class");
dijit_attributes.set('class', "mblBlueButton");
doh.t(dojo.hasClass(dijit_attributes.domNode, "mblBlueButton"), "dijit new class");
}
},
{
name: "mobile",
runTest: function(){
var mobile_attributes = dijit.byId('mobile_attributes');
doh.is("original", mobile_attributes.get('label'), "mobile original get('label')");
mobile_attributes.set('label', "label");
doh.is("label", mobile_attributes.get('label'), "mobile get('label')");
doh.t(dojo.hasClass(mobile_attributes.domNode, mobile_attributes.baseClass), "mobile baseClass");
doh.t(dojo.hasClass(mobile_attributes.domNode, "mblRedButton"), "mobile original class");
mobile_attributes.set('class', "mblBlueButton");
doh.t(dojo.hasClass(mobile_attributes.domNode, "mblBlueButton"), "mobile new class");
}
}
]);
doh.register("events", [
{
name: "dijit",
timeout: 2000,
runTest: function(){
var
dijit_events = dijit.byId('dijit_events'),
calledOnClick = false,
nop = function(){ return false; };
function onClick(){
dijit_events.set('onClick', nop);
calledOnClick = true;
return true;
}
doh.f(dijit_events._onClick({ preventDefault: nop }), "_onClick");
dijit_events.set('onClick', onClick);
dijit_events._onClick({ preventDefault: nop });
doh.t(calledOnClick, "calledOnClick");
}
},
{
name: "mobile",
timeout: 2000,
runTest: function(){
var
d = new doh.Deferred(),
mobile_events = dijit.byId('mobile_events'),
nop = function(){ return false; };
function onClick(){
mobile_events.set('onClick', nop);
d.callback(true);
return true;
}
doh.f(mobile_events._onClick({ preventDefault: nop }), "_onClick");
mobile_events.set("onClick", onClick);
setTimeout(function(){ mobile_events.focusNode.click({ preventDefault: nop }); }, 0);
return d;
}
}
]);
doh.register("programmatic", [
{
name: "dijit",
timeout: 2000,
runTest: function(){
new dijit.form.Button({id:"dijit_programmatic", type:"button", label:"No srcNodeRef"}).placeAt("dijit_programmatic_container", "first");
var dijit_programmatic = dijit.byId('dijit_programmatic');
var pos = dojo.position(dijit_programmatic.domNode, true);
doh.t(pos.w > 0 && pos.h > 0 && pos.x > 0 && pos.y > 0, 'dijit position');
doh.is("No srcNodeRef", dijit_programmatic.get('label'), 'dijit widget label');
}
},
{
name: "mobile",
timeout: 2000,
runTest: function(){
new dojox.mobile.Button({id:"mobile_programmatic", type:"button", label:"No srcNodeRef"}).placeAt("mobile_programmatic_container", "first");
var mobile_programmatic = dijit.byId('mobile_programmatic');
var pos = dojo.position(mobile_programmatic.domNode, true);
doh.t(pos.w > 0 && pos.h > 0 && pos.x > 0 && pos.y > 0, 'mobile position');
doh.is("No srcNodeRef", mobile_programmatic.get('label'), 'mobile widget label');
}
}
]);
doh.run();
});
</script>
</head>
<body class="claro">
<h1 class="testTitle">_ButtonMixin (dijit and mobile) non-robot tests</h1>
<table id="table">
<tr>
<th class="layout">&nbsp;</th>
<th class="layout">dijit</th>
<th class="layout">mobile</th>
</tr>
<tr>
<td class="layout">attributes</td>
<td class="layout"><input id="dijit_attributes" data-dojo-type="dijit.form.Button" data-dojo-props='type:"button", label:"original", "class":"mblRedButton"'/></td>
<td class="layout"><button type="button" class="mblRedButton" id="mobile_attributes" dojoType="dojox.mobile.Button" label="original"/></td>
</tr>
<tr>
<tr>
<td class="layout">Events</td>
<td class="layout"><button id="dijit_events" data-dojo-type="dijit.form.Button" data-dojo-props='type:"button", onClick:function(){ return false; }'>innerHTML</button></td>
<td class="layout"><button type="button" id="mobile_events" data-dojo-type="dojox.mobile.Button" data-dojo-props='type:"button", onClick:function(){ return false; }'>innerHTML</button></td>
</tr>
<tr>
<td class="layout">Programmatic</td>
<td class="layout" id="dijit_programmatic_container"></td>
<td class="layout" id="mobile_programmatic_container"></td>
</tr>
</table>
</body>
</html>

View File

@@ -0,0 +1,55 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,minimum-scale=1,user-scalable=no"/>
<meta name="apple-mobile-web-app-capable" content="yes" />
<title>Button</title>
<link href="../../themes/iphone/iphone.css" rel="stylesheet">
<style>
.redButton {
border-color: #cc3333;
background-image: url(../images/red-button-bg.png);
background: -webkit-gradient(linear, left top, left bottom, from(#D3656D), to(#BC1320), color-stop(0.5, #C9404B), color-stop(0.5, #BC1421));
}
.redButtonSelected {
background-image: url(../images/red-button-sel-bg.png);
background: -webkit-gradient(linear, left top, left bottom, from(#AF333C), to(#880E17), color-stop(0.5, #952B33), color-stop(0.5, #870F18));
}
</style>
<script type="text/javascript" src="../../../../dojo/dojo.js" djConfig="parseOnLoad: true"></script>
<script language="JavaScript" type="text/javascript">
//dojo.require("dojo.parser"); // Use the lightweight parser.
dojo.require("dojox.mobile.parser");
dojo.require("dojox.mobile");
dojo.require("dojox.mobile.Button");
dojo.requireIf(!dojo.isWebKit, "dojox.mobile.compat");
dojo.require("doh.runner");
dojo.addOnLoad(function(){
var demoWidget = new dojox.mobile.Button({"class":"mblBlueButton", style:"width:120px", label:"Default Button"});
dojo.doc.body.appendChild(demoWidget.domNode);
var child = dojo.create("P", null, dojo.doc.body);
demoWidget = new dojox.mobile.Button({"class":"redButton", style:"width:120px", label:"Custom Button"});
dojo.doc.body.appendChild(demoWidget.domNode);
doh.register("dojox.mobile.test.doh.Button", [
function test_Button_Verification(){
var demoWidget = dijit.byId("dojox_mobile_Button_0");
doh.assertEqual('mblButton mblBlueButton', demoWidget.domNode.className);
doh.assertEqual('Default Button', demoWidget.domNode.childNodes[0].nodeValue);
demoWidget = dijit.byId("dojox_mobile_Button_1");
doh.assertEqual('mblButton redButton', demoWidget.domNode.className);
doh.assertEqual('Custom Button', demoWidget.domNode.childNodes[0].nodeValue);
}
]);
doh.run();
});
</script>
</head>
<body style="padding: 20px;visibility:visible">
</body>
</html>

View File

@@ -0,0 +1,503 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>doh.robot Button Test</title>
<style>
@import "../../../../util/doh/robot/robot.css";
</style>
<!-- required: dojo.js -->
<script type="text/javascript" src="../../../../dojo/dojo.js"></script>
<script type="text/javascript" src="../../helpers.js"></script>
<script type="text/javascript">
dojo.require("dijit.robotx");
dojo.ready(function(){
doh.robot.initRobot('../test_Button.html');
var submitCount = 0, resetCount = 0;
doh.register("setup", function(){
doh.robot.sequence(function(){
dojo.connect(dijit.byId("testForm"), "onSubmit", function(){
submitCount++;
});
dojo.connect(dijit.byId("testForm"), "onReset", function(){
resetCount++;
})
});
});
doh.register("dijit.form.Button", [
{
name: "label",
timeout: 1000,
runTest: function(){
var label = dijit.byId("T1465").containerNode.innerHTML;
doh.is('Create', dojo.trim(label), "source.innerHTML label " + label);
var label2 = dijit.byId("T1466").containerNode.innerHTML;
doh.is('View', label2, "subclass label " + label2);
}
},
{
name: "enabled",
timeout: 5000,
runTest: function(){
var d = new doh.Deferred();
dojo.byId("input").focus();
var clicks = 0;
dijit.byId("T1465").set("onClick", function(){ clicks++; });
// tab into button to get focus
doh.robot.keyPress(dojo.keys.TAB, 1000, {});
// and activate with space / enter
doh.robot.keyPress(dojo.keys.SPACE, 1000, {});
doh.robot.keyPress(dojo.keys.ENTER, 500, {});
doh.robot.sequence(d.getTestCallback(function(){
doh.is(2, clicks, "both space and enter click the button");
}), 500);
return d;
}
},
{
name: "disabled no focus",
timeout: 4000,
runTest: function(){
var d = new doh.Deferred();
doh.is("T1465", dijit.getEnclosingWidget(dojo.global.dijit.focus.curNode).id, "focus starting on 1465");
dijit.byId("T1466").set("disabled", true);
// tab over disabled "View" button to "Create" combo-button
doh.robot.keyPress(dojo.keys.TAB, 500, {});
doh.robot.sequence(d.getTestCallback(function(){
console.log("current focus is ", dojo.global.dijit.focus.curNode);
doh.is("comboCreate", dijit.getEnclosingWidget(dojo.global.dijit.focus.curNode).id, "focus jumped to combo create (left part of button)");
}), 1000);
return d;
}
}
]);
doh.register("dijit.form.DropDownButton", [
{
name: "down arrow opens menu",
timeout: 4000,
runTest: function(){
var d = new doh.Deferred();
dijit.byId("edit").focus();
doh.robot.keyPress(dojo.keys.DOWN_ARROW, 500, {});
doh.robot.sequence(d.getTestCallback(function(){
doh.t(isVisible("editMenu"), "edit menu is visible: " + dijit.byId("editMenu").domNode.style.cssText);
doh.is("cut", dojo.global.dijit.focus.curNode.id, "focus is on menu");
}), 500);
return d;
}
},
{
name: "esc closes menu",
timeout: 4000,
runTest: function(){
var d = new doh.Deferred();
doh.robot.keyPress(dojo.keys.ESCAPE, 500, {});
doh.robot.sequence(d.getTestCallback(function(){
doh.t(isHidden("editMenu"), "edit menu is hidden: " + dijit.byId("editMenu").domNode.style.cssText);
doh.is("edit", dojo.global.dijit.focus.curNode.id, "focus is back on button");
}), 1000);
return d;
}
},
{
name: "space opens menu",
timeout: 4000,
runTest: function(){
var d = new doh.Deferred();
dijit.byId("edit").focus();
doh.robot.keyPress(dojo.keys.SPACE, 500, {});
doh.robot.sequence(d.getTestCallback(function(){
doh.t(isVisible("editMenu"), "edit menu is visible: " + dijit.byId("editMenu").domNode.style.cssText);
}), 1000);
return d;
}
},
{
name: "space executes menu",
timeout: 4000,
runTest: function(){
var d = new doh.Deferred();
doh.robot.keyPress(dojo.keys.SPACE, 500, {});
doh.robot.sequence(d.getTestCallback(function(){
doh.t(isHidden("editMenu"), "edit menu is hidden: " + dijit.byId("editMenu").domNode.style.cssText);
doh.is("edit", dojo.global.dijit.focus.curNode.id, "focus is back on button");
}), 1000);
return d;
}
},
{
name: "enter opens menu",
timeout: 4000,
runTest: function(){
var d = new doh.Deferred();
dijit.byId("edit").focus();
doh.robot.keyPress(dojo.keys.ENTER, 500, {});
doh.robot.sequence(d.getTestCallback(function(){
doh.t(isVisible("editMenu"), "edit menu is visible: " + dijit.byId("editMenu").domNode.style.cssText);
}), 1000);
return d;
}
},
{
name: "tab key closes popup, goes back to button",
timeout: 4000,
runTest: function(){
var d = new doh.Deferred();
doh.robot.keyPress(dojo.keys.TAB, 500, {});
doh.robot.sequence(d.getTestCallback(function(){
doh.t(isHidden("editMenu"), "edit menu is hidden: " + dijit.byId("editMenu").domNode.style.cssText);
doh.is("edit", dojo.global.dijit.focus.curNode.id, "focus is back on button");
}), 1000);
return d;
}
},
{
name: "enter opens menu again",
timeout: 4000,
runTest: function(){
var d = new doh.Deferred();
dijit.byId("edit").focus();
doh.robot.keyPress(dojo.keys.ENTER, 500, {});
doh.robot.sequence(d.getTestCallback(function(){
doh.t(isVisible("editMenu"), "edit menu is visible: " + dijit.byId("editMenu").domNode.style.cssText);
}), 1000);
return d;
}
},
{
name: "enter closes menu (#4772)",
timeout: 4000,
runTest: function(){
var d = new doh.Deferred();
doh.robot.keyPress(dojo.keys.ENTER, 500, {});
doh.robot.sequence(d.getTestCallback(function(){
doh.t(isHidden("editMenu"), "edit menu is hidden: " + dijit.byId("editMenu").domNode.style.cssText);
doh.is("edit", dojo.global.dijit.focus.curNode.id, "focus is back on button");
}), 1000);
return d;
}
}
]);
doh.register("dijit.form.ComboButton", [
{
name: "tab to button",
timeout: 4000,
runTest: function(){
var d = new doh.Deferred();
dijit.byId("color").focus();
doh.robot.keyPress(dojo.keys.TAB, 1000, {});
var leftPart = dojo.query(".dijitButtonContents", dojo.byId("save"))[0];
doh.t(leftPart, "found left part of button");
doh.robot.sequence(d.getTestCallback(function(){
doh.is(leftPart, dojo.global.dijit.focus.curNode, "focused on left part");
console.log("cur focus: ", dojo.global.dijit.focus.curNode);
}), 1000);
return d;
}
},
{
name: "click button",
timeout: 4000,
runTest: function(){
var d = new doh.Deferred();
var clicked = false;
dijit.byId("save").set("onClick", function(){ clicked = true; });
doh.robot.keyPress(dojo.keys.ENTER, 500, {});
doh.robot.sequence(d.getTestCallback(function(){
doh.t(clicked, "button was clicked");
}), 1000);
return d;
}
},
{
name: "tab to drop down arrow",
timeout: 4000,
runTest: function(){
var d = new doh.Deferred();
var rightPart = dojo.query(".dijitDownArrowButton", dojo.byId("save"))[0];
doh.t(rightPart, "found right part of button");
doh.robot.keyPress(dojo.keys.TAB, 500, {});
doh.robot.sequence(d.getTestCallback(function(){
doh.is(rightPart, dojo.global.dijit.focus.curNode, "focused on right part of combo");
}), 1000);
return d;
}
},
{
name: "down arrow opens menu",
timeout: 4000,
runTest: function(){
var d = new doh.Deferred();
var rightPart = dojo.query(".dijitDownArrowButton", dojo.byId("save"))[0];
doh.t(rightPart, "found right part of button");
doh.robot.keyPress(dojo.keys.DOWN_ARROW, 500, {});
doh.robot.sequence(d.getTestCallback(function(){
doh.t(isVisible("saveMenu"), "save menu is visible: " + dijit.byId("saveMenu").domNode.style.cssText);
}), 1000);
return d;
}
},
{
name: "esc closes menu",
timeout: 4000,
runTest: function(){
var d = new doh.Deferred();
var rightPart = dojo.query(".dijitDownArrowButton", dojo.byId("save"))[0];
doh.t(rightPart, "found right part of button");
doh.robot.keyPress(dojo.keys.ESCAPE, 500, {});
doh.robot.sequence(d.getTestCallback(function(){
doh.t(isHidden("saveMenu"), "save menu was closed: " + dijit.byId("saveMenu").domNode.style.cssText);
doh.is(rightPart, dojo.global.dijit.focus.curNode, "refocused on right part of combo");
}), 1000);
return d;
}
},
{
name: "enter key opens menu",
timeout: 4000,
runTest: function(){
var d = new doh.Deferred();
doh.robot.keyPress(dojo.keys.ENTER, 500, {});
doh.robot.sequence(d.getTestCallback(function(){
doh.t(isVisible("saveMenu"), "save menu is visible: " + dijit.byId("saveMenu").domNode.style.cssText);
}), 1000);
return d;
}
},
{
name: "tab closes menu",
timeout: 4000,
runTest: function(){
var d = new doh.Deferred();
var rightPart = dojo.query(".dijitDownArrowButton", dojo.byId("save"))[0];
doh.t(rightPart, "found right part of button");
doh.robot.keyPress(dojo.keys.TAB, 500, {});
doh.robot.sequence(d.getTestCallback(function(){
doh.t(isHidden("saveMenu"), "save menu was closed: " + dijit.byId("saveMenu").domNode.style.cssText);
doh.is(rightPart, dojo.global.dijit.focus.curNode, "refocused on right part of combo");
}), 1000);
return d;
}
},
{
name: "tab closes menu",
timeout: 4000,
runTest: function(){
var d = new doh.Deferred();
// Focus element before "save" ComboButton
dijit.byId("color").focus();
// And disable the ComboButton
dijit.byId("save").set("disabled", true);
// Tab should skip over the ComboButton entirely
doh.robot.keyPress(dojo.keys.TAB, 1000, {});
doh.robot.sequence(d.getTestCallback(function(){
var focusedWidget = dijit.getEnclosingWidget(dojo.global.dijit.focus.curNode);
doh.isNot("save", focusedWidget && focusedWidget.id, "didn't focus on combo");
}), 1000);
return d;
}
}
]);
doh.register("dijit.form.ToggleButton", [
{
name: "uncheck",
timeout: 4000,
runTest: function(){
var d = new doh.Deferred();
var checked = dijit.byId("toggle1").get("checked");
doh.t(checked, "toggle1 initially checked");
doh.is("true", dojo.byId('toggle1').getAttribute("aria-pressed"), "aria-pressed 1");
var watchOld, watchNew;
dijit.byId("toggle1").set("onChange", function(v){ checked = v; });
dijit.byId("toggle1").watch("checked", function(name, o, n){
watchOld = o;
watchNew = n;
});
dijit.byId("toggle1").focus();
doh.robot.keyPress(dojo.keys.SPACE, 1000, {});
doh.robot.sequence(d.getTestCallback(function(){
doh.f(checked, "toggle1 unchecked");
doh.is("false", dojo.byId('toggle1').getAttribute("aria-pressed"), "aria-pressed 2");
doh.t(watchOld, "watch: previous == checked");
doh.f(watchNew, "watch: new == unchecked");
}), 1000);
return d;
}
},
{
name: "check",
timeout: 4000,
runTest: function(){
var d = new doh.Deferred();
var checked = dijit.byId("toggle1").get("checked");
doh.f(checked, "toggle1 unchecked");
doh.is("false", dojo.byId('toggle1').getAttribute("aria-pressed"), "aria-pressed 1");
var watchOld, watchNew;
dijit.byId("toggle1").set("onChange", function(v){ checked = v; });
dijit.byId("toggle1").watch("checked", function(name, o, n){
watchOld = o;
watchNew = n;
});
dijit.byId("toggle1").focus();
doh.robot.keyPress(dojo.keys.SPACE, 1000, {});
doh.robot.sequence(d.getTestCallback(function(){
doh.t(checked, "toggle1 checked");
doh.is("true", dojo.byId('toggle1').getAttribute("aria-pressed"), "aria-pressed 2");
doh.f(watchOld, "watch: previous == unchecked");
doh.t(watchNew, "watch: new == checked");
}), 1000);
return d;
}
}
]);
dojo.forEach(["SPACE", "ENTER"], function(key){
doh.register("Invoke Submit and Reset Buttons by " + key, [
{
name: "click Submit",
timeout: 5000,
runTest: function(){
var d = new doh.Deferred();
submitCount = 0;
dijit.byId("bSubmit").focus();
doh.robot.keyPress(dojo.keys[key], 1000, {});
doh.robot.sequence(d.getTestCallback(function(){
doh.is(1, submitCount, (key + ": # of times submit invoked " + submitCount));
}), 500);
return d;
}
},
{
name: "click Reset",
timeout: 7000,
runTest: function(){
var d = new doh.Deferred();
resetCount = 0;
dijit.byId("testName").value = "";
dijit.byId("testName").focus();
doh.robot.typeKeys("test", 1000, 2000);
doh.robot.sequence(function(){
dijit.byId("bReset").focus();
}, 500);
doh.robot.keyPress(dojo.keys[key], 1000, {});
doh.robot.sequence(d.getTestCallback(function(){
doh.is(1, resetCount, (key + ": reset should be invoked 1 time. actual count = " + resetCount));
doh.is("",dijit.byId("testName").value, "Name field has been reset");
}), 1000);
return d;
}
}
]);
});
doh.register("Submit via ENTER key on input", {
name: "enter on input",
timeout: 5000,
runTest: function(){
var d = new doh.Deferred();
submitCount = 0;
dijit.byId("testName").focus();
doh.robot.keyPress(dojo.keys.ENTER, 1000, {});
doh.robot.sequence(d.getTestCallback(function(){
doh.is(1, submitCount, "submitted via enter key on input");
}), 500);
return d;
}
});
doh.run();
});
</script>
</head>
</html>

View File

@@ -0,0 +1,706 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>doh.robot Button Test</title>
<style>
@import "../../../../util/doh/robot/robot.css";
</style>
<!-- required: dojo.js -->
<script type="text/javascript" src="../../../../dojo/dojo.js"></script>
<script type="text/javascript" src="../../helpers.js"></script>
<script type="text/javascript">
dojo.require("dijit.robotx");
dojo.ready(function(){
doh.robot.initRobot('../test_Button.html');
doh.register("dijit.form.Button", [
{
name: "enabled",
timeout: 4000,
runTest: function(){
var d = new doh.Deferred();
var clicked = false;
dijit.byId("T1466").set("onClick", function(){ clicked = true; });
doh.robot.mouseMoveAt("T1466", 500);
doh.robot.mouseClick({left:true}, 500);
doh.robot.sequence(d.getTestCallback(function(){
doh.t(clicked, "click event was fired");
}), 1000);
return d;
}
},
{
name: "disabled",
timeout: 4000,
runTest: function(){
var d = new doh.Deferred();
var clicked = false;
dijit.byId("disabled").set("onClick", function(){ clicked = true; });
doh.robot.mouseMoveAt("disabled", 500);
doh.robot.mouseClick({left:true}, 500);
doh.robot.sequence(d.getTestCallback(function(){
if(!dojo.isWebKit){ // webkit bug, see #11064
doh.f(dojo.isDescendant(dojo.global.dijit.focus.curNode, dijit.byId("disabled").domNode), "not focused on button")
}
doh.f(clicked, "click event wasn't fired");
}), 1000);
return d;
}
}
]);
doh.register("dijit.form.DropDownButton", [
{
name: "click button",
timeout: 4000,
runTest: function(){
var d = new doh.Deferred();
doh.robot.mouseMoveAt("edit", 500);
doh.robot.mouseClick({left:true}, 500);
doh.robot.sequence(d.getTestCallback(function(){
doh.t(isVisible("editMenu"), "edit menu is visible: " + dijit.byId("editMenu").domNode.style.cssText);
}), 1000);
return d;
}
},
{
name: "click menu",
timeout: 4000,
runTest: function(){
var d = new doh.Deferred();
doh.robot.mouseMoveAt("copy", 500);
doh.robot.mouseClick({left:true}, 500);
doh.robot.sequence(d.getTestCallback(function(){
doh.t(isHidden("editMenu"), "edit menu was closed: " + dijit.byId("editMenu").domNode.style.cssText);
}), 1000);
return d;
}
}
]);
doh.register("dijit.form.ComboButton", [
{
name: "click button",
timeout: 4000,
runTest: function(){
var d = new doh.Deferred();
var leftPart = dojo.query(".dijitButtonContents", dojo.byId("save"))[0];
doh.t(leftPart, "found left part of button");
var clicked = false;
dijit.byId("save").set("onClick", function(){ clicked = true; });
doh.robot.mouseMoveAt(leftPart, 500);
doh.robot.mouseClick({left:true}, 500);
doh.robot.sequence(d.getTestCallback(function(){
doh.t(clicked, "click event was fired");
}), 1000);
return d;
}
},
{
name: "click drop down button",
timeout: 4000,
runTest: function(){
var d = new doh.Deferred();
var rightPart = dojo.query(".dijitDownArrowButton", dojo.byId("save"))[0];
doh.t(rightPart, "found right part of button");
doh.robot.mouseMoveAt(rightPart, 500);
doh.robot.mouseClick({left:true}, 500);
doh.robot.sequence(d.getTestCallback(function(){
doh.t(isVisible("saveMenu"), "save menu is visible: " + dijit.byId("saveMenu").domNode.style.cssText);
}), 1000);
return d;
}
},
{
name: "click menu",
timeout: 4000,
runTest: function(){
var d = new doh.Deferred();
doh.robot.mouseMoveAt("saveAs", 500);
doh.robot.mouseClick({left:true}, 500);
doh.robot.sequence(d.getTestCallback(function(){
doh.t(isHidden("saveMenu"), "save menu was closed: " + dijit.byId("saveMenu").domNode.style.cssText);
}), 1000);
return d;
}
},
{
name: "disabled click button",
timeout: 4000,
runTest: function(){
var d = new doh.Deferred();
var leftPart = dojo.query(".dijitButtonContents", dojo.byId("save"))[0];
doh.t(leftPart, "found left part of button");
var clicked = false;
dijit.byId("save").set("onClick", function(){ clicked = true; });
dijit.byId("save").set("disabled", true);
doh.robot.mouseMoveAt(leftPart, 500);
doh.robot.mouseClick({left:true}, 500);
doh.robot.sequence(d.getTestCallback(function(){
if(!dojo.isWebKit){ // webkit bug, see #11064
doh.f(dojo.isDescendant(dojo.global.dijit.focus.curNode, dijit.byId("save").domNode), "not focused on button")
}
doh.f(clicked, "click event wasn't fired");
}), 1000);
return d;
}
},
{
name: "disabled click drop down button",
timeout: 4000,
runTest: function(){
var d = new doh.Deferred();
var rightPart = dojo.query(".dijitDownArrowButton", dojo.byId("save"))[0];
doh.t(rightPart, "found right part of button");
doh.robot.mouseMoveAt(rightPart, 500);
doh.robot.mouseClick({left:true}, 500);
doh.robot.sequence(d.getTestCallback(function(){
if(!dojo.isWebKit){ // webkit bug, see #11064
doh.f(dojo.isDescendant(dojo.global.dijit.focus.curNode, dijit.byId("save").domNode), "not focused on button")
}
doh.t(isHidden("saveMenu"), "save menu is still hidden: " + dijit.byId("saveMenu").domNode.style.cssText);
}), 1000);
return d;
}
},
{
name: "tabIndex",
timeout: 1000,
runTest: function(){
var btn = dijit.byId("save"),
focusNode = btn.focusNode,
titleNode = btn.titleNode;
btn.set("disabled", true);
doh.t(btn.get("disabled"), "save button is disabled");
doh.f(dojo.hasAttr(focusNode, "tabIndex") && dojo.attr(focusNode, "tabIndex") >= 0, "disabled focusNode tabIndex");
doh.f(dojo.hasAttr(titleNode, "tabIndex") && dojo.attr(titleNode, "tabIndex") >= 0, "disabled titleNode tabIndex");
btn.set("disabled", false);
doh.f(btn.get("disabled"), "save button is enabled");
doh.is(0, dojo.attr(focusNode, "tabIndex"), "enabled focusNode tabIndex");
doh.is(0, dojo.attr(titleNode, "tabIndex"), "enabled titleNode tabIndex");
}
}
]);
doh.register("dijit.form.ToggleButton", [
{
name: "initially checked",
timeout: 4000,
runTest: function(){
var d = new doh.Deferred();
var checked = dijit.byId("toggle1").get("checked");
dijit.byId("toggle1").set("onChange", function(v){ checked = v; });
doh.t(checked, "toggle1 initially checked");
doh.robot.mouseMoveAt("toggle1", 500);
doh.robot.mouseClick({left:true}, 500);
doh.robot.sequence(d.getTestCallback(function(){
doh.f(checked, "toggle1 unchecked");
}), 1000);
return d;
}
},
{
name: "initially unchecked",
timeout: 4000,
runTest: function(){
var d = new doh.Deferred();
var checked = dijit.byId("toggle2").get("checked");
dijit.byId("toggle2").set("onChange", function(v){ checked = v; });
doh.f(checked, "toggle2 initially unchecked");
doh.robot.mouseMoveAt("toggle2", 500);
doh.robot.mouseClick({left:true}, 500);
doh.robot.sequence(d.getTestCallback(function(){
doh.t(checked, "toggle2 checked");
}), 1000);
return d;
}
},
{
name: "disabled",
timeout: 4000,
runTest: function(){
var d = new doh.Deferred();
dijit.byId("toggle1").set("disabled", true);
var changed = false;
dijit.byId("toggle1").set("onChange", function(v){ changed = true; });
doh.robot.mouseMoveAt("toggle1", 500);
doh.robot.mouseClick({left:true}, 500);
doh.robot.sequence(d.getTestCallback(function(){
if(!dojo.isWebKit){ // webkit bug, see #11064
doh.f(dojo.isDescendant(dojo.global.dijit.focus.curNode, dijit.byId("toggle1").domNode), "not focused on button")
}
doh.f(changed, "value didn't change");
}), 1000);
return d;
}
}
]);
doh.register("get/set", [
{
name: "change label",
runTest: function(){
dijit.byId("edit").set("label", "hi!");
doh.is("hi!", dijit.byId("edit").containerNode.innerHTML);
}
},
{
name: "icon",
runTest: function(){
// initial condition: no icon
doh.f(dojo.hasClass(dijit.byId("T1466").iconNode, "plusIcon"), "doesn't have plusIcon class");
doh.is("none", dojo.style(dijit.byId("T1466").iconNode, "display"), "initially hidden");
// no icon --> icon
dijit.byId("T1466").set("iconClass", "plusIcon");
doh.t(dojo.hasClass(dijit.byId("T1466").iconNode, "plusIcon"), "plusIcon class added");
doh.isNot("none", dojo.style(dijit.byId("T1466").iconNode, "display"), "became visible");
// switching icon
dijit.byId("T1466").set("iconClass", "noteIcon");
doh.f(dojo.hasClass(dijit.byId("T1466").iconNode, "plusIcon"), "plusIcon cleared");
doh.t(dojo.hasClass(dijit.byId("T1466").iconNode, "noteIcon"), "noteIcon added");
// initial conditions for buttons with icon
doh.t(dojo.hasClass(dijit.byId("dropDownNoLabel").iconNode, "noteIcon"),
"dropDownNoLabel: noteIcon set");
doh.t(dojo.hasClass(dijit.byId("comboNoLabel").iconNode, "plusBlockIcon"),
"comboNoLabel: plusBlockIcon set");
doh.t(isVisible(dijit.byId("comboNoLabel").iconNode),
"comboNoLabel: initially visible");
}
},
{
name: "disable",
timeout: 6000,
runTest: function(){
var d = new doh.Deferred();
dijit.byId("save").set("disabled", true);
// click left side of button
var leftPart = dojo.query(".dijitButtonContents", dojo.byId("save"))[0];
doh.t(leftPart, "found left part of button");
var clicked = false;
dijit.byId("save").set("onClick", function(){ clicked = true; });
doh.robot.mouseMoveAt(leftPart, 500);
doh.robot.mouseClick({left:true}, 500);
// click right side of button
var rightPart = dojo.query(".dijitDownArrowButton", dojo.byId("save"))[0];
doh.t(rightPart, "found right part of button");
doh.robot.mouseMoveAt(rightPart, 500);
doh.robot.mouseClick({left:true}, 500);
doh.robot.sequence(d.getTestCallback(function(){
doh.f(clicked, "click event was not fired");
doh.f(isVisible("saveMenu"), "save menu is hidden: " + dijit.byId("saveMenu").domNode.style.cssText);
}), 1000);
return d;
}
}
]);
var nameBox, valueBox;
function setUp(){
nameBox = dojo.byId("buttonName");
valueBox = dojo.byId("buttonValue");
dojo.window.scrollIntoView(valueBox);
nameBox.value = 'INIT';
valueBox.value = 'INIT';
}
doh.register("submit", [
{
name: "plain",
timeout: 5000,
setUp: setUp,
runTest: function(){
var d = new doh.Deferred();
doh.robot.mouseMoveAt('SubmitPlain', 500, 1);
doh.robot.mouseClick({left:true}, 500);
doh.robot.sequence(d.getTestCallback(function(){
doh.is("Plain", nameBox.value, "Plain name");
doh.is("Plain Submit", valueBox.value, "Plain value");
}), 1500);
return d;
}
},
{
name: "combo left",
timeout: 5000,
setUp: setUp,
runTest: function(){
var d = new doh.Deferred();
doh.robot.mouseMoveAt('SubmitCombo', 500, 1);
doh.robot.mouseClick({left:true}, 500);
doh.robot.sequence(d.getTestCallback(function(){
doh.is("Combo", nameBox.value, "Combo name");
doh.is("Combo Submit", valueBox.value, "Combo value");
}), 1500);
return d;
}
},
{
name: "combo right",
timeout: 5000,
setUp: setUp,
runTest: function(){
var d = new doh.Deferred();
var downArrowNode = dojo.query(".dijitDownArrowButton", dojo.byId("SubmitCombo"))[0];
doh.robot.mouseMoveAt(downArrowNode, 500, 1);
doh.robot.mouseClick({left:true}, 500);
doh.robot.sequence(d.getTestCallback(function(){
doh.is("INIT", nameBox.value, "Combo Down Arrow name");
doh.is("INIT", valueBox.value, "Combo Down Arrow value");
}), 1500);
return d;
}
},
{
name: "combo menu",
timeout: 5000,
setUp: setUp,
runTest: function(){
var d = new doh.Deferred();
doh.robot.mouseMoveAt("SubmitComboMenuItem", 500, 1);
doh.robot.mouseClick({left:true}, 500);
doh.robot.sequence(d.getTestCallback(function(){
doh.is("", nameBox.value, "Combo Arrow name");
doh.is("", valueBox.value, "Combo Arrow value");
}), 1500);
return d;
}
},
{
name: "drop down",
timeout: 5000,
setUp: setUp,
runTest: function(){
var d = new doh.Deferred();
doh.robot.mouseMoveAt('SubmitDropDown', 500, 1);
doh.robot.mouseClick({left:true}, 500);
doh.robot.sequence(d.getTestCallback(function(){
doh.is("DropDown", nameBox.value, "DropDown name");
doh.is("DropDown Submit", valueBox.value, "DropDown value");
}), 1500);
return d;
}
},
{
name: "drop down menu",
timeout: 5000,
setUp: setUp,
runTest: function(){
var d = new doh.Deferred();
doh.robot.mouseMoveAt("SubmitDropDownMenuItem", 500, 1);
doh.robot.mouseClick({left:true}, 500);
doh.robot.sequence(d.getTestCallback(function(){
doh.is("", nameBox.value, "DropDown Arrow name");
doh.is("", valueBox.value, "DropDown Arrow value");
}), 1500);
return d;
}
},
{
name: "disabled",
timeout: 5000,
setUp: setUp,
runTest: function(){
var d = new doh.Deferred();
doh.robot.mouseMoveAt('SubmitDisabled', 500, 1);
doh.robot.mouseClick({left:true}, 500);
doh.robot.sequence(d.getTestCallback(function(){
doh.is("INIT", nameBox.value, "Disabled name");
doh.is("INIT", valueBox.value, "Disabled value");
}), 1000);
return d;
}
}
]);
doh.register("onClick", [
{
name: "reset: none",
timeout: 3000,
runTest: function(){
var d = new doh.Deferred();
var valueBox = dojo.byId("onClickName");
valueBox.value = '1';
doh.robot.mouseMoveAt('reset1', 500);
doh.robot.mouseClick({left:true}, 500);
doh.robot.sequence(d.getTestCallback(function(){
doh.is("RESET", dojo.byId('onClickName').value);
}), 1000);
return d;
}
},
{
name: "reset native: none",
timeout: 3000,
runTest: function(){
var d = new doh.Deferred();
var valueBox = dojo.byId("onClickName");
valueBox.value = '1';
doh.robot.mouseMoveAt('reset1N', 500);
doh.robot.mouseClick({left:true}, 500);
doh.robot.sequence(d.getTestCallback(function(){
doh.is("RESET", dojo.byId('onClickName').value);
}), 1000);
return d;
}
},
{
name: "reset: return false",
timeout: 3000,
runTest: function(){
var d = new doh.Deferred();
var valueBox = dojo.byId("onClickName");
valueBox.value = '2';
doh.robot.mouseMoveAt('reset2', 500);
doh.robot.mouseClick({left:true}, 500);
doh.robot.sequence(d.getTestCallback(function(){
doh.is("2", dojo.byId('onClickName').value);
}), 1000);
return d;
}
},
{
name: "reset native: return false",
timeout: 3000,
runTest: function(){
var d = new doh.Deferred();
var valueBox = dojo.byId("onClickName");
valueBox.value = '2';
doh.robot.mouseMoveAt('reset2N', 500);
doh.robot.mouseClick({left:true}, 500);
doh.robot.sequence(d.getTestCallback(function(){
doh.is("2", dojo.byId('onClickName').value);
}), 1000);
return d;
}
},
{
name: "reset: return true",
timeout: 3000,
runTest: function(){
var d = new doh.Deferred();
var valueBox = dojo.byId("onClickName");
valueBox.value = '3';
doh.robot.mouseMoveAt('reset3', 500);
doh.robot.mouseClick({left:true}, 500);
doh.robot.sequence(d.getTestCallback(function(){
doh.is("RESET", dojo.byId('onClickName').value);
}), 1000);
return d;
}
},
{
name: "reset native: return true",
timeout: 3000,
runTest: function(){
var d = new doh.Deferred();
var valueBox = dojo.byId("onClickName");
valueBox.value = '3';
doh.robot.mouseMoveAt('reset3N', 500);
doh.robot.mouseClick({left:true}, 500);
doh.robot.sequence(d.getTestCallback(function(){
doh.is("RESET", dojo.byId('onClickName').value);
}), 1000);
return d;
}
},
{
name: "reset: return",
timeout: 3000,
runTest: function(){
var d = new doh.Deferred();
var valueBox = dojo.byId("onClickName");
valueBox.value = '4';
doh.robot.mouseMoveAt('reset4', 500);
doh.robot.mouseClick({left:true}, 500);
doh.robot.sequence(d.getTestCallback(function(){
doh.is("RESET", dojo.byId('onClickName').value);
}), 1000);
return d;
}
},
{
name: "reset native: return",
timeout: 3000,
runTest: function(){
var d = new doh.Deferred();
var valueBox = dojo.byId("onClickName");
valueBox.value = '4';
doh.robot.mouseMoveAt('reset4N', 500);
doh.robot.mouseClick({left:true}, 500);
doh.robot.sequence(d.getTestCallback(function(){
doh.is("RESET", dojo.byId('onClickName').value);
}), 1000);
return d;
}
},
{
name: "reset: empty",
timeout: 3000,
runTest: function(){
var d = new doh.Deferred();
var valueBox = dojo.byId("onClickName");
valueBox.value = '5';
doh.robot.mouseMoveAt('reset5', 500);
doh.robot.mouseClick({left:true}, 500);
doh.robot.sequence(d.getTestCallback(function(){
doh.is("RESET", dojo.byId('onClickName').value);
}), 1000);
return d;
}
},
{
name: "reset native: empty",
timeout: 3000,
runTest: function(){
var d = new doh.Deferred();
var valueBox = dojo.byId("onClickName");
valueBox.value = '5';
doh.robot.mouseMoveAt('reset5N', 500);
doh.robot.mouseClick({left:true}, 500);
doh.robot.sequence(d.getTestCallback(function(){
doh.is("RESET", dojo.byId('onClickName').value);
}), 1000);
return d;
}
}
]);
doh.register("resize", [
{
name: "ComboButton",
timeout: 5000,
runTest: function(){
var d = new doh.Deferred();
var combo = dijit.byId('combo_default');
var origSize = combo.domNode.scrollWidth;
doh.robot.mouseMoveAt('changeLabels', 500);
doh.robot.mouseClick({left:true}, 500);
doh.robot.sequence(d.getTestCallback(function(){
doh.isNot(origSize, combo.domNode.scrollWidth, "ComboButton size");
}), 1000);
return d;
}
}
]);
doh.run();
});
</script>
</head>
</html>

View File

@@ -0,0 +1,35 @@
<table cellspacing="0" cellpadding="0" class="dijitCalendarContainer" role="grid" aria-labelledby="${id}_mddb ${id}_year">
<thead>
<tr class="dijitReset dijitCalendarMonthContainer" valign="top">
<th class='dijitReset dijitCalendarArrow' data-dojo-attach-point="decrementMonth">
<img src="${_blankGif}" alt="" class="dijitCalendarIncrementControl dijitCalendarDecrease" role="presentation"/>
<span data-dojo-attach-point="decreaseArrowNode" class="dijitA11ySideArrow">-</span>
</th>
<th class='dijitReset' colspan="5">
<div data-dojo-attach-point="monthNode">
</div>
</th>
<th class='dijitReset dijitCalendarArrow' data-dojo-attach-point="incrementMonth">
<img src="${_blankGif}" alt="" class="dijitCalendarIncrementControl dijitCalendarIncrease" role="presentation"/>
<span data-dojo-attach-point="increaseArrowNode" class="dijitA11ySideArrow">+</span>
</th>
</tr>
<tr>
${!dayCellsHtml}
</tr>
</thead>
<tbody data-dojo-attach-point="dateRowsNode" data-dojo-attach-event="onclick: _onDayClick" class="dijitReset dijitCalendarBodyContainer">
${!dateRowsHtml}
</tbody>
<tfoot class="dijitReset dijitCalendarYearContainer">
<tr>
<td class='dijitReset' valign="top" colspan="7" role="presentation">
<div class="dijitCalendarYearLabel">
<span data-dojo-attach-point="previousYearLabelNode" class="dijitInline dijitCalendarPreviousYear" role="button"></span>
<span data-dojo-attach-point="currentYearLabelNode" class="dijitInline dijitCalendarSelectedYear" role="button" id="${id}_year"></span>
<span data-dojo-attach-point="nextYearLabelNode" class="dijitInline dijitCalendarNextYear" role="button"></span>
</div>
</td>
</tr>
</tfoot>
</table>

View File

@@ -0,0 +1,23 @@
<div class="dijitCalendarDayLabels" style="left: 0px;" dojoAttachPoint="dayContainer">
<div dojoAttachPoint="header">
<div dojoAttachPoint="monthAndYearHeader">
<span dojoAttachPoint="monthLabelNode" class="dojoxCalendarMonthLabelNode"></span>
<span dojoAttachPoint="headerComma" class="dojoxCalendarComma">,</span>
<span dojoAttachPoint="yearLabelNode" class="dojoxCalendarDayYearLabel"></span>
</div>
</div>
<table cellspacing="0" cellpadding="0" border="0" style="margin: auto;">
<thead>
<tr>
<td class="dijitCalendarDayLabelTemplate"><div class="dijitCalendarDayLabel"></div></td>
</tr>
</thead>
<tbody dojoAttachEvent="onclick: _onDayClick">
<tr class="dijitCalendarWeekTemplate">
<td class="dojoxCalendarNextMonth dijitCalendarDateTemplate">
<div class="dijitCalendarDateLabel"></div>
</td>
</tr>
</tbody>
</table>
</div>

View File

@@ -0,0 +1,12 @@
<div class="dojoxCalendarMonthLabels" style="left: 0px;"
dojoAttachPoint="monthContainer" dojoAttachEvent="onclick: onClick">
<table cellspacing="0" cellpadding="0" border="0" style="margin: auto;">
<tbody>
<tr class="dojoxCalendarMonthGroupTemplate">
<td class="dojoxCalendarMonthTemplate">
<div class="dojoxCalendarMonthLabel"></div>
</td>
</tr>
</tbody>
</table>
</div>

View File

@@ -0,0 +1,31 @@
<div class="dojoxCal-MY-labels" style="left: 0px;"
dojoAttachPoint="myContainer" dojoAttachEvent="onclick: onClick">
<table cellspacing="0" cellpadding="0" border="0" style="margin: auto;">
<tbody>
<tr class="dojoxCal-MY-G-Template">
<td class="dojoxCal-MY-M-Template">
<div class="dojoxCalendarMonthLabel"></div>
</td>
<td class="dojoxCal-MY-M-Template">
<div class="dojoxCalendarMonthLabel"></div>
</td>
<td class="dojoxCal-MY-Y-Template">
<div class="dojoxCalendarYearLabel"></div>
</td>
<td class="dojoxCal-MY-Y-Template">
<div class="dojoxCalendarYearLabel"></div>
</td>
</tr>
<tr class="dojoxCal-MY-btns">
<td class="dojoxCal-MY-btns" colspan="4">
<span class="dijitReset dijitInline dijitButtonNode ok-btn" dojoAttachEvent="onclick: onOk" dojoAttachPoint="okBtn">
<button class="dijitReset dijitStretch dijitButtonContents">OK</button>
</span>
<span class="dijitReset dijitInline dijitButtonNode cancel-btn" dojoAttachEvent="onclick: onCancel" dojoAttachPoint="cancelBtn">
<button class="dijitReset dijitStretch dijitButtonContents">Cancel</button>
</span>
</td>
</tr>
</tbody>
</table>
</div>

View File

@@ -0,0 +1,12 @@
<div class="dojoxCalendarYearLabels" style="left: 0px;" dojoAttachPoint="yearContainer">
<table cellspacing="0" cellpadding="0" border="0" style="margin: auto;" dojoAttachEvent="onclick: onClick">
<tbody>
<tr class="dojoxCalendarYearGroupTemplate">
<td class="dojoxCalendarNextMonth dojoxCalendarYearTemplate">
<div class="dojoxCalendarYearLabel">
</div>
</td>
</tr>
</tbody>
</table>
</div>

View File

@@ -0,0 +1,382 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>doh.robot Calendar A11Y Test</title>
<style>
@import "../../../util/doh/robot/robot.css";
</style>
<!-- required: dojo.js -->
<script type="text/javascript" src="../../../dojo/dojo.js"
djConfig="isDebug: true"></script>
<!-- functions to help test -->
<script type="text/javascript" src="../helpers.js"></script>
<script type="text/javascript">
dojo.require("doh.runner");
dojo.require("dijit.robotx");
dojo.require("dojo.date");
dojo.require("dojo.date.locale");
dojo.ready(function(){
doh.robot.initRobot('../test_Calendar.html');
// refs to Calendar widget
var cal1;
// log of calls to onChange handler
var changes = [];
doh.register("API",[
function noValue(){
// refs to Calendar widget
cal1 = dijit.byId('calendar1');
// Although Calendar and DateTextBox prototypes defined value as Date("")
// (so that the parser knows value is a Date rather than a string),
// the convention is to use null to represent a blank DateTextBox or Calendar w/no selection
doh.is(null, dijit.byId("calendar1").get("value"), 'initial get("value"), no selection');
cal1.set("value", new Date(2009, 8, 16));
doh.is(0, dojo.date.compare(new Date(2009, 8, 16), cal1.get('value')), 'get("value") after set');
cal1.set("value", null);
doh.is(null, cal1.get("value"), 'get("value") after set to null');
}
]);
// Test aria roles, etc.
doh.register("aria", function(){
//test all days are loaded correctly
var dateCells = dijit.byId("calendar1").dateCells;
dojo.forEach(dateCells, function(cellNode){
doh.is("false", cellNode.getAttribute("aria-selected"), "aria-selected should be false at startup");
doh.is(undefined, cellNode.getAttribute("aria-disabled should be undefined at startup"), "aria-disabled");
});
//disable weekends
dijit.registry.forEach(function(c){
if(c.isDisabledDate){
c.isDisabledDate = dojo.date.locale.isWeekend;
c._populateGrid();
}
});
//select a day
dijit.byId("calendar1").set("value", new Date(2009, 8, 15));
dojo.forEach(dateCells, function(cellNode, index){
var selected = cellNode.getAttribute("aria-selected");
var disabled = cellNode.getAttribute("aria-disabled");
innerText(cellNode)==="15" ? doh.is("true", selected, "aria-selected should be true: "+innerText(cellNode))
: doh.is("false", selected, "aria-selected should still be true: "+innerText(cellNode));
(index%7==0) || (index%7==6) ? doh.is("true", disabled, "aria-disabled should be true for weekends: "+index)
: doh.t((disabled==undefined || disabled=="" || disabled=="false"), "aria-disabled should still be undefined, 'false', or ''. Index was: "+index+" Value was: "+disabled);
});
//enable all again
dijit.registry.forEach(function(c){
if(c.isDisabledDate){
c.isDisabledDate = function(){return false;};
c._populateGrid();
}
});
//select a different day
dijit.byId("calendar1").set("value", new Date(2009, 8, 17));
dojo.forEach(dateCells, function(cellNode, index){
var selected = cellNode.getAttribute("aria-selected");
var disabled = cellNode.getAttribute("aria-disabled");
innerText(cellNode)==="17" ? doh.is("true", selected, "aria-selected should be true for day 17: "+innerText(cellNode))
: doh.is("false", selected, "aria-selected should be false again: "+innerText(cellNode));
doh.t((disabled==undefined || disabled=="" || disabled=="false"), "aria-disabled should be undefined, 'false', or '' again");
});
});
// Tabindex test makes sure that there's exactly one tab stop on the calendar at all times
doh.register("tabindex",[
{
name: "forward",
timeout: 10000,
setUp: function(){
cal1.set("value", new Date(2009, 8, 16));
dojo.byId("before").focus();
},
runTest: function(){
var d = new doh.Deferred();
// Tab in
doh.robot.keyPress(dojo.keys.TAB, 1000, {});
doh.robot.sequence(d.getTestErrback(dojo.hitch(this, function(){
doh.is(16, innerText(dojo.global.dijit.focus.curNode), "first tab goes to selected day");
})), 500);
// Move around some
doh.robot.keyPress(dojo.keys.RIGHT_ARROW, 0, {});
doh.robot.keyPress(dojo.keys.DOWN_ARROW, 500, {});
doh.robot.sequence(d.getTestErrback(dojo.hitch(this, function(){
doh.is(24, innerText(dojo.global.dijit.focus.curNode), "move around some");
})), 500);
// Tab out
doh.robot.keyPress(dojo.keys.TAB, 500, {});
doh.robot.sequence(d.getTestCallback(dojo.hitch(this, function(){
doh.is("after", dojo.global.dijit.focus.curNode.id, "next tab leaves calendar");
})), 500);
return d;
}
},
{
name: "reverse",
timeout: 10000,
runTest: function(){
var d = new doh.Deferred();
// shift-tab back into calendar, should go to previously focused day
doh.robot.keyPress(dojo.keys.TAB, 500, {shift: true});
doh.robot.sequence(d.getTestErrback(dojo.hitch(this, function(){
doh.is(24, innerText(dojo.global.dijit.focus.curNode), "shift-tab returns to previously focused day");
})), 500);
// shift-tab out
doh.robot.keyPress(dojo.keys.TAB, 500, {shift: true});
doh.robot.sequence(d.getTestCallback(dojo.hitch(this, function(){
doh.is("before", dojo.global.dijit.focus.curNode.id, "next shift-tab leaves calendar");
})), 500);
return d;
}
},
{
name: "advance a month",
timeout: 10000,
runTest: function(){
var d = new doh.Deferred();
// Tab in
doh.robot.keyPress(dojo.keys.TAB, 500, {});
doh.robot.sequence(d.getTestErrback(dojo.hitch(this, function(){
doh.is(24, innerText(dojo.global.dijit.focus.curNode), "first tab goes to selected day");
})), 500);
// Move to next month
doh.robot.keyPress(dojo.keys.PAGE_DOWN, 0, {});
doh.robot.sequence(d.getTestErrback(dojo.hitch(this, function(){
doh.is(24, innerText(dojo.global.dijit.focus.curNode), "moved to same day, but new month");
})), 500);
// Tab out
doh.robot.keyPress(dojo.keys.TAB, 500, {});
doh.robot.sequence(d.getTestCallback(dojo.hitch(this, function(){
doh.is("after", dojo.global.dijit.focus.curNode.id, "next tab leaves calendar");
})), 500);
return d;
}
},
{
name: "reverse again",
timeout: 10000,
runTest: function(){
var d = new doh.Deferred();
// shift-tab back into calendar, should go to previously focused day
doh.robot.keyPress(dojo.keys.TAB, 500, {shift: true});
doh.robot.sequence(d.getTestErrback(dojo.hitch(this, function(){
doh.is(24, innerText(dojo.global.dijit.focus.curNode), "shift-tab returns to previously focused day");
})), 500);
// shift-tab out
doh.robot.keyPress(dojo.keys.TAB, 500, {shift: true});
doh.robot.sequence(d.getTestCallback(dojo.hitch(this, function(){
doh.is("before", dojo.global.dijit.focus.curNode.id, "next shift-tab leaves calendar");
})), 500);
return d;
}
}
]);
// Make sure that all the navigation and selection keystrokes work
doh.register("navigation",[
{
name: "arrow navigation",
timeout: 10000,
setUp: function(){
// refs to Calendar widget
cal1 = dijit.byId('calendar1');
cal1.set("value", new Date(2009, 8, 16));
// setup onChange handler to monitor onChange calls on cal1
dojo.connect(cal1, 'onChange', function(val){
console.log('onchange w/value: ', val);
changes.push(val);
});
},
runTest: function(){
var d = new doh.Deferred();
doh.robot.sequence(function(){
// monitor onchange events
changes = [];
cal1.focus();
}, 500);
// Initial conditions
doh.robot.sequence(d.getTestErrback(dojo.hitch(this, function(){
// 16th is selected
var selected = dojo.query(".dijitCalendarSelectedDate", cal1.domNode);
doh.is(1, selected.length, "one selected node");
doh.is("16", innerText(selected[0]));
// initial focus is on selected value
doh.is("16", innerText(dojo.global.dijit.focus.curNode));
// and get("value") working
doh.is(0, dojo.date.compare(new Date(2009, 8, 16), cal1.get('value')), 'get("value")');
})), 1000);
// Mouse moves around focus without changing value
doh.robot.keyPress(dojo.keys.RIGHT_ARROW, 500, {});
doh.robot.sequence(d.getTestErrback(dojo.hitch(this, function(){
// focus moved from 16 to 17
doh.is(17, innerText(dojo.global.dijit.focus.curNode));
doh.is(0, dojo.date.compare(new Date(2009, 8, 16), cal1.get('value')), 'value unchanged');
// 16th is still selected
var selected = dojo.query(".dijitCalendarSelectedDate", cal1.domNode);
doh.is(1, selected.length, "one selected node");
doh.is("16", innerText(selected[0]));
})), 500);
doh.robot.keyPress(dojo.keys.RIGHT_ARROW, 0, {});
doh.robot.sequence(d.getTestErrback(dojo.hitch(this, function(){
doh.is(18, innerText(dojo.global.dijit.focus.curNode));
})), 500);
doh.robot.keyPress(dojo.keys.DOWN_ARROW, 0, {});
doh.robot.sequence(d.getTestErrback(dojo.hitch(this, function(){
doh.is(25, innerText(dojo.global.dijit.focus.curNode));
})), 500);
doh.robot.keyPress(dojo.keys.LEFT_ARROW, 0, {});
doh.robot.sequence(d.getTestErrback(dojo.hitch(this, function(){
doh.is(24, innerText(dojo.global.dijit.focus.curNode));
})), 500);
doh.robot.keyPress(dojo.keys.UP_ARROW, 0, {});
doh.robot.sequence(d.getTestErrback(dojo.hitch(this, function(){
doh.is(17, innerText(dojo.global.dijit.focus.curNode));
})), 500);
doh.robot.keyPress(dojo.keys.UP_ARROW, 0, {});
doh.robot.sequence(d.getTestErrback(dojo.hitch(this, function(){
doh.is(10, innerText(dojo.global.dijit.focus.curNode));
})), 500);
doh.robot.keyPress(dojo.keys.ENTER, 0, {});
doh.robot.sequence(d.getTestCallback(dojo.hitch(this, function(){
var value = cal1.get('value');
doh.is(0, dojo.date.compare(new Date(2009, 8, 10), value), 'actual value is ' + value);
doh.is(1, changes.length, 'onchange events');
doh.is(0, dojo.date.compare(new Date(2009, 8, 10), changes[0]),
'value reported by onchange: ' + changes[0] +
', should be ' + new Date(2009, 8, 10));
})), 1000);
return d;
}
},
{
name: "month navigation",
timeout: 5000,
setUp: function(){
// refs to Calendar widget
cal1 = dijit.byId('calendar1');
cal1.set("value", new Date(2008, 0, 31));
},
runTest: function(){
var d = new doh.Deferred();
doh.robot.sequence(function(){
cal1.focus();
}, 500);
doh.robot.keyPress(dojo.keys.PAGE_DOWN, 1000, {});
doh.robot.sequence(d.getTestErrback(dojo.hitch(this, function(){
// focus moved from jan 31 to feb 29
doh.is(29, innerText(dojo.global.dijit.focus.curNode));
doh.is(0, dojo.date.compare(new Date(2008, 0, 31), cal1.get('value')), 'value unchanged (first page down)');
// month label should have changed
var monthLabel = dojo.query(".dijitCalendarCurrentMonthLabel", cal1.domNode);
doh.is(1, monthLabel.length, "one month label");
doh.is("February", innerText(monthLabel[0]));
// jan 31 from previous month still visible, should be shown as selected
var selected = dojo.query(".dijitCalendarSelectedDate", cal1.domNode);
doh.is(1, selected.length, "no selected node");
})), 500);
doh.robot.keyPress(dojo.keys.PAGE_DOWN, 500, {});
doh.robot.sequence(d.getTestErrback(dojo.hitch(this, function(){
// focus moved from jan 31 to feb 29
doh.is(29, innerText(dojo.global.dijit.focus.curNode));
doh.is(0, dojo.date.compare(new Date(2008, 0, 31), cal1.get('value')), 'value unchanged (second page down)');
// since january no longer visible, no selected date should be visible
var selected = dojo.query(".dijitCalendarSelectedDate", cal1.domNode);
doh.is(0, selected.length, "no selected node");
})), 500);
doh.robot.keyPress(dojo.keys.SPACE, 500, {});
doh.robot.sequence(d.getTestCallback(dojo.hitch(this, function(){
var value = cal1.get('value');
doh.is(0, dojo.date.compare(new Date(2008, 2, 29), value), 'actual value is ' + value);
})), 1000);
return d;
}
},
{
name: "month+year navigation",
timeout: 5000,
setUp: function(){
// refs to Calendar widget
cal1 = dijit.byId('calendar1');
cal1.set("value", new Date(2008, 1, 15));
},
runTest: function(){
var d = new doh.Deferred();
doh.robot.sequence(function(){
cal1.focus();
}, 500);
doh.robot.keyPress(dojo.keys.END, 1000, {});
// Chrome switches tabs with ctrl+page up/down (not even a keydown is generated), yet not Safari.
// I don't see a way to do feature-detection since browser window focus is lost.
doh.robot.keyPress(dojo.keys.PAGE_DOWN, 500, dojo.isChrome ? {alt:true} : {ctrl:true});
doh.robot.keyPress(dojo.keys.PAGE_UP, 500, dojo.isChrome ? {alt:true} : {ctrl:true});
doh.robot.keyPress(dojo.keys.PAGE_UP, 500, dojo.isChrome ? {alt:true} : {ctrl:true});
doh.robot.keyPress(dojo.keys.ENTER, 500);
doh.robot.sequence(d.getTestCallback(dojo.hitch(this, function(){
var value = cal1.get('value');
doh.is(0, dojo.date.compare(new Date(2007, 1, 28), value), 'actual value is ' + value);
})), 1000);
return d;
}
}
]);
doh.run();
});
</script>
</head>
</html>

1465
master/examples/Camera.html Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,92 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1"> <!-- Use Chrome Frame in IE -->
<meta name="viewport" content="width=device-width, height=device-height, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no">
<meta name="description" content="Drag and drop CZML files onto the Cesium Viewer Widget to visualize time dynamic data.">
<title>Cesium Demo</title>
<script type="text/javascript" src="../Sandcastle-header.js"></script>
<script data-dojo-config="async: 1, tlmSiblingOfDojo: 0" src="../../../ThirdParty/dojo-release-1.7.2-src/dojo/dojo.js"></script>
<script type="text/javascript">
require({
baseUrl : '../../..',
packages: [
{ name: 'dojo', location: 'ThirdParty/dojo-release-1.7.2-src/dojo' },
{ name: 'dijit', location: 'ThirdParty/dojo-release-1.7.2-src/dijit' },
{ name: 'dojox', location: 'ThirdParty/dojo-release-1.7.2-src/dojox' },
{ name: 'Assets', location: 'Source/Assets' },
{ name: 'Core', location: 'Source/Core' },
{ name: 'DynamicScene', location: 'Source/DynamicScene' },
{ name: 'Renderer', location: 'Source/Renderer' },
{ name: 'Scene', location: 'Source/Scene' },
{ name: 'Shaders', location: 'Source/Shaders' },
{ name: 'ThirdParty', location: 'Source/ThirdParty' },
{ name: 'Widgets', location: 'Source/Widgets' },
{ name: 'Workers', location: 'Source/Workers' }
]
});
</script>
<link rel="Stylesheet" href="../../../ThirdParty/dojo-release-1.7.2-src/dijit/themes/claro/claro.css" type="text/css">
<link rel="Stylesheet" href="../../../Source/Widgets/Dojo/CesiumViewerWidget.css" type="text/css">
</head>
<body class="claro" data-sandcastle-bucket="bucket-dojo.html" data-sandcastle-title="Cesium + Dojo">
<style>
body {
background: #000;
color: #eee;
font-family: sans-serif;
font-size: 9pt;
padding: 0;
margin: 0;
width: 100%;
height: 100%;
overflow: hidden;
}
.fullSize {
display: block;
position: absolute;
top: 0;
left: 0;
border: none;
width: 100%;
height: 100%;
}
#toolbar {
margin: 5px;
padding: 2px 5px;
position: absolute;
}
</style>
<div id="cesiumContainer" class="fullSize"></div>
<div id="toolbar">Loading...</div>
<script id="cesium_sandcastle_script">
require([
'Source/Cesium', 'Widgets/Dojo/CesiumViewerWidget',
'dojo/on', 'dojo/dom', 'dojo/io-query'
], function(
Cesium, CesiumViewerWidget,
on, dom, ioQuery)
{
"use strict";
// Ask Dojo to parse URL configuration options
var endUserOptions = {};
if (window.location.search) {
endUserOptions = ioQuery.queryToObject(window.location.search.substring(1));
}
// Initialize a viewer capable of drag-and-drop
// and user customizations.
var widget = new CesiumViewerWidget({
endUserOptions : endUserOptions,
enableDragDrop : true
});
widget.placeAt(dom.byId('cesiumContainer'));
widget.startup();
dom.byId('toolbar').innerHTML = '';
});
</script>
</body>
</html>

View File

@@ -0,0 +1,81 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1"> <!-- Use Chrome Frame in IE -->
<meta name="viewport" content="width=device-width, height=device-height, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no">
<meta name="description" content="Use the Cesium Widget to start building a new application or easily embed Cesium.">
<title>Cesium Demo</title>
<script type="text/javascript" src="../Sandcastle-header.js"></script>
<script data-dojo-config="async: 1, tlmSiblingOfDojo: 0" src="../../../ThirdParty/dojo-release-1.7.2-src/dojo/dojo.js"></script>
<script type="text/javascript">
require({
baseUrl : '../../..',
packages: [
{ name: 'dojo', location: 'ThirdParty/dojo-release-1.7.2-src/dojo' },
{ name: 'dijit', location: 'ThirdParty/dojo-release-1.7.2-src/dijit' },
{ name: 'dojox', location: 'ThirdParty/dojo-release-1.7.2-src/dojox' },
{ name: 'Assets', location: 'Source/Assets' },
{ name: 'Core', location: 'Source/Core' },
{ name: 'DynamicScene', location: 'Source/DynamicScene' },
{ name: 'Renderer', location: 'Source/Renderer' },
{ name: 'Scene', location: 'Source/Scene' },
{ name: 'Shaders', location: 'Source/Shaders' },
{ name: 'ThirdParty', location: 'Source/ThirdParty' },
{ name: 'Widgets', location: 'Source/Widgets' },
{ name: 'Workers', location: 'Source/Workers' }
]
});
</script>
<link rel="Stylesheet" href="../../../ThirdParty/dojo-release-1.7.2-src/dijit/themes/claro/claro.css" type="text/css">
<link rel="Stylesheet" href="../../../Source/Widgets/Dojo/CesiumViewerWidget.css" type="text/css">
</head>
<body class="claro" data-sandcastle-bucket="bucket-dojo.html" data-sandcastle-title="Cesium + Dojo">
<style>
body {
background: #000;
color: #eee;
font-family: sans-serif;
font-size: 9pt;
padding: 0;
margin: 0;
width: 100%;
height: 100%;
overflow: hidden;
}
.fullSize {
display: block;
position: absolute;
top: 0;
left: 0;
border: none;
width: 100%;
height: 100%;
}
#toolbar {
margin: 5px;
padding: 2px 5px;
position: absolute;
}
</style>
<div id="cesiumContainer" class="fullSize"></div>
<div id="toolbar">Loading...</div>
<script id="cesium_sandcastle_script">
require([
'Source/Cesium', 'Widgets/Dojo/CesiumWidget',
'dojo/on', 'dojo/dom'
], function(
Cesium, CesiumWidget,
on, dom)
{
"use strict";
var widget = new CesiumWidget();
widget.placeAt(dom.byId('cesiumContainer'));
widget.startup();
dom.byId('toolbar').innerHTML = '';
});
</script>
</body>
</html>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,4 @@
<div data-dojo-attach-point="containerNode" style="width: 100%; height: 100%;">
<a data-dojo-attach-point="cesiumLogo" style="display: block; position: absolute; bottom: 4px; left: 0; text-decoration: none; width: 118px; height: 26px;" href="http://cesium.agi.com/" target="_blank"></a>
<canvas data-dojo-attach-point="canvas" style="width: 100%; height: 100%;"></canvas>
</div>

View File

@@ -0,0 +1,5 @@
<div>
<div dojoAttachPoint="messages" dojoType="dijit.layout.ContentPane" layoutAlign="client" style="overflow:auto">
</div>
<div dojoType="dijit.layout.ContentPane" layoutAlign="bottom" style="border-top: 2px solid #333333; height: 35px;"><input dojoAttachPoint="chatInput" dojoAttachEvent="onkeypress: onKeyPress" style="width: 100%;height: 35px;" /></div>
</div>

View File

@@ -0,0 +1,7 @@
<div class="dijit dijitReset dijitInline" role="presentation"
><input
${!nameAttrSetting} type="${type}" ${checkedAttrSetting}
class="dijitReset dijitCheckBoxInput"
data-dojo-attach-point="focusNode"
data-dojo-attach-event="onclick:_onClick"
/></div>

View File

@@ -0,0 +1,295 @@
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,minimum-scale=1,user-scalable=no"/>
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<title>_CheckBoxMixin tests</title>
<style type="text/css">
@import "../../themes/claro/document.css";
@import "../../themes/dijit.css";
#table {
margin: 0;
padding: 2px;
}
#table, .dijit, BUTTON {
font-family: monospace;
font-size: 12pt;
}
#table .layout {
padding: 2px;
font-size: 100%;
margin: 0;
}
INPUT#mobile_attributes {
-webkit-appearance: radio;
width:32px;
height:32px;
border-radius: 0;
}
INPUT#mobile_events:not(:checked){
background-color:rgba(255,0,0,1);
border-radius: 32px;
}
INPUT#mobile_events {
width:32px;
height:32px;
background-color:rgba(0,0,255,1);
border-radius: 32px;
}
INPUT#mobile_programmatic {
width:32px;
height:32px;
background-color:rgba(0,0,0,0);
border:0 none rgba(0,0,0,0);
border-radius: 0;
}
INPUT#mobile_programmatic:not(:checked){
opacity:0;
}
.dijitCheckBox {
vertical-align: baseline !important;
}
</style>
<link id="themeStyles" rel="stylesheet" href="../../../dijit/themes/claro/claro.css"/>
<script type="text/javascript" src="../../../dojo/dojo.js"
data-dojo-config="parseOnLoad: true, isDebug: true"></script>
<script type="text/javascript">
dojo.require("doh.runner");
dojo.require("dijit.dijit"); // optimize: load dijit layer
dojo.require("dijit.form.CheckBox");
dojo.require("dojox.mobile.CheckBox");
dojo.ready(function(){
doh.register("attributes", [
{
name: "dijit",
runTest: function(){
var dijit_attributes = dijit.byId('dijit_attributes');
doh.is("something", dijit_attributes.focusNode.value, 'dijit HTML element original value');
doh.t(dijit_attributes.get('checked'), "dijit original get('checked')");
doh.t(!!dijit_attributes.focusNode.checked, 'dijit HTML element originally checked');
doh.t(dojo.hasClass(dijit_attributes.domNode, dijit_attributes.baseClass+"Checked"), "dijit baseClass checked");
dijit_attributes.set('value', "something else");
dijit_attributes.set('checked', false);
doh.f(dijit_attributes.get('checked'), "dijit get('checked')");
doh.t(!dijit_attributes.focusNode.checked, 'dijit HTML element unchecked');
doh.f(dojo.hasClass(dijit_attributes.domNode, dijit_attributes.baseClass+"Checked"), "dijit baseClass not checked");
doh.t(dojo.hasClass(dijit_attributes.domNode, dijit_attributes.baseClass), "dijit baseClass");
doh.t(dojo.hasClass(dijit_attributes.domNode, "mblRedButton"), "dijit original class");
doh.is("something else", dijit_attributes.focusNode.value, 'dijit HTML element value');
}
},
{
name: "mobile",
runTest: function(){
var mobile_attributes = dijit.byId('mobile_attributes');
doh.is("something", mobile_attributes.focusNode.value, 'mobile HTML element original value');
doh.t(mobile_attributes.get('checked'), "mobile original get('checked')");
doh.t(!!mobile_attributes.focusNode.checked, 'mobile HTML element originally checked');
doh.t(dojo.hasClass(mobile_attributes.domNode, mobile_attributes.baseClass+"Checked"), "mobile baseClass checked");
mobile_attributes.set('checked', false);
mobile_attributes.set('value', "something else");
doh.f(mobile_attributes.get('checked'), "mobile get('checked')");
doh.t(!mobile_attributes.focusNode.checked, 'mobile HTML element unchecked');
doh.f(dojo.hasClass(mobile_attributes.domNode, mobile_attributes.baseClass+"Checked"), "mobile baseClass not checked");
doh.t(dojo.hasClass(mobile_attributes.domNode, mobile_attributes.baseClass), "mobile baseClass");
doh.t(dojo.hasClass(mobile_attributes.domNode, "mblRedButton"), "mobile original class");
doh.is("something else", mobile_attributes.focusNode.value, 'mobile HTML element value');
}
}
]);
doh.register("events", [
{
name: "dijit",
timeout: 2000,
runTest: function(){
var
d = new doh.Deferred(),
dijit_events = dijit.byId('dijit_events'),
calledOnClick = false,
nop = function(){ return false; };
function onChange(v){
dijit_events.set('onChange', nop);
d.callback(true);
}
dijit_events.set('onChange', onChange);
dijit_events._onClick({ preventDefault: nop });
return d;
}
},
{
name: "mobile",
timeout: 2000,
runTest: function(){
var
d = new doh.Deferred(),
mobile_events = dijit.byId('mobile_events'),
nop = function(){ return false; };
function onChange(){
mobile_events.set('onChange', nop);
d.callback(true);
}
mobile_events.set("onChange", onChange);
setTimeout(function(){ mobile_events.focusNode.click({ preventDefault: nop }); }, 0);
return d;
}
}
]);
doh.register("programmatic", [
{
name: "dijit",
timeout: 2000,
runTest: function(){
new dijit.form.CheckBox({id:"dijit_programmatic", checked:true}).placeAt("dijit_programmatic_container", "first");
var dijit_programmatic = dijit.byId('dijit_programmatic');
var pos = dojo.position(dijit_programmatic.domNode, true);
doh.t(pos.w > 0 && pos.h > 0 && pos.x > 0 && pos.y > 0, 'dijit position');
doh.t(dijit_programmatic.get('checked'), 'dijit widget checked');
doh.t(!!dijit_programmatic.focusNode.checked, 'dijit HTML element checked');
}
},
{
name: "mobile",
timeout: 2000,
runTest: function(){
new dojox.mobile.CheckBox({id:"mobile_programmatic", checked:true}).placeAt("mobile_programmatic_container", "first");
var mobile_programmatic = dijit.byId('mobile_programmatic');
if(dojo.isIE < 8){ // older IE ignores setting checked after creation but before appending to the DOM
dojo.attr(mobile_programmatic.focusNode, "checked", mobile_programmatic.checked);
}
var pos = dojo.position(mobile_programmatic.domNode, true);
doh.t(pos.w > 0 && pos.h > 0 && pos.x > 0 && pos.y > 0, 'mobile position');
doh.t(!!mobile_programmatic.focusNode.checked, 'mobile HTML element checked');
doh.t(mobile_programmatic.get('checked'), 'mobile widget checked');
}
}
]);
var widgets = dijit.findWidgets(dojo.byId('onClickTests'));
dojo.forEach(widgets, function(widget){
widget.focusNode.click();
var id = widget.id;
var widgetVal = widget.checked;
var testId = "t" + id.substr(1);
dojo.byId(testId).click();
var expectedVal = !!dojo.byId(testId).checked;
var widgetNodeVal = !!dojo.byId(id).checked;
doh.register("onclick " + id,
function(){
doh.is(expectedVal, widgetVal, 'widget value');
doh.is(expectedVal, widgetNodeVal, 'hidden node');
}
)
});
doh.run();
});
</script>
</head>
<body class="claro">
<h1 class="testTitle">_CheckBoxMixin (dijit and mobile) non-robot tests</h1>
<table id="table">
<tr>
<th class="layout">&nbsp;</th>
<th class="layout">dijit</th>
<th class="layout">mobile</th>
</tr>
<tr>
<td class="layout">attributes</td>
<td class="layout"><input id="dijit_attributes" data-dojo-type="dijit.form.CheckBox" data-dojo-props='checked: true, "class":"mblRedButton", value:"something"'/></td>
<td class="layout"><input type="checkbox" value="something" class="mblRedButton" checked id="mobile_attributes" dojoType="dojox.mobile.CheckBox"/></td>
</tr>
<tr>
<tr>
<td class="layout">Events</td>
<td class="layout"><input id="dijit_events" data-dojo-type="dijit.form.CheckBox" data-dojo-props='onClick:function(){ return true; }' /></td>
<td class="layout"><input type="checkbox" id="mobile_events" data-dojo-type="dojox.mobile.CheckBox" data-dojo-props='onClick:function(){ return true; }' /></td>
</tr>
<tr>
<td class="layout">Programmatic</td>
<td class="layout" id="dijit_programmatic_container"></td>
<td class="layout" id="mobile_programmatic_container"></td>
</tr>
</table>
<div id="onClickTests" style="font-family:monospace;">
before click: checked=true,&nbsp; onclick handler: return false, after click:
<input id="t1" type="checkbox" checked onclick="return false">
<input dojoType="dijit.form.CheckBox" id="w1" type="checkbox" checked onclick="return false"><br>
before click: checked=true,&nbsp; onclick handler: return true,&nbsp; after click:
<input id="t2" type="checkbox" checked onclick="return true">
<input dojoType="dijit.form.CheckBox" id="w2" type="checkbox" checked onclick="return true"><br>
before click: checked=true,&nbsp; onclick handler: return false, after click:
<input id="t3" type="checkbox" checked onclick="return false">
<input dojoType="dijit.form.CheckBox" id="w3" type="checkbox" checked onclick="return false"><br>
before click: checked=true,&nbsp; onclick handler: return true,&nbsp; after click:
<input id="t4" type="checkbox" checked onclick="return true">
<input dojoType="dijit.form.CheckBox" id="w4" type="checkbox" checked onclick="return true"><br>
before click: checked=false, onclick handler: return false, after click:
<input id="t5" type="checkbox" onclick="return false">
<input dojoType="dijit.form.CheckBox" id="w5" type="checkbox" onclick="return false"><br>
before click: checked=false, onclick handler: return true,&nbsp; after click:
<input id="t6" type="checkbox" onclick="return true">
<input dojoType="dijit.form.CheckBox" id="w6" type="checkbox" onclick="return true"><br>
before click: checked=false, onclick handler: return false, after click:
<input id="t7" type="checkbox" onclick="return false">
<input dojoType="dijit.form.CheckBox" id="w7" type="checkbox" onclick="return false"><br>
before click: checked=false, onclick handler: return true,&nbsp; after click:
<input id="t8" type="checkbox" onclick="return true">
<input dojoType="dijit.form.CheckBox" id="w8" type="checkbox" onclick="return true"><br>
before click: checked=true,&nbsp; onclick handler: no return, after click:
<input id="t11" type="checkbox" checked onclick="return">
<input dojoType="dijit.form.CheckBox" id="w11" type="checkbox" checked onclick="return"><br>
before click: checked=false, onclick handler: no return, after click:
<input id="t15" type="checkbox" onclick="return">
<input dojoType="dijit.form.CheckBox" id="w15" type="checkbox" onclick="return"><br>
before click: checked=true,&nbsp; onclick handler: checked=false and return false, after click:
<input id="t101" type="checkbox" checked onclick="this.checked=false;return false">
<input dojoType="dijit.form.CheckBox" id="w101" type="checkbox" checked onclick="dijit.byId(this.id).set('checked',false);return false"><br>
before click: checked=true,&nbsp; onclick handler: checked=false and return true,&nbsp; after click:
<input id="t102" type="checkbox" checked onclick="this.checked=false;return true">
<input dojoType="dijit.form.CheckBox" id="w102" type="checkbox" checked onclick="dijit.byId(this.id).set('checked',false);return true"><br>
before click: checked=true,&nbsp; onclick handler: checked=true&nbsp; and return false, after click:
<input id="t103" type="checkbox" checked onclick="this.checked=true;return false">
<input dojoType="dijit.form.CheckBox" id="w103" type="checkbox" checked onclick="dijit.byId(this.id).set('checked',true);return false"><br>
before click: checked=true,&nbsp; onclick handler: checked=true&nbsp; and return true,&nbsp; after click:
<input id="t104" type="checkbox" checked onclick="this.checked=true;return true">
<input dojoType="dijit.form.CheckBox" id="w104" type="checkbox" checked onclick="dijit.byId(this.id).set('checked',true);return true"><br>
before click: checked=false, onclick handler: checked=false and return false, after click:
<input id="t105" type="checkbox" onclick="this.checked=false;return false">
<input dojoType="dijit.form.CheckBox" id="w105" type="checkbox" onclick="dijit.byId(this.id).set('checked',false);return false"><br>
before click: checked=false, onclick handler: checked=false and return true,&nbsp; after click:
<input id="t106" type="checkbox" onclick="this.checked=false;return true">
<input dojoType="dijit.form.CheckBox" id="w106" type="checkbox" onclick="dijit.byId(this.id).set('checked',false);return true"><br>
before click: checked=false, onclick handler: checked=true&nbsp; and return false, after click:
<input id="t107" type="checkbox" onclick="this.checked=true;return false">
<input dojoType="dijit.form.CheckBox" id="w107" type="checkbox" onclick="dijit.byId(this.id).set('checked',true);return false"><br>
before click: checked=false, onclick handler: checked=true&nbsp; and return true,&nbsp; after click:
<input id="t108" type="checkbox" onclick="this.checked=true;return true">
<input dojoType="dijit.form.CheckBox" id="w108" type="checkbox" onclick="dijit.byId(this.id).set('checked',true);return true"><br>
before click: checked=true,&nbsp; onclick handler: checked=false and no return, after click:
<input id="t111" type="checkbox" checked onclick="this.checked=false;return">
<input dojoType="dijit.form.CheckBox" id="w111" type="checkbox" checked onclick="dijit.byId(this.id).set('checked',false);return"><br>
before click: checked=true,&nbsp; onclick handler: checked=true&nbsp; and no return, after click:
<input id="t113" type="checkbox" checked onclick="this.checked=true;return">
<input dojoType="dijit.form.CheckBox" id="w113" type="checkbox" checked onclick="dijit.byId(this.id).set('checked',true);return"><br>
before click: checked=false, onclick handler: checked=false and no return, after click:
<input id="t115" type="checkbox" onclick="this.checked=false;return">
<input dojoType="dijit.form.CheckBox" id="w115" type="checkbox" onclick="dijit.byId(this.id).set('checked',false);return"><br>
before click: checked=false, onclick handler: checked=true&nbsp; and no return, after click:
<input id="t117" type="checkbox" onclick="this.checked=true;return">
<input dojoType="dijit.form.CheckBox" id="w117" type="checkbox" onclick="dijit.byId(this.id).set('checked',true);return"><br>
</div>
</body>
</html>

View File

@@ -0,0 +1,372 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>doh.robot Checkbox a11y Test</title>
<style>
@import "../../../../util/doh/robot/robot.css";
</style>
<!-- required: dojo.js -->
<script type="text/javascript" src="../../../../dojo/dojo.js"></script>
<script type="text/javascript" src="../../helpers.js"></script>
<script type="text/javascript">
dojo.require("dijit.robotx");
dojo.ready(function(){
doh.robot.initRobot('../test_CheckBox.html');
doh.register("Checkbox a11y",[
{
timeout:5000,
name:"uncheck cb0 a11y",
runTest:function(){
var d = new doh.Deferred();
dijit.byId("cb1").focus();
doh.robot.keyPress(dojo.keys.TAB, 500, {
shift: true
});
doh.robot.keyPress(dojo.keys.SPACE, 1000);
doh.robot.sequence(d.getTestCallback(function(){
doh.f(dojo.byId('cb0').checked, "cb0 was checked");
}), 1000);
return d;
}
},
{
timeout:5000,
name:"check cb1 a11y",
runTest:function(){
var d = new doh.Deferred();
doh.robot.keyPress(dojo.keys.TAB, 500);
doh.robot.keyPress(dojo.keys.SPACE, 1000);
doh.robot.sequence(d.getTestCallback(function(){
doh.t(dijit.byId('cb1').checked, "cb1 was not checked");
doh.is("true", dojo.byId('cb1').getAttribute("aria-checked"), "aria-checked");
}), 1000);
return d;
}
},
{
timeout:7000,
name:"uncheck cb2 a11y",
runTest:function(){
var d = new doh.Deferred();
doh.robot.keyPress(dojo.keys.TAB, 500);
doh.robot.keyPress(dojo.keys.TAB, 1000);
doh.robot.keyPress(dojo.keys.SPACE, 1000);
doh.robot.sequence(d.getTestCallback(function(){
doh.f(dijit.byId('cb2').checked, "cb2 was checked");
doh.is("false", dojo.byId('cb2').getAttribute("aria-checked"), "aria-checked");
}), 1000);
return d;
}
},
{
timeout:7000,
name:"cb4 readonly a11y",
runTest:function(){
var d = new doh.Deferred();
doh.robot.keyPress(dojo.keys.TAB, 500);
doh.robot.keyPress(dojo.keys.TAB, 1000);
doh.robot.keyPress(dojo.keys.SPACE, 1000);
doh.robot.sequence(d.getTestCallback(function(){
doh.t(dijit.byId('cb4').checked, "cb4 was not checked");
doh.is("true", dojo.byId('cb4').getAttribute("aria-checked"), "aria-checked");
}), 1000);
return d;
}
},
{
timeout:9000,
name:"cb6 uncheck a11y",
runTest:function(){
var d = new doh.Deferred();
doh.robot.keyPress(dojo.keys.TAB, 500);
doh.robot.keyPress(dojo.keys.TAB, 1000);
doh.robot.keyPress(dojo.keys.TAB, 1000);
doh.robot.keyPress(dojo.keys.SPACE, 1000);
doh.robot.sequence(d.getTestCallback(function(){
doh.f(dijit.byId('cb6').checked, "cb6 was checked");
doh.is("false", dojo.byId('cb6').getAttribute("aria-checked"), "aria-checked");
}), 1000);
return d;
}
},
{
timeout:3000,
name:"cb6 check a11y",
runTest:function(){
var d = new doh.Deferred();
doh.robot.keyPress(dojo.keys.SPACE, 500);
doh.robot.sequence(d.getTestCallback(function(){
doh.t(dijit.byId('cb6').checked, "cb6 was not checked");
doh.is("true", dojo.byId('cb6').getAttribute("aria-checked"), "aria-checked");
}), 1000);
return d;
}
}
]);
doh.register("Radio button a11y",[
{
timeout:6000,
name:"weather enabled a11y",
runTest:function(){
var d = new doh.Deferred();
dijit.byId("g1rb2").focus();
dijit.byId("g1rb3").set("disabled",false);
doh.robot.keyPress(dojo.keys.RIGHT_ARROW, 1000);
doh.robot.sequence(d.getTestCallback(function(){
doh.f(dijit.byId('g1rb1').checked, "news was checked");
doh.f(dijit.byId('g1rb2').checked, "talk was checked");
doh.t(dijit.byId('g1rb3').checked, "weather was not checked");
doh.is("false", dojo.byId('g1rb1').getAttribute("aria-checked")||"false", "aria-checked 1");
doh.is("false", dojo.byId('g1rb2').getAttribute("aria-checked")||"false", "aria-checked 2");
doh.is("true", dojo.byId('g1rb3').getAttribute("aria-checked"), "aria-checked 3");
}), 1000);
return d;
}
},
{
timeout:6000,
name:"change value to county a11y",
runTest:function(){
var d = new doh.Deferred();
dijit.byId("g2rb1").focus();
doh.robot.keyPress(dojo.keys.RIGHT_ARROW, 1000);
doh.robot.keyPress(dojo.keys.DOWN_ARROW, 500);
doh.robot.keyPress(dojo.keys.SPACE, 500);
doh.robot.sequence(d.getTestCallback(function(){
doh.t(dijit.byId('g2rb3').checked, "country was not checked");
doh.f(dijit.byId('g2rb2').checked, "oldies was checked");
doh.f(dijit.byId('g2rb1').checked, "top 40 was checked");
doh.is("false", dojo.byId('g2rb1').getAttribute("aria-checked")||"false", "aria-checked 1");
doh.is("false", dojo.byId('g2rb2').getAttribute("aria-checked")||"false", "aria-checked 2");
doh.is("true", dojo.byId('g2rb3').getAttribute("aria-checked"), "aria-checked 3");
}), 1000);
return d;
}
},
{
timeout:4000,
name:"change value to top 40 a11y",
runTest:function(){
var d = new doh.Deferred();
doh.robot.keyPress(dojo.keys.UP_ARROW, 500);
doh.robot.keyPress(dojo.keys.LEFT_ARROW, 500);
doh.robot.sequence(d.getTestCallback(function(){
doh.f(dijit.byId('g2rb3').checked, "country was checked");
doh.f(dijit.byId('g2rb2').checked, "oldies was checked");
doh.t(dijit.byId('g2rb1').checked, "top 40 was not checked");
doh.is("true", dojo.byId('g2rb1').getAttribute("aria-checked"), "aria-checked 1");
doh.is("false", dojo.byId('g2rb2').getAttribute("aria-checked")||"false", "aria-checked 2");
doh.is("false", dojo.byId('g2rb3').getAttribute("aria-checked")||"false", "aria-checked 3");
}), 1000);
return d;
}
},
{
timeout:11000,
name:"enable b1 a11y",
runTest:function(){
var d = new doh.Deferred();
doh.robot.keyPress(dojo.keys.TAB, 500);
doh.robot.keyPress(dojo.keys.TAB, 1000);
doh.robot.keyPress(dojo.keys.TAB, 1000);
doh.robot.keyPress(dojo.keys.TAB, 1000);
doh.robot.keyPress(dojo.keys.SPACE, 1000);
doh.robot.sequence(d.getTestCallback(function(){
doh.t(dijit.byId('b1').checked, "b1 was not checked");
doh.f(dijit.byId('b2').checked, "b2 was checked");
doh.f(dijit.byId('c1').checked, "c1 was checked");
doh.f(dijit.byId('c2').checked, "c2 was checked");
doh.f(dijit.byId('d1').checked, "d1 was checked");
doh.f(dijit.byId('d2').checked, "d2 was checked");
}), 1000);
return d;
}
},
{
timeout:3000,
name:"enable b2 a11y",
runTest:function(){
var d = new doh.Deferred();
doh.robot.keyPress(dojo.keys.DOWN_ARROW, 500);
doh.robot.sequence(d.getTestCallback(function(){
doh.f(dijit.byId('b1').checked, "b1 was checked");
doh.t(dijit.byId('b2').checked, "b2 was not checked");
doh.f(dijit.byId('c1').checked, "c1 was checked");
doh.f(dijit.byId('c2').checked, "c2 was checked");
doh.f(dijit.byId('d1').checked, "d1 was checked");
doh.f(dijit.byId('d2').checked, "d2 was checked");
}), 1000);
return d;
}
},
{
timeout:5000,
name:"enable c1 a11y",
runTest:function(){
var d = new doh.Deferred();
doh.robot.keyPress(dojo.keys.TAB, 500);
doh.robot.keyPress(dojo.keys.SPACE, 1000);
doh.robot.sequence(d.getTestCallback(function(){
doh.f(dijit.byId('b1').checked, "b1 was checked");
doh.t(dijit.byId('b2').checked, "b2 was not checked");
doh.t(dijit.byId('c1').checked, "c1 was not checked");
doh.f(dijit.byId('c2').checked, "c2 was checked");
doh.f(dijit.byId('d1').checked, "d1 was checked");
doh.f(dijit.byId('d2').checked, "d2 was checked");
}), 1000);
return d;
}
},
{
timeout:3000,
name:"enable c2 a11y",
runTest:function(){
var d = new doh.Deferred();
doh.robot.keyPress(dojo.keys.RIGHT_ARROW, 500);
doh.robot.sequence(d.getTestCallback(function(){
doh.f(dijit.byId('b1').checked, "b1 was checked");
doh.t(dijit.byId('b2').checked, "b2 was not checked");
doh.f(dijit.byId('c1').checked, "c1 was checked");
doh.t(dijit.byId('c2').checked, "c2 was not checked");
doh.f(dijit.byId('d1').checked, "d1 was checked");
doh.f(dijit.byId('d2').checked, "d2 was checked");
}), 1000);
return d;
}
},
{
timeout:6000,
name:"enable d2 a11y",
runTest:function(){
var d = new doh.Deferred();
doh.robot.keyPress(dojo.keys.TAB, 500);
doh.robot.keyPress(dojo.keys.RIGHT_ARROW, 1000);
doh.robot.keyPress(dojo.keys.SPACE, 500);
doh.robot.sequence(d.getTestCallback(function(){
doh.f(dijit.byId('b1').checked, "b1 was checked");
doh.t(dijit.byId('b2').checked, "b2 was not checked");
doh.f(dijit.byId('c1').checked, "c1 was checked");
doh.t(dijit.byId('c2').checked, "c2 was not checked");
doh.f(dijit.byId('d1').checked, "d1 was checked");
doh.t(dijit.byId('d2').checked, "d2 was not checked");
}), 1000);
return d;
}
},
{
timeout:3000,
name:"enable d1 a11y",
runTest:function(){
var d = new doh.Deferred();
doh.robot.keyPress(dojo.keys.UP_ARROW, 500);
doh.robot.sequence(d.getTestCallback(function(){
doh.f(dijit.byId('b1').checked, "b1 was checked");
doh.t(dijit.byId('b2').checked, "b2 was not checked");
doh.f(dijit.byId('c1').checked, "c1 was checked");
doh.t(dijit.byId('c2').checked, "c2 was not checked");
doh.t(dijit.byId('d1').checked, "d1 was not checked");
doh.f(dijit.byId('d2').checked, "d2 was checked");
}), 1000);
return d;
}
},
{
timeout:5000,
name:"enable coffee a11y",
runTest:function(){
var d = new doh.Deferred();
doh.robot.keyPress(dojo.keys.TAB, 500);
doh.robot.keyPress(dojo.keys.DOWN_ARROW, 1000);
doh.robot.sequence(d.getTestCallback(function(){
doh.f(dijit.byId('g4rb1').checked, "tea was checked");
doh.t(dijit.byId('g4rb2').checked, "coffee was not checked");
}), 1000);
return d;
}
}
]);
doh.register("CheckBox watch",
[
function w(){
var cb = dijit.byId('cb2');
cb.set("checked", true);
var oldWatch, newWatch;
cb.watch("checked", function(name, o, n){
oldWatch = o;
newWatch = n;
});
cb.set("checked", false);
doh.t(oldWatch, "old value was checked");
doh.f(newWatch, "new value is unchecked");
cb.set("checked", true);
doh.f(oldWatch, "old value was unchecked");
doh.t(newWatch, "new value is checked");
}
]
);
doh.run();
});
</script>
</head>
</html>

View File

@@ -0,0 +1,506 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>doh.robot Checkbox mouse Test</title>
<style>
@import "../../../../util/doh/robot/robot.css";
</style>
<!-- required: dojo.js -->
<script type="text/javascript" src="../../../../dojo/dojo.js"></script>
<script type="text/javascript" src="../../helpers.js"></script>
<script type="text/javascript">
dojo.require("dijit.robotx");
dojo.require("dijit.form.CheckBox");
// These are the values assigned to the widgets in the page's HTML
var originalGet = {
cb1: [],
cb2: ["on"],
cb4: ["on"],
cb5: [],
cb6: ["on"],
cb7: [],
'g[1]': "talk",
g2: null
};
var originalSubmit = {
cb2: "on",
cb4: "on",
cb6: "on",
'g[1]': "talk"
};
// attempt to change these values
var change = {
cb1: ["foo"],
cb2: [],
cb3: ["on"],
cb4: [],
cb5: ["on"],
cb6: ["foo"],
'g[1]': "weather",
g2: "country"
};
// changed values
var changedGet = {
cb1: ["foo"],
cb2: [],
cb4: [],
cb5: ["on"],
cb6: [],
cb7: [],
'g[1]': null,
g2: "country"
};
var changedSubmit = {
cb1: "foo",
cb5: "on",
g2: "country"
};
dojo.ready(function(){
doh.robot.initRobot('../test_CheckBox.html');
// should be able to query for all of the inputs, including hidden ones
doh.register("query input by checked state", [
{
name: "query checked",
runTest: function(){
var queried=dojo.query("input[checked]", dojo.byId('myForm'));
doh.is(5,queried.length,"expected: 5 checked widgets, got: "+queried.length);
}
}
]);
doh.register("query input by name", [
{
name: "query name",
runTest: function(){
var queried=dojo.query("input[name]", dojo.byId('myForm'));
doh.is(13,queried.length,"expected: 13 named widgets, got: "+queried.length);
}
}
]);
var formWidget = dijit.byId("myForm");
var submitForm = function(name, testValues){
return {
name: name,
timeout: 5000,
runTest: function(){
var d = new doh.Deferred();
submittedValues = function(formValues){
d.getTestCallback(function(){
for(var i in originalGet){ doh.is(testValues[i], formValues[i], i); }
})();
};
formWidget.submit();
return d;
},
tearDown: function(){
submittedValues = defaultSubmitHandler;
}
};
};
doh.register("CheckBox values", [
function getValues(){
doh.is( dojo.toJson(originalGet), dojo.global.dojo.toJson(dijit.byId("myForm").get('value')) );
},
{
timeout:3000,
name:"setValues",
runTest:function(){
var d = new doh.Deferred();
doh.robot.sequence(function(){ submitForm("original submit", originalSubmit); }, 500);
doh.robot.sequence(function(){ dijit.byId("myForm").set('value', change); }, 500);
doh.robot.sequence(d.getTestCallback(function(){
doh.is( dojo.toJson(changedGet), dojo.global.dojo.toJson(dijit.byId("myForm").get('value')) );
}), 1000);
return d;
}
},
{
timeout:3000,
name:"resetValues",
runTest:function(){
var d = new doh.Deferred();
doh.robot.sequence(function(){ submitForm("changed submit", changedSubmit); }, 500);
doh.robot.sequence(function(){ dijit.byId("myForm").reset(); }, 500);
doh.robot.sequence(d.getTestCallback(function(){
doh.is( dojo.toJson(originalGet), dojo.global.dojo.toJson(dijit.byId("myForm").get('value')), "reset to original values" );
}), 1000);
return d;
}
},
{
timeout:3000,
name:"readOnly",
runTest:function(){
var d = new doh.Deferred();
doh.robot.sequence(function(){ submitForm("reset submit", originalSubmit); }, 500);
doh.robot.mouseMoveAt("cb4", 500, 1);
doh.robot.mouseClick({left:true}, 500);
doh.robot.sequence(d.getTestCallback(function(){
doh.is( dojo.toJson(originalGet), dojo.global.dojo.toJson(dijit.byId("myForm").get('value')), "still have original values" );
submitForm("resubmit", originalSubmit);
}), 1000);
return d;
}
}
]);
doh.register("CheckBox onChange",
[
function fireOnChange(){
var d = new doh.Deferred();
var cb = dijit.byId('cb2');
var lastOnChange = dojo.byId('oncheckedoutput').innerHTML;
cb.set('checked', !cb.get('checked'));
setTimeout(d.getTestCallback(function(){
doh.isNot(lastOnChange, dojo.byId('oncheckedoutput').innerHTML);
}), 500);
return d;
},
function skipOnChange(){
var d = new doh.Deferred();
var cb = dijit.byId('cb2');
var lastOnChange = dojo.byId('oncheckedoutput').innerHTML;
cb.set('checked', !cb.get('checked'), false);
setTimeout(d.getTestCallback(function(){
doh.is(lastOnChange, dojo.byId('oncheckedoutput').innerHTML);
}), 500);
return d;
}
]
);
doh.register("Radio button onChange",[
function checkInitialValues(){
doh.f(dijit.byId('g1rb1').checked, "news was checked");
doh.t(dijit.byId('g1rb2').checked, "talk was not checked");
doh.f(dijit.byId('g1rb3').checked, "weather was checked");
doh.f(dijit.byId('g2rb1').checked, "top 40 was checked");
doh.f(dijit.byId('g2rb2').checked, "oldies was checked");
doh.f(dijit.byId('g2rb3').checked, "country was checked");
doh.f(dojo.byId('g3rb1').checked, "rock was checked");
doh.f(dojo.byId('g3rb2').checked, "jazz was checked");
doh.t(dojo.byId('g3rb3').checked, "classical was not checked");
doh.t(dijit.byId('g4rb1').checked, "tea was not checked");
doh.f(dijit.byId('g4rb2').checked, "coffee was checked");
},
{
timeout:3000,
name:"change value to news",
runTest:function(){
var d = new doh.Deferred();
doh.robot.mouseMoveAt("g1rb1", 500, 1);
doh.robot.mouseClick({left:true}, 500);
doh.robot.sequence(d.getTestCallback(function(){
doh.t(dijit.byId('g1rb1').checked, "news was not checked");
doh.f(dijit.byId('g1rb2').checked, "talk was checked");
doh.f(dijit.byId('g1rb3').checked, "weather was checked");
}), 1000);
return d;
}
},
{
timeout:3000,
name:"weather disabled",
runTest:function(){
var d = new doh.Deferred();
doh.robot.mouseMoveAt("g1rb3", 500, 1);
doh.robot.mouseClick({left:true}, 500);
doh.robot.sequence(d.getTestCallback(function(){
doh.t(dijit.byId('g1rb1').checked, "news was not checked");
doh.f(dijit.byId('g1rb2').checked, "talk was checked");
doh.f(dijit.byId('g1rb3').checked, "weather was checked");
}), 1000);
return d;
}
},
{
timeout:4000,
name:"weather enabled",
runTest:function(){
var d = new doh.Deferred();
doh.robot.mouseMoveAt("enableWeatherButton", 500, 1);
doh.robot.mouseClick({left:true}, 500);
doh.robot.mouseMoveAt("g1rb3", 500, 1);
doh.robot.mouseClick({left:true}, 500);
doh.robot.sequence(d.getTestCallback(function(){
doh.f(dijit.byId('g1rb1').checked, "news was checked");
doh.f(dijit.byId('g1rb2').checked, "talk was checked");
doh.t(dijit.byId('g1rb3').checked, "weather was not checked");
}), 1000);
return d;
}
},
{
timeout:3000,
name:"change value to county",
runTest:function(){
var d = new doh.Deferred();
doh.robot.mouseMoveAt("g2rb3", 500, 1);
doh.robot.mouseClick({left:true}, 500);
doh.robot.sequence(d.getTestCallback(function(){
doh.t(dijit.byId('g2rb3').checked, "country was not checked");
doh.f(dijit.byId('g2rb2').checked, "oldies was checked");
doh.f(dijit.byId('g2rb1').checked, "top 40 was checked");
}), 1000);
return d;
}
},
{
timeout:3000,
name:"change value to top 40",
runTest:function(){
var d = new doh.Deferred();
doh.robot.mouseMoveAt("g2rb1", 500, 1);
doh.robot.mouseClick({left:true}, 500);
doh.robot.sequence(d.getTestCallback(function(){
doh.f(dijit.byId('g2rb3').checked, "country was checked");
doh.f(dijit.byId('g2rb2').checked, "oldies was checked");
doh.t(dijit.byId('g2rb1').checked, "top 40 was not checked");
}), 1000);
return d;
}
},
{
timeout:3000,
name:"change value to oldies",
runTest:function(){
var d = new doh.Deferred();
doh.robot.mouseMoveAt("g2rb2", 500, 1);
doh.robot.mouseClick({left:true}, 500);
doh.robot.sequence(d.getTestCallback(function(){
doh.f(dijit.byId('g2rb3').checked, "country was checked");
doh.t(dijit.byId('g2rb2').checked, "oldies was not checked");
doh.f(dijit.byId('g2rb1').checked, "top 40 was checked");
}), 1000);
return d;
}
},
{
timeout:3000,
name:"change value to rock",
runTest:function(){
var d = new doh.Deferred();
doh.robot.mouseMoveAt("g3rb1", 500, 1);
doh.robot.mouseClick({left:true}, 500);
doh.robot.sequence(d.getTestCallback(function(){
doh.t(dojo.byId('g3rb1').checked, "rock was not checked");
doh.f(dojo.byId('g3rb2').checked, "jazz was checked");
doh.f(dojo.byId('g3rb3').checked, "classical was checked");
}), 1000);
return d;
}
},
{
timeout:3000,
name:"disabled jazz",
runTest:function(){
var d = new doh.Deferred();
doh.robot.mouseMoveAt("g3rb2", 500, 1);
doh.robot.mouseClick({left:true}, 500);
doh.robot.sequence(d.getTestCallback(function(){
doh.t(dojo.byId('g3rb1').checked, "rock was not checked");
doh.f(dojo.byId('g3rb2').checked, "jazz was checked");
doh.f(dojo.byId('g3rb3').checked, "classical was checked");
}), 1000);
return d;
}
},
{
timeout:3000,
name:"enable b1",
runTest:function(){
var d = new doh.Deferred();
doh.robot.mouseMoveAt("b1", 500, 1);
doh.robot.mouseClick({left:true}, 500);
doh.robot.sequence(d.getTestCallback(function(){
doh.t(dijit.byId('b1').checked, "b1 was not checked");
doh.f(dijit.byId('b2').checked, "b2 was checked");
doh.f(dijit.byId('c1').checked, "c1 was checked");
doh.f(dijit.byId('c2').checked, "c2 was checked");
doh.f(dijit.byId('d1').checked, "d1 was checked");
doh.f(dijit.byId('d2').checked, "d2 was checked");
}), 1000);
return d;
}
},
{
timeout:3000,
name:"enable b2",
runTest:function(){
var d = new doh.Deferred();
doh.robot.mouseMoveAt("b2", 500, 1);
doh.robot.mouseClick({left:true}, 500);
doh.robot.sequence(d.getTestCallback(function(){
doh.f(dijit.byId('b1').checked, "b1 was checked");
doh.t(dijit.byId('b2').checked, "b2 was not checked");
doh.f(dijit.byId('c1').checked, "c1 was checked");
doh.f(dijit.byId('c2').checked, "c2 was checked");
doh.f(dijit.byId('d1').checked, "d1 was checked");
doh.f(dijit.byId('d2').checked, "d2 was checked");
}), 1000);
return d;
}
},
{
timeout:3000,
name:"enable c1",
runTest:function(){
var d = new doh.Deferred();
doh.robot.mouseMoveAt("c1", 500, 1);
doh.robot.mouseClick({left:true}, 500);
doh.robot.sequence(d.getTestCallback(function(){
doh.f(dijit.byId('b1').checked, "b1 was checked");
doh.t(dijit.byId('b2').checked, "b2 was not checked");
doh.t(dijit.byId('c1').checked, "c1 was not checked");
doh.f(dijit.byId('c2').checked, "c2 was checked");
doh.f(dijit.byId('d1').checked, "d1 was checked");
doh.f(dijit.byId('d2').checked, "d2 was checked");
}), 1000);
return d;
}
},
{
timeout:3000,
name:"enable c2",
runTest:function(){
var d = new doh.Deferred();
doh.robot.mouseMoveAt("c2", 500, 1);
doh.robot.mouseClick({left:true}, 500);
doh.robot.sequence(d.getTestCallback(function(){
doh.f(dijit.byId('b1').checked, "b1 was checked");
doh.t(dijit.byId('b2').checked, "b2 was not checked");
doh.f(dijit.byId('c1').checked, "c1 was checked");
doh.t(dijit.byId('c2').checked, "c2 was not checked");
doh.f(dijit.byId('d1').checked, "d1 was checked");
doh.f(dijit.byId('d2').checked, "d2 was checked");
}), 1000);
return d;
}
},
{
timeout:3000,
name:"enable d2",
runTest:function(){
var d = new doh.Deferred();
doh.robot.mouseMoveAt("d2", 500, 1);
doh.robot.mouseClick({left:true}, 500);
doh.robot.sequence(d.getTestCallback(function(){
doh.f(dijit.byId('b1').checked, "b1 was checked");
doh.t(dijit.byId('b2').checked, "b2 was not checked");
doh.f(dijit.byId('c1').checked, "c1 was checked");
doh.t(dijit.byId('c2').checked, "c2 was not checked");
doh.f(dijit.byId('d1').checked, "d1 was checked");
doh.t(dijit.byId('d2').checked, "d2 was not checked");
}), 1000);
return d;
}
},
{
timeout:3000,
name:"enable d1",
runTest:function(){
var d = new doh.Deferred();
doh.robot.mouseMoveAt("d1", 500, 1);
doh.robot.mouseClick({left:true}, 500);
doh.robot.sequence(d.getTestCallback(function(){
doh.f(dijit.byId('b1').checked, "b1 was checked");
doh.t(dijit.byId('b2').checked, "b2 was not checked");
doh.f(dijit.byId('c1').checked, "c1 was checked");
doh.t(dijit.byId('c2').checked, "c2 was not checked");
doh.t(dijit.byId('d1').checked, "d1 was not checked");
doh.f(dijit.byId('d2').checked, "d2 was checked");
}), 1000);
return d;
}
},
{
timeout:3000,
name:"enable coffee",
runTest:function(){
var d = new doh.Deferred();
doh.robot.mouseMoveAt("g4rb2", 500, 1);
doh.robot.mouseClick({left:true}, 500);
doh.robot.sequence(d.getTestCallback(function(){
doh.f(dijit.byId('g4rb1').checked, "tea was checked");
doh.t(dijit.byId('g4rb2').checked, "coffee was not checked");
}), 1000);
return d;
}
}
]);
doh.run();
});
</script>
</head>
</html>

View File

@@ -0,0 +1,10 @@
<tr class="dijitReset dijitMenuItem" data-dojo-attach-point="focusNode" role="menuitemcheckbox" tabIndex="-1"
data-dojo-attach-event="onmouseenter:_onHover,onmouseleave:_onUnhover,ondijitclick:_onClick">
<td class="dijitReset dijitMenuItemIconCell" role="presentation">
<img src="${_blankGif}" alt="" class="dijitMenuItemIcon dijitCheckedMenuItemIcon" data-dojo-attach-point="iconNode"/>
<span class="dijitCheckedMenuItemIconChar">&#10003;</span>
</td>
<td class="dijitReset dijitMenuItemLabel" colspan="2" data-dojo-attach-point="containerNode,labelNode"></td>
<td class="dijitReset dijitMenuItemAccelKey" style="display: none" data-dojo-attach-point="accelKeyNode"></td>
<td class="dijitReset dijitMenuArrowCell" role="presentation">&#160;</td>
</tr>

View File

@@ -0,0 +1,8 @@
<div class="dijit dijitReset dijitInline dijitLeft" id="widget_${id}"
><div data-dojo-attach-point="comboButtonNode"
></div
><div data-dojo-attach-point="selectNode" class="dijit dijitReset dijitInline ${baseClass}Wrapper" data-dojo-attach-event="onmousedown:_onMouseDown,onclick:focus"
><select class="${baseClass}Select dojoxCheckedMultiSelectHidden" multiple="true" data-dojo-attach-point="containerNode,focusNode"></select
><div data-dojo-attach-point="wrapperDiv"></div
></div
></div>

View File

@@ -0,0 +1,132 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1"> <!-- Use Chrome Frame in IE -->
<meta name="viewport" content="width=device-width, height=device-height, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no">
<meta name="description" content="Draw circles and ellipses contoured to the globe.">
<title>Cesium Demo</title>
<script type="text/javascript" src="../Sandcastle-header.js"></script>
<script data-dojo-config="async: 1, tlmSiblingOfDojo: 0" src="../../../ThirdParty/dojo-release-1.7.2-src/dojo/dojo.js"></script>
<script type="text/javascript">
require({
baseUrl : '../../..',
packages: [
{ name: 'dojo', location: 'ThirdParty/dojo-release-1.7.2-src/dojo' },
{ name: 'dijit', location: 'ThirdParty/dojo-release-1.7.2-src/dijit' },
{ name: 'dojox', location: 'ThirdParty/dojo-release-1.7.2-src/dojox' },
{ name: 'Assets', location: 'Source/Assets' },
{ name: 'Core', location: 'Source/Core' },
{ name: 'DynamicScene', location: 'Source/DynamicScene' },
{ name: 'Renderer', location: 'Source/Renderer' },
{ name: 'Scene', location: 'Source/Scene' },
{ name: 'Shaders', location: 'Source/Shaders' },
{ name: 'ThirdParty', location: 'Source/ThirdParty' },
{ name: 'Widgets', location: 'Source/Widgets' },
{ name: 'Workers', location: 'Source/Workers' }
]
});
</script>
<link rel="Stylesheet" href="../../../ThirdParty/dojo-release-1.7.2-src/dijit/themes/claro/claro.css" type="text/css">
<link rel="Stylesheet" href="../../../Source/Widgets/Dojo/CesiumViewerWidget.css" type="text/css">
</head>
<body class="claro" data-sandcastle-bucket="bucket-dojo.html" data-sandcastle-title="Cesium + Dojo">
<style>
body {
background: #000;
color: #eee;
font-family: sans-serif;
font-size: 9pt;
padding: 0;
margin: 0;
width: 100%;
height: 100%;
overflow: hidden;
}
.fullSize {
display: block;
position: absolute;
top: 0;
left: 0;
border: none;
width: 100%;
height: 100%;
}
#toolbar {
margin: 5px;
padding: 2px 5px;
position: absolute;
}
</style>
<div id="cesiumContainer" class="fullSize"></div>
<div id="toolbar">Loading...</div>
<script id="cesium_sandcastle_script">
require([
'Source/Cesium', 'Widgets/Dojo/CesiumViewerWidget',
'dojo/on', 'dojo/dom'
], function(
Cesium, CesiumViewerWidget,
on, dom)
{
"use strict";
function createPrimitives(widget) {
var scene = widget.scene;
var ellipsoid = widget.ellipsoid;
var primitives = scene.getPrimitives();
var polylines = new Cesium.PolylineCollection();
// Fill circle
var circle = new Cesium.Polygon();
Sandcastle.declare(circle); // For highlighting on mouseover in Sandcastle.
circle.setPositions(Cesium.Shapes.computeCircleBoundary(
ellipsoid, ellipsoid.cartographicToCartesian(
Cesium.Cartographic.fromDegrees(-75.0, 40.0)), 300000.0));
primitives.add(circle);
// Outline circle
var outline = polylines.add();
Sandcastle.declare(outline); // For highlighting on mouseover in Sandcastle.
outline.setPositions(Cesium.Shapes.computeCircleBoundary(
ellipsoid, ellipsoid.cartographicToCartesian(
Cesium.Cartographic.fromDegrees(-82.0, 37.0)), 300000.0));
primitives.add(polylines);
// Apply a material to a filled circle
var circle2 = new Cesium.Polygon();
Sandcastle.declare(circle2); // For highlighting on mouseover in Sandcastle.
circle2.setPositions(Cesium.Shapes.computeCircleBoundary(
ellipsoid, ellipsoid.cartographicToCartesian(
Cesium.Cartographic.fromDegrees(-90.0, 35.0)), 400000.0));
// Any polygon-compatible material can be used
circle2.material = Cesium.Material.fromType(scene.getContext(), Cesium.Material.TyeDyeType);
primitives.add(circle2);
// Fill an ellipse
var ellipse = new Cesium.Polygon();
Sandcastle.declare(ellipse); // For highlighting on mouseover in Sandcastle.
ellipse.setPositions(Cesium.Shapes.computeEllipseBoundary(
ellipsoid, ellipsoid.cartographicToCartesian(
Cesium.Cartographic.fromDegrees(-78.0, 32.5)), 500000.0,
250000.0, Cesium.Math.toRadians(60)));
primitives.add(ellipse);
}
var widget = new CesiumViewerWidget({
onObjectMousedOver : function(mousedOverObject) {
widget.highlightObject(mousedOverObject);
Sandcastle.highlight(mousedOverObject);
}
});
widget.placeAt(dom.byId('cesiumContainer'));
widget.startup();
dom.byId('toolbar').innerHTML = '';
createPrimitives(widget);
});
</script>
</body>
</html>

View File

@@ -0,0 +1,9 @@
<div class="dojoxGridClearFilterConfirm">
<div class="dojoxGridClearFilterMsg">
${_clearFilterMsg}
</div>
<div class="dojoxGridClearFilterBtns" dojoAttachPoint="btnsNode">
<span dojoType="dijit.form.Button" label="${_cancelBtnLabel}" dojoAttachPoint="cancelBtn" dojoAttachEvent="onClick:_onCancel"></span>
<span dojoType="dijit.form.Button" label="${_clearBtnLabel}" dojoAttachPoint="clearBtn" dojoAttachEvent="onClick:_onClear"></span>
</div>
</div>

View File

@@ -0,0 +1,203 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1"> <!-- Use Chrome Frame in IE -->
<meta name="viewport" content="width=device-width, height=device-height, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no">
<meta name="description" content="This example supplies custom CZML objects directly to the CesiumViewerWidget.">
<title>Cesium Demo</title>
<script type="text/javascript" src="../Sandcastle-header.js"></script>
<script data-dojo-config="async: 1, tlmSiblingOfDojo: 0" src="../../../ThirdParty/dojo-release-1.7.2-src/dojo/dojo.js"></script>
<script type="text/javascript">
require({
baseUrl : '../../..',
packages: [
{ name: 'dojo', location: 'ThirdParty/dojo-release-1.7.2-src/dojo' },
{ name: 'dijit', location: 'ThirdParty/dojo-release-1.7.2-src/dijit' },
{ name: 'dojox', location: 'ThirdParty/dojo-release-1.7.2-src/dojox' },
{ name: 'Assets', location: 'Source/Assets' },
{ name: 'Core', location: 'Source/Core' },
{ name: 'DynamicScene', location: 'Source/DynamicScene' },
{ name: 'Renderer', location: 'Source/Renderer' },
{ name: 'Scene', location: 'Source/Scene' },
{ name: 'Shaders', location: 'Source/Shaders' },
{ name: 'ThirdParty', location: 'Source/ThirdParty' },
{ name: 'Widgets', location: 'Source/Widgets' },
{ name: 'Workers', location: 'Source/Workers' }
]
});
</script>
<link rel="Stylesheet" href="../../../ThirdParty/dojo-release-1.7.2-src/dijit/themes/claro/claro.css" type="text/css">
<link rel="Stylesheet" href="../../../Source/Widgets/Dojo/CesiumViewerWidget.css" type="text/css">
</head>
<body class="claro" data-sandcastle-bucket="bucket-dojo.html" data-sandcastle-title="Cesium + Dojo">
<style>
body {
background: #000;
color: #eee;
font-family: sans-serif;
font-size: 9pt;
padding: 0;
margin: 0;
width: 100%;
height: 100%;
overflow: hidden;
}
.fullSize {
display: block;
position: absolute;
top: 0;
left: 0;
border: none;
width: 100%;
height: 100%;
}
#toolbar {
margin: 5px;
padding: 2px 5px;
position: absolute;
}
</style>
<div id="cesiumContainer" class="fullSize"></div>
<div id="toolbar">Loading...</div>
<script id="cesium_sandcastle_script">
require([
'Source/Cesium', 'Widgets/Dojo/CesiumViewerWidget',
'dojo/on', 'dojo/dom'
], function(
Cesium, CesiumViewerWidget,
on, dom)
{
"use strict";
// This demo shows dynamically-generated CZML along
// with a custom visualizer and custom render loop.
// For a simpler example see the "Simple CZML Demo".
var czml = [
{
"id" : "Vehicle",
"availability" : "2012-08-04T16:00:00Z/2012-08-04T17:04:54.9962195740191Z",
"billboard" : {
"eyeOffset" : {
"cartesian" : [0.0, 0.0, 0.0]
},
"horizontalOrigin" : "CENTER",
"image" : "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAEISURBVEhLvVXBDYQwDOuojHKj8LhBbpTbpBCEkZsmIVTXq1RVQGrHiWlLmTTqPiZBlyLgy/KSZQ5JSHDQ/mCYCsC8106kDU0AdwRnvYZArWRcAl0dcYJq1hWCb3hBrumbDAVMwAC82WoRvgMnVMDBnB0nYZFTbE6BBvdUGqVqCbjBIk3PyFFR/NU7EKzru+qZsau3ryPwwCRLKYOzutZuCL6fUmWeJGzNzL/RxAMrUmASSCkkAayk2IxPlwhAAYGpsiHQjbLccfdOY5gKkCXAMi7SscAwbQpAnKyctWyUZ6z8ja3OGMepwD8asz+9FnSvbhU8uVOHFIwQsI3/p0CfhuqCSQuxLqsN6mu8SS+N42MAAAAASUVORK5CYII=",
"pixelOffset" : {
"cartesian2" : [0.0, 0.0]
},
"scale" : 0.8333333333333334,
"show" : [{
"interval" : "2012-08-04T16:00:00Z/2012-08-04T18:00:00Z",
"boolean" : true
}],
"verticalOrigin" : "BOTTOM"
},
"label" : {
"fillColor" : [{
"interval" : "2012-08-04T16:00:00Z/2012-08-04T18:00:00Z",
"rgba" : [255, 255, 0, 255]
}],
"font" : "bold 10pt Segoe UI Semibold",
"horizontalOrigin" : "LEFT",
"outlineColor" : {
"rgba" : [0, 0, 0, 255]
},
"pixelOffset" : {
"cartesian2" : [10.0, 0.0]
},
"scale" : 1.0,
"show" : [{
"interval" : "2012-08-04T16:00:00Z/2012-08-04T18:00:00Z",
"boolean" : true
}],
"style" : "FILL",
"text" : "Vehicle",
"verticalOrigin" : "CENTER"
},
"path" : {
"color" : [{
"interval" : "2012-08-04T16:00:00Z/2012-08-04T18:00:00Z",
"rgba" : [255, 255, 0, 255]
}],
"outlineWidth" : 0.0,
"width" : [{
"interval" : "2012-08-04T16:00:00Z/2012-08-04T18:00:00Z",
"number" : 5.0
}],
"show" : [{
"interval" : "2012-08-04T16:00:00Z/2012-08-04T18:00:00Z",
"boolean" : true
}]
},
"position" : {
"interpolationAlgorithm" : "LAGRANGE",
"interpolationDegree" : 1,
"epoch" : "2012-08-04T16:00:00Z",
// Trimmed to just 2 points
"cartesian" : [0.0, -2379754.6637012, -4665332.88013588, 3628133.68924173,
3894.996219574019, -2291336.52323822, -4682359.21232197, 3662718.52171165]
}
}
];
// Add CZML to the scene and set the clock range
function addCZML(czml, scene, clock) {
// Create a DynamicObjectCollection for handling the CZML
var dynamicObjectCollection = new Cesium.DynamicObjectCollection();
// Create the standard CZML visualizer collection
var visualizers = Cesium.VisualizerCollection.createCzmlStandardCollection(scene, dynamicObjectCollection);
// Process the CZML, which populates the collection with DynamicObjects
Cesium.processCzml(czml, dynamicObjectCollection);
// Figure out the time span of the data
var availability = dynamicObjectCollection.computeAvailability();
// Set the clock range
clock.startTime = availability.start.clone();
clock.currentTime = availability.start.clone();
clock.stopTime = availability.stop.clone();
clock.clockRange = Cesium.ClockRange.LOOP;
return visualizers;
}
var widget = new CesiumViewerWidget();
widget.placeAt(dom.byId('cesiumContainer'));
dom.byId('toolbar').innerHTML = '';
widget.autoStartRenderLoop = false; // We need a custom render loop
widget.startup();
var visualizers = addCZML(czml, widget.scene, widget.clock);
widget.timelineControl.zoomTo(widget.clock.startTime, widget.clock.stopTime);
// Let's make the playback speed faster
widget.clock.multiplier = 300.0;
// Custom render loop adapted from CesiumViewerWidget.startRenderLoop()
var animationController = widget.animationController;
function updateAndRender() {
var currentTime = animationController.update();
widget.initializeFrame(currentTime);
widget.update(currentTime);
// Update the visualizers...
visualizers.update(currentTime);
widget.render();
Cesium.requestAnimationFrame(updateAndRender);
}
Cesium.requestAnimationFrame(updateAndRender);
// Zoom in a little closer...
var extent = new Cesium.Extent(-2.056, 0.587, -2.010, 0.633);
widget.scene.getCamera().controller.viewExtent(extent);
});
</script>
</body>
</html>

784
master/examples/Clock.html Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

9474
master/examples/Color.html Normal file

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,5 @@
<div class="dijitInline dijitColorPalette">
<table dojoAttachPoint="paletteTableNode" class="dijitPaletteTable" cellSpacing="0" cellPadding="0" role="grid">
<tbody data-dojo-attach-point="gridNode"></tbody>
</table>
</div>

View File

@@ -0,0 +1,72 @@
<table class="dojoxColorPicker" dojoAttachEvent="onkeypress: _handleKey" cellpadding="0" cellspacing="0">
<tr>
<td valign="top" class="dojoxColorPickerRightPad">
<div class="dojoxColorPickerBox">
<!-- Forcing ABS in style attr due to dojo DND issue with not picking it up form the class. -->
<img role="status" title="${saturationPickerTitle}" alt="${saturationPickerTitle}" class="dojoxColorPickerPoint" src="${_pickerPointer}" tabIndex="0" dojoAttachPoint="cursorNode" style="position: absolute; top: 0px; left: 0px;">
<img role="presentation" alt="" dojoAttachPoint="colorUnderlay" dojoAttachEvent="onclick: _setPoint, onmousedown: _stopDrag" class="dojoxColorPickerUnderlay" src="${_underlay}" ondragstart="return false">
</div>
</td>
<td valign="top" class="dojoxColorPickerRightPad">
<div class="dojoxHuePicker">
<!-- Forcing ABS in style attr due to dojo DND issue with not picking it up form the class. -->
<img role="status" dojoAttachPoint="hueCursorNode" tabIndex="0" class="dojoxHuePickerPoint" title="${huePickerTitle}" alt="${huePickerTitle}" src="${_huePickerPointer}" style="position: absolute; top: 0px; left: 0px;">
<div class="dojoxHuePickerUnderlay" dojoAttachPoint="hueNode">
<img role="presentation" alt="" dojoAttachEvent="onclick: _setHuePoint, onmousedown: _stopDrag" src="${_hueUnderlay}">
</div>
</div>
</td>
<td valign="top">
<table cellpadding="0" cellspacing="0">
<tr>
<td valign="top" class="dojoxColorPickerPreviewContainer">
<table cellpadding="0" cellspacing="0">
<tr>
<td valign="top" class="dojoxColorPickerRightPad">
<div dojoAttachPoint="previewNode" class="dojoxColorPickerPreview"></div>
</td>
<td valign="top">
<div dojoAttachPoint="safePreviewNode" class="dojoxColorPickerWebSafePreview"></div>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td valign="bottom">
<table class="dojoxColorPickerOptional" cellpadding="0" cellspacing="0">
<tr>
<td>
<div class="dijitInline dojoxColorPickerRgb" dojoAttachPoint="rgbNode">
<table cellpadding="1" cellspacing="1">
<tr><td><label for="${_uId}_r">${redLabel}</label></td><td><input id="${_uId}_r" dojoAttachPoint="Rval" size="1" dojoAttachEvent="onchange: _colorInputChange"></td></tr>
<tr><td><label for="${_uId}_g">${greenLabel}</label></td><td><input id="${_uId}_g" dojoAttachPoint="Gval" size="1" dojoAttachEvent="onchange: _colorInputChange"></td></tr>
<tr><td><label for="${_uId}_b">${blueLabel}</label></td><td><input id="${_uId}_b" dojoAttachPoint="Bval" size="1" dojoAttachEvent="onchange: _colorInputChange"></td></tr>
</table>
</div>
</td>
<td>
<div class="dijitInline dojoxColorPickerHsv" dojoAttachPoint="hsvNode">
<table cellpadding="1" cellspacing="1">
<tr><td><label for="${_uId}_h">${hueLabel}</label></td><td><input id="${_uId}_h" dojoAttachPoint="Hval"size="1" dojoAttachEvent="onchange: _colorInputChange"> ${degLabel}</td></tr>
<tr><td><label for="${_uId}_s">${saturationLabel}</label></td><td><input id="${_uId}_s" dojoAttachPoint="Sval" size="1" dojoAttachEvent="onchange: _colorInputChange"> ${percentSign}</td></tr>
<tr><td><label for="${_uId}_v">${valueLabel}</label></td><td><input id="${_uId}_v" dojoAttachPoint="Vval" size="1" dojoAttachEvent="onchange: _colorInputChange"> ${percentSign}</td></tr>
</table>
</div>
</td>
</tr>
<tr>
<td colspan="2">
<div class="dojoxColorPickerHex" dojoAttachPoint="hexNode" aria-live="polite">
<label for="${_uId}_hex">&nbsp;${hexLabel}&nbsp;</label><input id="${_uId}_hex" dojoAttachPoint="hexCode, focusNode, valueNode" size="6" class="dojoxColorPickerHexCode" dojoAttachEvent="onchange: _colorInputChange">
</div>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>

View File

@@ -0,0 +1,12 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE>ComboBox General/Keyboard Robot Test</TITLE>
</HEAD>
<BODY>
Loading ComboBox a11y robot test.
<SCRIPT>
window.location.replace("_autoComplete_a11y.html?testWidget=dijit.form.ComboBox"+window.location.search.replace(/^\?/,"&"));
</SCRIPT>
</BODY>
</HTML>

View File

@@ -0,0 +1,12 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE>ComboBox Mouse Robot Test</TITLE>
</HEAD>
<BODY>
Loading ComboBox mouse robot test.
<SCRIPT>
window.location.replace("_autoComplete_mouse.html?testWidget=dijit.form.ComboBox"+window.location.search.replace(/^\?/,"&"));
</SCRIPT>
</BODY>
</HTML>

View File

@@ -0,0 +1,23 @@
<table class="dijit dijitReset dijitInline dijitLeft"
cellspacing='0' cellpadding='0' role="presentation"
><tbody role="presentation"><tr role="presentation"
><td class="dijitReset dijitStretch dijitButtonNode" data-dojo-attach-point="buttonNode" data-dojo-attach-event="ondijitclick:_onClick,onkeypress:_onButtonKeyPress"
><div id="${id}_button" class="dijitReset dijitButtonContents"
data-dojo-attach-point="titleNode"
role="button" aria-labelledby="${id}_label"
><div class="dijitReset dijitInline dijitIcon" data-dojo-attach-point="iconNode" role="presentation"></div
><div class="dijitReset dijitInline dijitButtonText" id="${id}_label" data-dojo-attach-point="containerNode" role="presentation"></div
></div
></td
><td id="${id}_arrow" class='dijitReset dijitRight dijitButtonNode dijitArrowButton'
data-dojo-attach-point="_popupStateNode,focusNode,_buttonNode"
data-dojo-attach-event="onkeypress:_onArrowKeyPress"
title="${optionsTitle}"
role="button" aria-haspopup="true"
><div class="dijitReset dijitArrowButtonInner" role="presentation"></div
><div class="dijitReset dijitArrowButtonChar" role="presentation">&#9660;</div
></td
><td style="display:none !important;"
><input ${!nameAttrSetting} type="${type}" value="${value}" data-dojo-attach-point="valueNode"
/></td></tr></tbody
></table>

1542
master/examples/Command.html Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,669 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<title>ContentPane Remote Loading Test</title>
<style type="text/css">
@import "../../themes/claro/document.css";
@import "../css/dijitTests.css";
</style>
<!-- required: the default dijit theme: -->
<link id="themeStyles" rel="stylesheet" href="../../../dijit/themes/claro/claro.css"/>
<!-- required: dojo.js -->
<script type="text/javascript" src="../../../dojo/dojo.js"
data-dojo-config="isDebug: true, parseOnLoad: false"></script>
<!-- only needed for alternate theme testing: do NOT use in your code! -->
<script type="text/javascript" src="../_testCommon.js"></script>
<!-- functions to help test -->
<script type="text/javascript" src="../helpers.js"></script>
<script type="text/javascript">
dojo.require("doh.runner");
dojo.require("dojo.parser");
dojo.require("dijit._Widget");
dojo.require("dijit._TemplatedMixin");
dojo.require("dijit.Tooltip");
dojo.require("dijit.TooltipDialog");
dojo.require("dijit.form.Button");
dojo.require("dijit.form.DropDownButton");
dojo.require("dijit.layout.ContentPane");
dojo.require("dijit.layout.TabContainer");
dojo.require("dijit.layout.AccordionContainer");
dojo.require("dijit.layout.LinkPane");
var tabCounter;
function testClose(pane, tab){
// remove html from title
var title = dojo.trim(tab.title.replace(/<\/?[a-z][a-z0-9]*[^>]*>/ig, ""));
return confirm("Please confirm that you want tab "+title+" closed");
}
function createTab(){
if(!tabCounter){ tabCounter = 3; }
var title = '<img src="../images/plus.gif" style="background-color:#95B7D3;"/> Tab ' +(++tabCounter);
var refreshOnShow = !!(tabCounter % 2);
var newTab = new dijit.layout.ContentPane({
id: "ttab" + tabCounter,
title: title + (refreshOnShow ? ' <i>refreshOnShow</i>': ''),
closable:true,
refreshOnShow: refreshOnShow,
href: 'getResponse.php?delay=1000&messId='+tabCounter
+"&message="+encodeURI("<h1>Programmatically created Tab "+tabCounter+"</h1>")
}, dojo.doc.createElement('div'));
dijit.byId('ttabs').addChild(newTab);
newTab.startup();
}
function isLoading(domNode){
return domNode.firstChild.innerHTML == "Loading...";
}
dojo.ready(function(){
// create a do nothing, only for test widget
dojo.declare("dijit.TestWidget",
[dijit._Widget, dijit._TemplatedMixin], {
templateString: "<span class='dijitTestWidget'></span>"
});
doh.register("parse", function parse(){
dojo.parser.parse();
});
var cp;
doh.register("ContentPane", [
function create(){
cp = new dijit.layout.ContentPane({}, dojo.byId("cp"));
},
{
name: "setHref_loading",
timeout: 10000,
setUp: function(t){
},
runTest: function(t){
var d = new doh.Deferred();
cp.set('href', 'getResponse.php?messId=1').then(d.getTestCallback(function(){
doh.is(1, dijit._Widget.prototype.getChildren.call(cp).length);
}));
return d;
}
},
{
name: "setHref_then_cancel",
timeout: 2800,
setUp: function(t){
cp.set("content", "");// clear previous
},
runTest: function(t){
var msg = "This should NEVER be seen!";
cp.set('href', 'getResponse.php?delay=1000&message='+encodeURI(msg));
var d = new t.Deferred();
setTimeout(d.getTestCallback(
function(){
doh.f(cp.domNode.innerHTML == msg);
}
), 2500);
cp.cancel();
return d;
}
},
{
// test that setHref cancels a inflight setHref
name: "setHref_cancels_previous_setHref",
timeout: 2800,
setUp: function(t){
cp.set("content", "");
},
runTest: function(t){
var msgCanceled = "This should be canceled";
cp.set('href', "getResponse.php?delay=1000&message="+encodeURI(msgCanceled));
var msg = "This message should win over the previous";
setTimeout(function(){
cp.set('href', "getResponse.php?message="+encodeURI(msg));
}, 900);
var d = new t.Deferred();
setTimeout(d.getTestCallback(
function(){
doh.is(msg, cp.domNode.innerHTML);
}
), 2500);
return d;
}
},
{
name: "setContent_cancels_setHref",
timeout: 2800,
setUp: function(t){
cp.set("content", "");
},
runTest: function(t){
dojo.connect(cp, "onUnload", function(){
console.log("cp unload of: " + cp.get('content'));
});
dojo.connect(cp, "onLoad", function(){
console.log("cp load of: " + cp.get('content'));
});
var msgCanceled = "This message be canceled";
cp.set('href', "getResponse.php?delay=1000&message="+encodeURI(msgCanceled));
var msg = "This message should win over (ie, cancel) the inflight one";
setTimeout(function(){
cp.set("content", msg);
}, 500);
var d = new t.Deferred();
setTimeout(d.getTestCallback(
function(){
doh.is(msg, cp.domNode.innerHTML);
}
), 2500);
return d;
}
},
{
name: "refresh",
timeout: 1900,
setUp: function(t){
cp.set('href', "getResponse.php?message="+encodeURI('initial load'));
},
runTest: function(t){
var d = new doh.Deferred();
setTimeout(d.getTestErrback(function(){
var msg = 'refreshed load';
cp.href = "getResponse.php?message="+encodeURI(msg);
cp.refresh().then(d.getTestCallback(function(){
doh.is(msg, cp.domNode.innerHTML);
}));
}), 100);
return d;
}
},
{
// Test isLoaded attribute lifecycle and that onLoad/onUnload callbacks
// are called at the right times
name: "isLoaded",
timeout: 10000,
setUp: function(t){
cp.set("content", "");
},
runTest: function(t){
doh.t(cp.isLoaded, "cp initially loaded");
// Setup handlers to track when onUnload and onLoad are called,
// including tracking if they get called repeatedly (they shouldn't)
var history = "";
var handles = [
dojo.connect(cp, "onUnload", function(){ history += "unloaded"}),
dojo.connect(cp, "onLoad", function(){ history += " and reloaded"})
];
cp.set('href', "getResponse.php?delay=300&message=test");
doh.f(cp.isLoaded, "immediately after href set, cp isLoaded == false");
doh.is("unloaded", history);
var ilObj = {}; // a object to get a reference instead of copy
// probe after 200ms
setTimeout(function(){
ilObj.probed = cp.isLoaded;
}, 200);
var d = new t.Deferred();
handles.push(dojo.connect(cp, "_setContent", d.getTestCallback(function(){
doh.f(ilObj.probed, "200ms after href set, cp was not loaded");
doh.t(cp.isLoaded, "eventually, cp was loaded");
doh.is("unloaded and reloaded", history);
dojo.forEach(handles, dojo.disconnect);
})));
return d;
}
},
{
// test that we don't load a response if we are hidden
name: "wait_with_load_when_domNode_hidden",
timeout: 1800,
setUp: function(t){
cp.domNode.style.display = 'none';
cp.set("content", "");
},
runTest: function(t){
cp._msg = "This text should not be loaded until after widget is shown";
cp.set('href', "getResponse.php?message="+encodeURI(cp._msg));
var d = new t.Deferred();
setTimeout(d.getTestCallback(
function(){
doh.isNot(cp._msg, cp.domNode.innerHTML);
}
), 1500);
return d;
},
tearDown: function(t){
cp.domNode.style.display = "";
}
},
{
name: "onDownloadError",
timeout: 1800,
setUp: function(t){
cp.set("content", "");
},
runTest: function(t){
var msg = "Error downloading modified message";
orig = cp.onDownloadError;
cp.onDownloadError = function(){
return msg;
};
var d = new doh.Deferred();
evtHandle = dojo.connect(cp, 'onDownloadError', d.getTestErrback(function(e){
doh.t(e, "onDownloadError got event argument on invokation");
setTimeout(d.getTestCallback(function(){
doh.is(msg, cp.domNode.innerHTML, "custom errortext set");
}), 1);
}));
// test onDownloadError
cp.set('href', 'nonexistant');
return d;
},
tearDown: function(){
dojo.disconnect(evtHandle);
cp.onDownloadError = orig;
}
},
// Test that setting an href calls onDownloadStart followed by onDownloadEnd,
// and also setting of custom download message instead of "Loading..."
{
name: "onDownloadStart|End",
timeout: 5000,
setUp:function(t){
cp.set("content", "");
},
runTest:function(t){
var d = new doh.Deferred();
// set custom message
origStart = cp.onDownloadStart;
var msg = "custom downloadstart message";
cp.onDownloadStart = function(){ return msg; };
startHandle = dojo.connect(cp, 'onDownloadStart', d.getTestErrback(function(){
setTimeout(d.getTestErrback(function(){
// check that custom message was set
doh.is(msg, cp.containerNode.innerHTML, "custom download message was set");
// and then wait for the download to complete
endHandle = dojo.connect(cp, 'onDownloadEnd', d.getTestCallback(function(){
// if this gets called (before the test timeout) then test succeeded
}));
}), 1);
}));
cp.set('href', 'getResponse.php?delay=400');
return d;
},
tearDown: function(){
cp.onDownloadStart = origStart;
dojo.disconnect(startHandle);
dojo.disconnect(endHandle);
}
},
// Test that setting an href calls onUnload followed by onLoad
{
name: "onLoad|onUnload",
timeout: 5000,
setUp:function(t){
cp.set("content", "");
},
runTest:function(t){
var d = new doh.Deferred();
loadHandle = dojo.connect(cp, 'onUnload', d.getTestErrback(function(){
unloadHandle = dojo.connect(cp, 'onLoad', d.getTestCallback(function(){
// if this gets called (before the test timeout) then test succeeded
}));
}));
cp.set('href', 'getResponse.php?delay=400');
return d;
},
tearDown: function(){
dojo.disconnect(loadHandle);
dojo.disconnect(unloadHandle);
}
}
]);
function selectChildAndTestLoad(/*String*/ parentId, /*String*/ childId, /*String*/ startOfExpectedContent){
// summary:
// Test deferred load of child of StackContainer widget
var d = new doh.Deferred(),
loadingContent,
child = dijit.byId(childId),
contentNode = dojo.byId(childId);
child.ioMethod = function(args){
loadingContent = innerText(contentNode);
delete child.ioMethod;
return dojo.xhrGet(args);
};
dojo.when(dijit.byId(parentId).selectChild(child), function(){
setTimeout(d.getTestCallback(
function(){
doh.is(child.loadingMessage.replace(/<[^>]*>/g, ""), loadingContent, "loading message");
var startOfActualContent = innerText(contentNode).substring(0, startOfExpectedContent.length);
doh.is(startOfExpectedContent, startOfActualContent, "expected content");
}
), 1); // return from handler, then test
});
return d;
}
var st, // stack container
pane3, pane3UnloadCnt=0, pane3LoadCnt=0, // second child of stack container (initially hidden)
tmp;
doh.register("ContentPane in StackContainer", [
{
// TODO: this test should be moved to registerGroup setUp now that #3504 is fixed
// We actually don't need to test anything here, just setUp
name: "setUp_StackContainer",
setUp:function(t){
// create a StackContainer
st = dojo.byId('stackcontainer');
dojo.addClass(st, 'box');
st = new dijit.layout.StackContainer({style: {height: "150px"}}, st);
// the first child (by default) is the one that will
// be shown
st.addChild(new dijit.TestWidget());
// the second child *won't* be shown until selected
pane3 = new dijit.layout.ContentPane({
id:"sc_pane2",
href:'getResponse.php?delay=300&message=Loaded!',
preventCache: true,
onLoad: function(){ pane3LoadCnt++; },
onUnload: function(){ pane3UnloadCnt++; }
}, dojo.doc.createElement('div'));
st.addChild(pane3);
// start the StackContainer; shouldn't cause ContentPane to load.
st.startup();
},
runTest:function(t){
doh.t(st);
doh.is(2, st.getChildren().length);
}
},
{
name: "preload_false_by_default",
runTest: function(t){
doh.f(pane3.isLoaded);
doh.is('', pane3.domNode.innerHTML);
}
},
{
name: "unload event not called initially",
runTest: function(t){
doh.is(0, pane3UnloadCnt);
}
},
{
name: "load event fired when pane is shown",
timeout: 10000,
runTest: function(t){
doh.is(0, pane3LoadCnt, "onload hasn't been called yet");
var d = new doh.Deferred();
dojo.when(st.selectChild(pane3), function(){
setTimeout(d.getTestCallback(function(){
doh.t(pane3.isLoaded, "pane3.isLoaded");
doh.is(1, pane3LoadCnt, "onload was called");
doh.is('Loaded!', pane3.domNode.innerHTML);
doh.is(0, pane3UnloadCnt,
"unload shouldn't have been called b/c no initial contents (#2)");
}), 1);
});
doh.is(0, pane3UnloadCnt,
"unload shouldn't have been called b/c no initial contents (#1)");
return d;
}
},
{
name: "refreshOnShow parameter works",
timeout: 10000,
setUp: function(t){
tmp = {
onUnload: function(){ this._unload_fired = 1; },
onLoad: function(){ this._load_fired = 1; }
};
tmp.unloadHandle = dojo.connect(pane3, 'onUnload', tmp, 'onUnload');
tmp.loadHandle = dojo.connect(pane3, 'onLoad', tmp, 'onLoad');
pane3.refreshOnShow = true;
},
runTest: function(t){
var d = new doh.Deferred();
// Show pane 3 again and see if events fire
st.back();
st.forward().then(function(){
setTimeout(d.getTestCallback(function(){
doh.t(tmp._unload_fired, "unload was fired");
doh.t(tmp._load_fired, "load was fired");
doh.is('Loaded!', pane3.domNode.innerHTML);
}), 1);
});
return d;
},
tearDown: function(){
dojo.disconnect(tmp.unloadHandle);
dojo.disconnect(tmp.loadHandle);
pane3.refreshOnShow = pane3.constructor.prototype.refreshOnShow;
}
}
]);
doh.register("ContentPane in TabContainer", [
{
name: "tab1InitialLoading",
timeout: 9000,
runTest: function(){ return selectChildAndTestLoad("ttabs", "ttab1", "IT WAS"); }
}
]);
doh.register("ContentPane in AccordionContainer", [
{
name: "pane3InitialLoading",
timeout: 9000,
runTest: function(){ return selectChildAndTestLoad("ac", "ac_pane3", "There"); }
},
{
name: "cpInitialLoading",
timeout: 9000,
runTest: function(){ return selectChildAndTestLoad("ac", "ac_pane2", "There"); }
},
{
name: "pane3Refresh",
timeout: 5000,
runTest: function(t){
var d = new doh.Deferred(),
wasLoading = false,
widget = dijit.byId("ac_pane3"),
loadhandler = widget.connect(widget, "onDownloadStart",
function(){
widget.disconnect(loadhandler);
wasLoading = true;
}
),
showhandler = widget.connect(widget, "_onShow",
function(){
widget.disconnect(showhandler);
setTimeout(d.getTestCallback(
function(){
doh.f(wasLoading, "should not have reloaded")
}
), 1000);
}
);
dijit.byId("ac").selectChild("ac_pane3");
return d;
}
},
{
name: "cpRefresh",
timeout: 9000,
runTest: function(){ return selectChildAndTestLoad("ac", "ac_pane2", "There"); }
}
]);
doh.register("TooltipDialog", [
// The preload=true TooltipDialog should already be loaded, or at least be loading,
// if it isn't already loading then this test will timeout.
{
name: "preload=true",
timeout: 5000,
runTest: function(t){
var dlg = dijit.byId("preloadTooltipDlg");
if(!dlg.isLoaded){
var d = new doh.Deferred();
dlg.onLoadDeferred.then(
function(){ d.callback(true); },
function(e){ d.errback(e); }
);
return d;
}
}
},
// The preload=false TooltipDialog shouldn't load until opened.
{
name: "preload=false",
timeout: 5000,
runTest: function(){
// Check that it isn't loaded yet
var dlg = dijit.byId("noPreloadTooltipDlg");
doh.f(dlg.isLoaded, "didn't load yet");
// Open the dialog and then return Deferred waiting for it to load.
// If it doesn't load then this test will get a timeout.
var btn = dijit.byId("noPreloadTooltipDlgBtn");
btn.openDropDown();
doh.t(dlg.onLoadDeferred, "onLoadDeferred exists");
var d = new doh.Deferred();
dlg.onLoadDeferred.then(
function(){ d.callback(true); },
function(e){ d.errback(e); }
);
return d;
}
}
]);
doh.run();
});
</script>
</head>
<body class="claro">
<h1 class="testTitle">Dijit layout.ContentPane (delayed) remote tests</h1>
<h2>Plain ContentPane</h2>
<div id='cp' class='box'></div>
<h2>StackContainer</h2>
<div id='stackcontainer'></div>
<h2>TabContainer</h2>
<p>These tabs are made up of external content. Loading is delayed to make it easier to see if refreshOnShow and preload = 'false' is working.<br/>
The tabs also tests to insert html in the Tab title
</p>
<div id="createTab" data-dojo-type='dijit.form.Button' data-dojo-props='onClick:function(){ createTab() }'>Create a Tab</div>
<div id="ttabs" data-dojo-type="dijit.layout.TabContainer" data-dojo-props='tabPosition:"top", style:"width: 100%; height: 20em;"'>
<a id="ttab1" data-dojo-type="dijit.layout.LinkPane"
data-dojo-props='href:"getResponse.php?messId=3&amp;delay=1000",
closable:true
'><img src='../images/copy.gif'/> Tab1</a>
<a id="ttab2" data-dojo-type="dijit.layout.LinkPane"
data-dojo-props='href:"getResponse.php?messId=4&amp;delay=1000",
refreshOnShow:true, title:"Tab 2 ",
selected:true,
closable:true
'><i>refreshOnShow</i>
<img src='../images/cut.gif'/>
</a>
<a id="ttab3" data-dojo-type="dijit.layout.LinkPane"
data-dojo-props='href:"getResponse.php?messId=5&amp;delay=1000",
onClose:testClose,
closable:true
'>
<b>Tab 3</b>
<img src='../images/paste.gif'/>
</a>
</div>
<h2>AccordionContainer</h2>
<div data-dojo-type="dijit.layout.AccordionContainer" data-dojo-props='id:"ac", style:"height:300px; width:400px;"'>
<div id="ac_pane1" data-dojo-type="dijit.layout.ContentPane" data-dojo-props='title:"one", refreshOnShow:false, href:"getResponse.php?messId=4&amp;delay=1000"'></div>
<div id="ac_pane2" data-dojo-type="dijit.layout.ContentPane" data-dojo-props='title:"two", refreshOnShow:true, href:"getResponse.php?messId=4&amp;delay=4000"'></div>
<div id="ac_pane3" data-dojo-type="dijit.layout.ContentPane" data-dojo-props='title:"three", refreshOnShow:false, href:"getResponse.php?messId=4&amp;delay=4100"'></div>
</div>
<h2>TooltipDialog</h2>
<div data-dojo-type="dijit.layout.ContentPane">
<div id="preloadTooltipDlgBtn" data-dojo-type="dijit.form.DropDownButton">
<span>Show Preload TooltipDialog</span>
<div id="preloadTooltipDlg" data-dojo-type="dijit.TooltipDialog" data-dojo-props='title:"Enter Login information", preload: true, href: "doc1.html"'>
</div>
</div>
</div>
<div id="noPreloadTooltipDlgBtn" data-dojo-type="dijit.form.DropDownButton">
<span>Show No-Preload TooltipDialog</span>
<div id="noPreloadTooltipDlg" data-dojo-type="dijit.TooltipDialog" data-dojo-props='title:"Enter Login information", preload: false, href: "doc1.html"'>
</div>
</div>
</body>
</html>

View File

@@ -0,0 +1,544 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<title>ContentPane DOH test</title>
<style type="text/css">
@import "../../themes/claro/document.css";
@import "../../themes/claro/claro.css";
@import "../css/dijitTests.css";
.box {
border: 1px solid black;
padding: 8px;
}
.dijitTestWidget {
border: 1px dashed red;
background-color: #C0E209 ;
}
</style>
<script type="text/javascript" src="../../../dojo/dojo.js"
data-dojo-config="isDebug: true"></script>
<script type="text/javascript">
dojo.require("doh.runner");
dojo.require("dojo.parser");
dojo.require("dojo.data.ItemFileReadStore");
dojo.require("dijit._Widget");
dojo.require("dijit._TemplatedMixin");
dojo.require("dijit._WidgetsInTemplateMixin");
dojo.require("dijit._Container");
dojo.require("dijit.layout._LayoutWidget");
dojo.require("dijit.layout.StackContainer");
dojo.require("dijit.layout.ContentPane");
dojo.require("dijit.Dialog");
dojo.ready(function(){
// create a do nothing, only for test widget
dojo.declare("dijit.TestWidget",
[dijit._Widget, dijit._TemplatedMixin], {
templateString: "<span class='dijitTestWidget'></span>"
});
doh.register("pane1",
[
{
name: "no_autoparse",
runTest: function(t){
if(dijit.byId("pane1")){
throw doh._AssertFailure("Page got autoparsed when it shouldn't");
}
}
}
]
);
var pane2, MyWidget;
doh.registerGroup("pane2",
[
{
name: "clear_content",
setUp: function(t){
pane2 = new dijit.layout.ContentPane({
preventCache: true
}, dojo.byId("pane2"));
pane2.set("content", "");// pass undefined on purpose
},
runTest: function(t){
doh.is(0, dijit._Widget.prototype.getChildren.call(pane2).length);
doh.is("", pane2.domNode.innerHTML)
}
},
{
name: "setContent_String",
setUp: function(){
pane2.set("content", "");
},
runTest: function(t){
var msg = "<h3>a simple html string</h3>";
pane2.set("content", msg);
doh.is(msg, pane2.domNode.innerHTML.toLowerCase());
}
},
{
name: "setContent_DOMNode",
setUp: function(t){
var div = dojo.doc.createElement('div');
div.innerHTML = "set('content', [DOMNode] )";
div.setAttribute('data-dojo-type', 'dijit.TestWidget');
pane2.set("content", div);
},
runTest: function(t){
doh.is(1, dijit._Widget.prototype.getChildren.call(pane2).length);
},
tearDown: function(t){
pane2.set("content", ""); // clear content for next test
}
},
{
name: "setContent_NodeList",
setUp: function(t){
var div = dojo.doc.createElement('div');
div.innerHTML = "<div data-dojo-type='dijit.TestWidget'>above</div>"
+"Testing!<div><p><span><b>Deep nested</b></span></p></div>"
+"<div data-dojo-type='dijit.TestWidget'>below</div>";
var list = div.childNodes;
pane2.set("content", div.childNodes);
},
runTest: function(t){
doh.is(2, dijit._Widget.prototype.getChildren.call(pane2).length);
//regular DOM check
var children = pane2.domNode.childNodes;
doh.is(4, children.length);
doh.is("Testing!", children[1].nodeValue);
doh.is("div", children[2].nodeName.toLowerCase());
doh.is("<p><span><b>deep nested</b></span></p>", children[2].innerHTML.toLowerCase());
}
},
{
name: "setContent_dojo_NodeList",
setUp: function(t){
pane2.set("content", "");
},
runTest: function(t){
var div = dojo.doc.createElement('div');
div.innerHTML = "<div data-dojo-type='dijit.TestWidget'>above</div>"
+"Testing!<div><p><span><b>Deep nested</b></span></p></div>"
+"<div data-dojo-type='dijit.TestWidget'>below</div>";
var list = new dojo.NodeList();
dojo.forEach(div.childNodes, function(n){
list.push(n.cloneNode(true));
});
pane2.set("content", list);
doh.is(4, pane2.domNode.childNodes.length);
}
},
{
name: "extractContent",
runTest: function(t){
var def = pane2.extractContent;
doh.f(def);
// test that it's actually working
pane2.extractContent = true;
pane2.set("content", '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" '
+'"http://www.w3.org/TR/html4/strict.dtd">'
+'<html><head><style>body{font-weight:bold;}</style></head>'
+'<body>extractContent test</body></html>');
doh.is("extractContent test", pane2.domNode.innerHTML);
// reset back to default
pane2.extractContent = def;
}
},
{
name: "setContent_widget", // for #12348
setUp: function(t){
// declare a widget whose template contains a non-templated widget
MyWidget = dojo.declare([dijit._Widget, dijit._TemplatedMixin, dijit._WidgetsInTemplateMixin], {
templateString: '<div><div '
+ 'data-dojo-type="dijit.layout.StackContainer"></div></div>'
});
},
runTest: function(t){
var w = new MyWidget(), dfd = new doh.Deferred();
pane2.set("content", w).then(function(){
dfd.callback(true);
}, function(e){
dfd.errback(e);
});
return dfd;
}
}
]
);
// Tests for doLayout parameter.
// When this parameter is true, the single ContentPane child is resized
// to match the size of the ContentPane.
var pane5;
doh.registerGroup("doLayout",
[
{
name: "simple",
setUp: function(t){
pane5 = new dijit.layout.ContentPane({
content:"<div data-dojo-type='dijit.layout.StackContainer'></div>"
}, dojo.byId("pane5"));
console.log(pane5);
},
runTest: function(t){
// since there's just a single child it should be marked
// for layout/resize along w/the ContentPane
doh.t(pane5._singleChild);
},
tearDown: function(t){
pane5.destroyRecursive();
}
},
{
name: "doLayout=false",
setUp: function(t){
pane5 = new dijit.layout.ContentPane({
content:
"<div data-dojo-type='dijit.layout.StackContainer'></div>",
doLayout: false
}, dojo.byId("pane5"));
},
runTest: function(t){
// since doLayout=false shouldn't try to resize child
doh.f(pane5._singleChild);
},
tearDown: function(t){
pane5.destroyRecursive();
}
},
{
name: "mixed content",
setUp: function(t){
pane5 = new dijit.layout.ContentPane({
content:
"<span>hello world</span>" +
"<div data-dojo-type='dijit.layout.StackContainer'></div>"
}, dojo.byId("pane5"));
},
runTest: function(t){
// since there's plain HTML along with the widget, ContentPane shouldn't try to adjust
// this size of the widget (since that would cover up the other HTML)
doh.f(pane5._singleChild);
},
tearDown: function(t){
pane5.destroyRecursive();
}
},
{
name: "two widgets",
setUp: function(t){
pane5 = new dijit.layout.ContentPane({
content:
"<div data-dojo-type='dijit.layout.StackContainer'></div>" +
"<div data-dojo-type='dijit.layout.StackContainer'></div>"
}, dojo.byId("pane5"));
},
runTest: function(t){
// since there are multiple children, neither should be marked
// for layout/resize along w/the ContentPane
doh.f(pane5._singleChild);
},
tearDown: function(t){
pane5.destroyRecursive();
}
},
{
name: "dojo.data",
setUp: function(t){
pane5 = new dijit.layout.ContentPane({
content:
"<div data-dojo-type='dojo.data.ItemFileReadStore' data-dojo-id='dd'></div>" +
"<div data-dojo-type='dijit.layout.StackContainer' id='sc'></div>"
}, dojo.byId("pane5"));
},
runTest: function(t){
// there are two children but one is invisible, so the other should be marked
// for layout/resize along w/the ContentPane
doh.t(dd, "dd exists");
doh.t(dijit.byId("sc"), "sc exists");
doh.is(dijit.byId("sc"), pane5._singleChild, "pane5._singleChild");
},
tearDown: function(t){
pane5.destroyRecursive();
}
},
{
name: "script tags ignored",
setUp: function(t){
pane5 = new dijit.layout.ContentPane({
content:
"<scri" + "pt></scri" + "pt>" +
"<div data-dojo-type='dijit.layout.StackContainer' id='sc'></div>"
}, dojo.byId("pane5"));
},
runTest: function(t){
// script tag should be ignored, should be detected as single child
doh.t(pane5._singleChild, "script tag ignored, marked as single child");
},
tearDown: function(t){
pane5.destroyRecursive();
}
}
]
);
dojo.declare("dijit.TestContained",
dijit.layout._LayoutWidget, {
startup: function(){
this.inherited(arguments);
this._started = true;
},
resize: function(){
this.inherited(arguments);
this._resized = true;
}
}
);
var container;
doh.register("ContentPane as _Container-like widget",
[
{
name: "creation",
runTest: function(t){
container = new dijit.layout.ContentPane();
container.placeAt(dojo.body(), "last");
container.startup();
t.is(0, container.getChildren().length, "number of children before set('content', ...)");
container.set('content',
'<span>plain non-widget content</span>' +
'<div><span>' +
'<div id="zero" data-dojo-type="dijit.TestContained"></div>' +
'<div id="one" data-dojo-type="dijit.TestContained"></div>' +
'</span></div>' +
'<div id="two" data-dojo-type="dijit.TestContained"></div>' +
'<div id="three" data-dojo-type="dijit._Widget"></div>'
);
// Since ContentPane is a container it should call startup
// on it's children
t.t(dijit.byId('two')._started, "started");
// Also, Layout widgets expect resize() to be
// called by their parent
t.t(dijit.byId('two')._resized, "resized");
}
},
{
name: "getChildren",
runTest: function(t){
var children = container.getChildren();
t.is(4, children.length, "number of children");
t.is("zero", children[0].id);
t.is("one", children[1].id);
t.is("two", children[2].id);
t.is("three", children[3].id);
}
},
{
name: "deferred resize",
runTest: function(t){
// This tests that startup isn't called on the child widgets
// until the contentpane is made visible
var hiddenCP = new dijit.layout.ContentPane({style: {display: "none"}});
hiddenCP.placeAt(dojo.body(), "last");
hiddenCP.startup();
t.is(0, hiddenCP.getChildren().length, "number of children before set('content', ...)");
hiddenCP.set('content',
'<span>plain non-widget content</span>' +
'<div><span>' +
'<div id="deferredZero" data-dojo-type="dijit.TestContained"></div>' +
'<div id="deferredOne" data-dojo-type="dijit.TestContained"></div>' +
'</span></div>' +
'<div id="deferredTwo" data-dojo-type="dijit.TestContained"></div>' +
'<div id="deferredThree" data-dojo-type="dijit._Widget"></div>'
);
t.f(dijit.byId('deferredTwo')._resized, "not resized yet");
hiddenCP.set("style", {display: "block"});
hiddenCP._onShow();
t.t(dijit.byId('deferredTwo')._resized, "resized");
}
}
/***
,
{
name: "addChild",
runTest: function(t){
var afterTwo = new dijit.TestContained({id: "twoPointFive"});
container.addChild(afterTwo, 3);
// Make sure child was added and is in order
var children = container.getChildren();
t.is(5, children.length);
t.is("zero", children[0].id);
t.is("one", children[1].id);
t.is("two", children[2].id);
t.is("twoPointFive", children[3].id);
t.is("three", children[4].id);
// Since ContentPane is a container it should call startup
// on it's children
t.t(afterTwo._started, "started");
// Also, Layout widgets expect resize() to be
// called by their parent
t.t(afterTwo._resized, "resized");
}
},
{
name: "removeChild",
runTest: function(t){
var children = container.getChildren();
t.is(5, children.length);
container.removeChild(dijit.byId("zero"));
container.removeChild(1); // should remove "two" - because zero is already removed
children = container.getChildren();
t.is(3, children.length);
t.is("one", children[0].id);
t.is("three", children[2].id);
}
}
****/
]
);
// Test that popup widgets in a ContentPane are created and deleted correctly
doh.register("popup test", [
function create(){
dojo.parser.parse(dojo.byId("popupTest"));
doh.t(dijit.byId("popupPane"), "popup ContentPane created");
doh.t(dijit.byId("dialog"), "dialog created");
doh.is(dojo.body(), dijit.byId("dialog").domNode.parentNode, "dialog child of <body>");
},
function destroy(){
dijit.byId("popupPane").destroyRecursive();
doh.f(dijit.byId("popupPane"), "popup ContentPane destroyed");
doh.f(dijit.byId("dialog"), "dialog widget destroyed");
doh.f(dojo.byId("dialog"), "dialog DOMNode gone too");
}
]);
// Test that startup() on child widgets and plain JS objects is called at the correct time
var nwStartupCalls = 0;
dojo.declare("NonWidget", null, {
// summary: doesn't extend _Widget, used to test that startup() is still called
startup: function(){
if(!this._started){
nwStartupCalls++;
this._started = true;
}
}
});
doh.register("startup", [
function startupAfter(){
var cp1 = new dijit.layout.ContentPane({
content: "<div id='startup-c1' data-dojo-type='dijit.TestContained'></div>"
}).placeAt(dojo.body());
var child = dijit.byId("startup-c1");
doh.t(child, "child widget created");
doh.f(child._started, "child widget not started yet");
cp1.startup();
doh.t(child._started, "starting ContentPane starts child widget");
},
function startupBefore(){
var cp2 = new dijit.layout.ContentPane({}).placeAt(dojo.body());
cp2.startup();
cp2.set("content", "<div id='startup-c2' data-dojo-type='dijit.TestContained'></div>");
var child = dijit.byId("startup-c2");
doh.t(child, "child widget created");
doh.t(child._started, "child widget started");
},
function nonWidget(){
// even non-widgets inside of ContentPane (like dojo.dnd.Source) should have
// startup called on them
dojo.parser.parse(dojo.byId("nonWidgetTest"));
doh.is(1, nwStartupCalls, "startup() on non-widgets called on parse");
nwp.set("content", "<div><div data-dojo-type='NonWidget' data-dojo-id='nw2'></div></div>");
doh.is(2, nwStartupCalls, "startup() called on non-widgets via set(content, ...)");
}
]);
doh.run();
});
</script>
</head>
<body class="claro">
<h2>dijit.layout.ContentPane DOH test</h2>
<h3>Test designed to run on localhost (minimize impact from network latency)</h3>
<h4>This should NOT be parsed automatically</h4>
<div id="pane1" data-dojo-type="dijit.layout.ContentPane" data-dojo-props='"class":"box"'>
<div data-dojo-type='dijit.TestWidget'>If this has a different background and a red border, the page parsed when it shouldn't</div>
</div>
<br/><h3>Testing ContentPane</h3>
<div id='pane2' class='box'>
Even though the entire page isn't scanned for widgets,
any sub widgets of a ContentPane will be created when a ContentPane is created<br/>
<span id="2_zero" data-dojo-type='dijit.TestWidget'>This should have a backgroundcolor and a border</span>
<div id="2_one" data-dojo-type="dijit._Widget"></div>
<div id="2_two" data-dojo-type="dijit._Widget"></div>
<div id="2_three" data-dojo-type="dijit._Widget"></div>
</div>
<br/><br/>
<div id="pane5"></div>
<!-- for container tests -->
<div id="container" data-dojo-type="dijit.layout.ContentPane">
<div id="zero" data-dojo-type="dijit.TestContained"></div>
<div id="one" data-dojo-type="dijit.TestContained"></div>
<div id="two" data-dojo-type="dijit.TestContained"></div>
<div id="three" data-dojo-type="dijit._Widget"></div>
</div>
<div id="outside" data-dojo-type="dijit._Widget"></div>
<div id="outsideCont" data-dojo-type="dijit.TestContained"></div>
<!-- for testing popup widgets inside of a content pane -->
<div id="popupTest">
<div id="popupPane" data-dojo-type="dijit.layout.ContentPane">
<div id="dialog" data-dojo-type="dijit.Dialog">
hello world
</div>
</div>
</div>
<!-- for testing non-widgets inside of a content pane -->
<div id="nonWidgetTest">
<div id="nonWidgetPane" data-dojo-type="dijit.layout.ContentPane" data-dojo-id="nwp">
<div data-dojo-type="NonWidget" data-dojo-id="nw1"></div>
</div>
</div>
</body>
</html>

Some files were not shown because too many files have changed in this diff Show More