| 1 | <!DOCTYPE html> |
| 2 | <html lang="en"> |
| 3 | <head> |
| 4 | <meta http-equiv="Content-type" content="text/html; charset=utf-8"> |
| 5 | <title>CalendarLite Widget Test</title> |
| 6 | |
| 7 | <script src="boilerplate.js"></script> |
| 8 | |
| 9 | <script type="text/javascript"> |
| 10 | require(["doh/runner", "dojo/date/stamp", "dojo/dom", "dijit/CalendarLite", "dojo/query", "dojo/domReady!"], |
| 11 | function(doh, stamp, dom, CalendarLite, query){ |
| 12 | |
| 13 | doh.register("CalendarLite", [ |
| 14 | function create(){ |
| 15 | cal = new CalendarLite({ |
| 16 | id: "cal", |
| 17 | value: "1999-12-31", |
| 18 | onChange: function myHandler(id,newValue){ |
| 19 | console.debug("onChange for id = " + id + ", value: " + newValue); |
| 20 | } |
| 21 | }, dom.byId("calendar1")); |
| 22 | |
| 23 | doh.is("1999-12-31", stamp.toISOString(cal.get("value"), {selector: "date"}), "value"); |
| 24 | doh.is("December", cal.gridNode.getAttribute("summary")); |
| 25 | }, |
| 26 | |
| 27 | function change(){ |
| 28 | cal.set("value", "2000-11-30"); |
| 29 | doh.is("2000-11-30", stamp.toISOString(cal.get("value"), {selector: "date"}), "value"); |
| 30 | doh.is("November", cal.gridNode.getAttribute("summary")); |
| 31 | |
| 32 | //Verify default dayOffset is for locale. |
| 33 | doh.is(-1, cal.get('dayOffset'), "CalendarLite should default to -1 if no value specified"); |
| 34 | }, |
| 35 | |
| 36 | function createWithSummary(){ |
| 37 | cal2 = new CalendarLite({ |
| 38 | id: "cal2", |
| 39 | value: "1999-12-31", |
| 40 | summary: "explicit summary" |
| 41 | }, dom.byId("calendar2")); |
| 42 | |
| 43 | doh.is("explicit summary", cal2.gridNode.getAttribute("summary")); |
| 44 | }, |
| 45 | |
| 46 | function createWithFirstDayOfWeek(){ |
| 47 | cal3 = new CalendarLite({ |
| 48 | id: "cal3", |
| 49 | value: "1999-12-31", |
| 50 | dayOffset: 3 |
| 51 | }, dom.byId("calendar3")); |
| 52 | |
| 53 | var firstCol = query('thead tr[role="row"] > *', cal3.domNode); |
| 54 | doh.is("W", firstCol[0].textContent || firstCol[0].innerText , |
| 55 | "W should be first column heading with offset of 3"); |
| 56 | } |
| 57 | |
| 58 | ]); |
| 59 | doh.run(); |
| 60 | }); |
| 61 | </script> |
| 62 | </head> |
| 63 | <body role="main"> |
| 64 | |
| 65 | <h1 class="testTitle">Dijit CalendarLite Test</h1> |
| 66 | |
| 67 | <label for="before">before:</label><input value="input" id="before"/> |
| 68 | <input id="calendar1"/> |
| 69 | <label for="after">between:</label><input value="input" id="between"/> |
| 70 | <input id="calendar2"/> |
| 71 | <label for="after">after:</label><input value="input" id="after"/> |
| 72 | <input id="calendar3"/> |
| 73 | </body> |
| 74 | </html> |