| 1 | <!DOCTYPE html> |
| 2 | <html lang="en"> |
| 3 | <head> |
| 4 | <meta http-equiv="Content-type" content="text/html; charset=utf-8"> |
| 5 | <title>TitlePane Test</title> |
| 6 | |
| 7 | <script type="text/javascript" src="boilerplate.js"></script> |
| 8 | |
| 9 | <script type="text/javascript"> |
| 10 | require([ |
| 11 | "dojo/_base/declare", |
| 12 | "dojo/parser", |
| 13 | "dijit/TitlePane", |
| 14 | |
| 15 | // widgets used inside subpage loaded via href= |
| 16 | "dijit/form/Button", |
| 17 | "dijit/form/ComboBox", |
| 18 | "dijit/layout/TabContainer", |
| 19 | "dijit/layout/AccordionContainer", |
| 20 | "dijit/layout/ContentPane", |
| 21 | |
| 22 | "dojo/domReady!" |
| 23 | ], function(declare, parser, TitlePane){ |
| 24 | |
| 25 | randomMessageId = function(){ |
| 26 | return Math.floor(Math.random() * 3) + 3; |
| 27 | }; |
| 28 | |
| 29 | |
| 30 | declare("TestTitlePane", TitlePane, { |
| 31 | templateString: '<div class="dijitTitlePane">' + |
| 32 | ' <div class="dijitTitlePaneTitle" data-dojo-attach-point="titleBarNode" style="cursor: default;" id="${id}_titleBarNode">' + |
| 33 | '<span data-dojo-attach-event="ondijitclick:toggle,onkeypress: _onTitleKey" tabindex="0"' + |
| 34 | 'role="button" data-dojo-attach-point="focusNode,arrowNode" style="cursor: pointer;">' + |
| 35 | '<img src="${_blankGif}" alt="" class="dijitArrowNode" role="presentation"/>' + |
| 36 | '<span data-dojo-attach-point="arrowNodeInner" class="dijitArrowNodeInner"></span>' + |
| 37 | '</span>' + |
| 38 | '<span data-dojo-attach-point="titleNode" class="dijitTitlePaneTextNode"></span>' + |
| 39 | '</div>' + |
| 40 | '<div class="dijitTitlePaneContentOuter" data-dojo-attach-point="hideNode">' + |
| 41 | '<div class="dijitReset" data-dojo-attach-point="wipeNode">' + |
| 42 | '<div class="dijitTitlePaneContentInner" data-dojo-attach-point="containerNode" id="${id}_pane" aria-labelledby="${id}_titleBarNode" role="region" tabindex="-1">' + |
| 43 | '</div>' + |
| 44 | '</div>' + |
| 45 | '</div>' + |
| 46 | '</div>' |
| 47 | }); |
| 48 | |
| 49 | parser.parse(); |
| 50 | }); |
| 51 | </script> |
| 52 | </head> |
| 53 | <body class="claro" role="main"> |
| 54 | <h1 class="testTitle">Dijit TitlePane Test</h1> |
| 55 | |
| 56 | <label for="input">input:</label><input id="input" value="for tab testing"/> |
| 57 | |
| 58 | <h1>Test #1: plain title pane, width=300px</h1> |
| 59 | <div id="testPane1" data-dojo-id="pane1" data-dojo-type="dijit/TitlePane" data-dojo-props='title:"Title Pane #1", |
| 60 | tooltip:"I\"m the tooltip for Title Pane #1\"s title bar", |
| 61 | style:"width: 300px;" '> |
| 62 | Lorem Ipsum Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Quisque |
| 63 | iaculis, nulla id semper faucibus, pede tellus nonummy magna, vitae adipiscing |
| 64 | orci arcu ut augue. Nunc condimentum, magna a vestibulum convallis, libero purus |
| 65 | pulvinar orci, sed vestibulum urna sem ut pede. More Ipsum... |
| 66 | Sed sollicitudin suscipit risus. Nam ullamcorper. Sed nisl lectus, pellentesque |
| 67 | nec, malesuada eget, ornare a, libero. Lorem ipsum dolor sit amet, |
| 68 | consectetuer adipiscing elit. |
| 69 | </div> |
| 70 | <button id="titleButton" type="button" onclick="pane1.set('title', 'New Title')">change title</button> |
| 71 | <button id="closeButton" type="button" onclick="pane1.set('open', false)">close pane</button> |
| 72 | <h1>Test #2: title pane with form, width=300px</h1> |
| 73 | |
| 74 | <div id="pane_2" data-dojo-type="dijit/TitlePane" data-dojo-props='title:"Title Pane #2", style:"width: 300px;"'> |
| 75 | <form> |
| 76 | <label for="age">Age: </label> <input id="age"/><br> |
| 77 | <input id="disc" type="checkbox"/><label for="disc">Discount card </label><br> |
| 78 | <button>Submit</button><br> |
| 79 | </form> |
| 80 | </div> |
| 81 | <br> |
| 82 | |
| 83 | <h1>Test #3: initially closed pane</h1> |
| 84 | <div id="closed" data-dojo-type="dijit/TitlePane" data-dojo-props='title:"Initially closed pane", open:false, style:"width:500px;"'> |
| 85 | <form> |
| 86 | <label for="age2">Age: </label><input id="age2"/><br> |
| 87 | <label for="discount">Discount card </label><input type="checkbox" id="discount"/><br> |
| 88 | <button>Submit</button><br> |
| 89 | </form> |
| 90 | |
| 91 | <p>And a TabContainer, to make sure it lays out correctly:</p> |
| 92 | <div id="tabContainer" data-dojo-type="dijit/layout/TabContainer" data-dojo-props='style:"width: 400px; height: 250px;"'> |
| 93 | <div data-dojo-type="dijit/layout/ContentPane" data-dojo-props='href:"layout/tab1.html", onLoad:function(){ console.log("load of SubTab 1"); }' title="SubTab 1"></div> |
| 94 | <div data-dojo-type="dijit/layout/ContentPane" data-dojo-props='href:"layout/tab2.html", onLoad:function(){ console.log("load of SubTab 2"); }, selected:true' title="SubTab 2"></div> |
| 95 | </div> |
| 96 | </div> |
| 97 | <button type="button" onclick="dijit.byId('closed').set('content', 'hello world! (' + new Date() + ')');">reset content</button> |
| 98 | |
| 99 | <h1>Test #4: title pane with href (initially closed)</h1> |
| 100 | <p>The pane should open to "Loading..." message and then 3 seconds later it should slide open more to show loaded data.</p> |
| 101 | <div id="href1" data-dojo-type="dijit/TitlePane" data-dojo-props='duration:1000, title:"Pane from href", open:false, |
| 102 | href:"layout/getResponse.php?delay=3000&messId=3", preventCache:true, |
| 103 | style:"width: 400px;"'> |
| 104 | Loading... |
| 105 | </div> |
| 106 | |
| 107 | <h1>Test #5: title pane with href (initially closed)</h1> |
| 108 | <p>The pane should start to open to "Loading..." but halfway through href data will be loaded, and it should expand correctly.</p> |
| 109 | <div id="href2" data-dojo-type="dijit/TitlePane" data-dojo-props='duration:1000, title:"Pane from href", open:false, |
| 110 | href:"layout/getResponse.php?delay=500&messId=3", preventCache:true, |
| 111 | style:"width: 400px;"'> |
| 112 | Loading... |
| 113 | </div> |
| 114 | |
| 115 | <h1>Test #6: nested title pane</h1> |
| 116 | <div id="outer" data-dojo-type="dijit/TitlePane" data-dojo-props='title:"Outer pane", style:"width:300px;"'> |
| 117 | <p>This is a title pane, containing another title pane ... |
| 118 | <p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Quisque iaculis, nulla id semper faucibus, pede tellus nonummy magna, vitae adipiscing orci arcu ut augue. Nunc condimentum, magna a vestibulum convallis, libero purus pulvinar orci, sed vestibulum urna sem ut pede. |
| 119 | More Ipsum... |
| 120 | |
| 121 | <div id="inner" data-dojo-type="dijit/TitlePane" data-dojo-props='title:"Inner pane", style:"width:250px;"'> |
| 122 | <p>And this is the inner title pane... |
| 123 | <p>Sed sollicitudin suscipit risus. Nam ullamcorper. Sed nisl lectus, pellentesque nec, malesuada eget, ornare a, libero. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. |
| 124 | </div> |
| 125 | |
| 126 | <p>And this is the closing line for the outer title pane. |
| 127 | </div> |
| 128 | |
| 129 | <h1>Test #7: subclassed title pane (only arrow is selectable and focusable)</h1> |
| 130 | <div id="ttp" data-dojo-type="TestTitlePane" data-dojo-props='title:"Title Pane #7", style:"width: 300px;" '> |
| 131 | Lorem Ipsum Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Quisque |
| 132 | iaculis, nulla id semper faucibus, pede tellus nonummy magna, vitae adipiscing |
| 133 | orci arcu ut augue. Nunc condimentum, magna a vestibulum convallis, libero purus |
| 134 | pulvinar orci, sed vestibulum urna sem ut pede. More Ipsum... |
| 135 | Sed sollicitudin suscipit risus. Nam ullamcorper. Sed nisl lectus, pellentesque |
| 136 | nec, malesuada eget, ornare a, libero. Lorem ipsum dolor sit amet, |
| 137 | consectetuer adipiscing elit. |
| 138 | </div> |
| 139 | |
| 140 | <table style="border: solid blue 2px; margin-top: 1em;"> |
| 141 | <tr> |
| 142 | <td> |
| 143 | Here's some text below the title panes (to make sure that closing a title pane releases the space that the content was taking up) |
| 144 | </td> |
| 145 | </tr> |
| 146 | </table> |
| 147 | <h1>Test #8: locked open title pane</h1> |
| 148 | <div id="locked" data-dojo-type="dijit/TitlePane" data-dojo-props='title:"Title Pane #8", style:"width: 300px;", toggleable:false '> |
| 149 | Lorem Ipsum Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Quisque |
| 150 | iaculis, nulla id semper faucibus, pede tellus nonummy magna, vitae adipiscing |
| 151 | orci arcu ut augue. Nunc condimentum, magna a vestibulum convallis, libero purus |
| 152 | pulvinar orci, sed vestibulum urna sem ut pede. More Ipsum... |
| 153 | Sed sollicitudin suscipit risus. Nam ullamcorper. Sed nisl lectus, pellentesque |
| 154 | nec, malesuada eget, ornare a, libero. Lorem ipsum dolor sit amet, |
| 155 | consectetuer adipiscing elit. |
| 156 | </div> |
| 157 | |
| 158 | <h1>Test #9: TitlePane in AccordionContainer</h1> |
| 159 | <div id="ac" data-dojo-type="dijit/layout/AccordionContainer" data-dojo-props='style:"width: 400px; height: 300px;" '> |
| 160 | <div id="accp1" data-dojo-type="dijit/layout/ContentPane" data-dojo-props='title:"pane 1", selected:true'> |
| 161 | Here's a closed title pane: |
| 162 | <div id="actp1" data-dojo-type="dijit/TitlePane" data-dojo-props='title:"Title Pane #9", style:"width: 300px;", open:false, |
| 163 | href:"layout/tab1.html", onLoad:function(){ console.log("load of actp1"); actp1Loaded = true; }'> |
| 164 | </div> |
| 165 | and an open one: |
| 166 | <div id="actp2" data-dojo-type="dijit/TitlePane" data-dojo-props='title:"Title Pane #10", style:"width: 300px;", open:true, |
| 167 | href:"layout/tab2.html", onLoad:function(){ console.log("load of actp2"); actp2Loaded = true; }'> |
| 168 | </div> |
| 169 | </div> |
| 170 | <div id="accp2" data-dojo-type="dijit/layout/ContentPane" data-dojo-props='title:"pane 2" '> |
| 171 | Here's a closed title pane: |
| 172 | <div id="actp3" data-dojo-type="dijit/TitlePane" data-dojo-props='title:"Title Pane #11", style:"width: 300px;", open:false, |
| 173 | href:"layout/tab1.html", onLoad:function(){ console.log("load of actp3"); actp3Loaded = true; }'> |
| 174 | </div> |
| 175 | and an open one: |
| 176 | <div id="actp4" data-dojo-type="dijit/TitlePane" data-dojo-props='title:"Title Pane #12", style:"width: 300px;", open:true, |
| 177 | href:"layout/tab2.html", onLoad:function(){ console.log("load of actp4"); actp4Loaded = true; }'> |
| 178 | </div> |
| 179 | </div> |
| 180 | <div id="accp3" data-dojo-type="dijit/layout/ContentPane" data-dojo-props='title:"pane 3 (single child)" '> |
| 181 | <div id="actp5" data-dojo-type="dijit/TitlePane" data-dojo-props='title:"Title Pane #13"'> |
| 182 | hello world, my height should match this text, not the height of the containing ContentPane |
| 183 | </div> |
| 184 | </div> |
| 185 | </div> |
| 186 | |
| 187 | </body> |
| 188 | </html> |