| 1 | <!DOCTYPE html> |
| 2 | <html lang="en"> |
| 3 | <head> |
| 4 | <meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,minimum-scale=1,user-scalable=no"/> |
| 5 | <meta http-equiv="Content-type" content="text/html; charset=utf-8"> |
| 6 | <title>Button non-robot tests</title> |
| 7 | |
| 8 | <style type="text/css"> |
| 9 | @import "../../themes/claro/document.css"; |
| 10 | @import "../../themes/dijit.css"; |
| 11 | </style> |
| 12 | <link id="themeStyles" rel="stylesheet" href="../../../dijit/themes/claro/claro.css"/> |
| 13 | |
| 14 | <script type="text/javascript" src="../../../dojo/dojo.js" |
| 15 | data-dojo-config=" async: true, isDebug: true"></script> |
| 16 | |
| 17 | <script type="text/javascript"> |
| 18 | require([ |
| 19 | "doh/runner", |
| 20 | "dojo/_base/declare", |
| 21 | "dojo/dom", |
| 22 | "dijit/_WidgetBase", |
| 23 | "dijit/_TemplatedMixin", |
| 24 | "dijit/_WidgetsInTemplateMixin", |
| 25 | "dijit/form/Button", |
| 26 | "dojo/domReady!" |
| 27 | ],function(doh, declare, dom, _WidgetBase, _TemplatedMixin, _WidgetsInTemplateMixin, Button){ |
| 28 | doh.register("title", function(){ |
| 29 | // This button has a title specified explicitly. It should not be overridden. |
| 30 | var b1 = new Button({ |
| 31 | label: "my label", |
| 32 | title: "my title", |
| 33 | showLabel: false |
| 34 | }); |
| 35 | b1.placeAt(document.body); |
| 36 | doh.is("my title", b1.titleNode.title); |
| 37 | |
| 38 | // This button's title should be set from its label. |
| 39 | var b2 = new Button({ |
| 40 | label: "my label", |
| 41 | showLabel: false |
| 42 | }); |
| 43 | b2.placeAt(document.body); |
| 44 | doh.is("my label", b2.titleNode.title); |
| 45 | }); |
| 46 | |
| 47 | doh.register("buttons in templates", function(){ |
| 48 | var Test1Widget = declare('Test1Widget', [_WidgetBase, _TemplatedMixin, _WidgetsInTemplateMixin], { |
| 49 | templateString: |
| 50 | '<div>\ |
| 51 | <div data-dojo-type="dijit/form/Button">\ |
| 52 | <div>\ |
| 53 | <h3 data-dojo-attach-point="titleNode"></h3>\ |
| 54 | <span>Something else</span>\ |
| 55 | </div>\ |
| 56 | <span>Something else</span>\ |
| 57 | </div>\ |
| 58 | </div>' |
| 59 | }); |
| 60 | |
| 61 | var myWidget = new Test1Widget(); |
| 62 | doh.t(dom.isDescendant(myWidget.titleNode, myWidget.domNode), "titleNode inside domNode"); |
| 63 | }); |
| 64 | |
| 65 | // ARIA tests. See also Button_a11y.html. |
| 66 | doh.register("aria", function(){ |
| 67 | var b1 = new Button({ |
| 68 | label: "disabled", |
| 69 | disabled: true |
| 70 | }); |
| 71 | b1.placeAt(document.body); |
| 72 | doh.is("true", b1.focusNode.getAttribute("aria-disabled"), "aria-disabled"); |
| 73 | doh.f(b1.focusNode.disabled, "disabled not set since it's a <span>") |
| 74 | }); |
| 75 | |
| 76 | doh.run(); |
| 77 | }); |
| 78 | </script> |
| 79 | </head> |
| 80 | <body class="claro" role="main"> |
| 81 | <h1 class="testTitle">Button non-robot tests</h1> |
| 82 | </body> |
| 83 | </html> |