Skip to content
Browse files

More natural argument syntax for onChange handler, plus removing unne…

…cessary (non-I18n related) parts from test, refs #11741.
  • Loading branch information...
1 parent 722b16a commit 471f8c69ac5d300b0448cf0d77f707f6ae9b9ab5 @wkeese wkeese committed Dec 27, 2010
Showing with 8 additions and 55 deletions.
  1. +8 −55 tests/i18n/calendar.html
View
63 tests/i18n/calendar.html
@@ -2,19 +2,7 @@
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
- <title>Calendar Widget Test</title>
-
- <!-- for tests -->
- <style type="text/css">
- @import "../../themes/claro/document.css";
- @import "../css/dijitTests.css";
- #calendar5 .dijitCalendarDateTemplate { height: 50px; width: 50px; border: 1px solid #ccc; vertical-align: top }
- #calendar5 .dijitCalendarDateLabel, #calendar5 .dijitCalendarDateTemplate { text-align: inherit }
- #calendar5 .dijitCalendarDayLabel { font-weight: bold }
- #calendar5 .dijitCalendarSelectedYear { font-size: 1.5em }
- #calendar5 .dijitCalendarMonth { font-family: serif; letter-spacing: 0.2em; font-size: 2em }
- .blue { color: blue }
- </style>
+ <title>Calendar I18N Test</title>
<!-- required: a default dijit theme: -->
<link id="themeStyles" rel="stylesheet" href="../../../dijit/themes/claro/claro.css"/>
@@ -34,58 +22,23 @@
dojo.require("dojo.date.locale");
dojo.require("dojo.parser"); // scan page for widgets
- dojo.addOnLoad(function(){
- //Need to declare BigCalendar here in an addOnLoad block so that it works
- //with xdomain loading, where the dojo.require for dijit.Calendar
- //may load asynchronously. This also means we cannot have HTML
- //markup in the body tag for BigCalendar, but instead inject it in this
- //onload handler after BigCalendar is defined.
- dojo.declare("BigCalendar", dijit.Calendar, {
- templateString: dojo.cache("dijit", "tests/_altCalendar.html"),
- isDisabledDate: dojo.date.locale.isWeekend,
- getClassForDate: function(date){
- if(!(date.getDate() % 10)){ return "blue"; } // apply special style to all days divisible by 10
- }
- });
-
- var bigCalendar = dojo.byId("calendar5");
- bigCalendar.setAttribute("data-dojo-type", "BigCalendar");
- dojo.parser.parse(bigCalendar.parentNode);
- });
-
function myHandler(id,newValue){
console.debug("onChange for id = " + id + ", value: " + newValue);
}
</script>
</head>
<body class="claro">
- <h1 class="testTitle">Dijit Calendar Test</h1>
+ <h1 class="testTitle">Dijit Calendar I18N Test</h1>
before
- <input id="calendar1" data-dojo-type="dijit.Calendar" data-dojo-props='onChange:function(){ myHandler(this.id,arguments[0]) }, lang:"en-us"'/>
- <input id="calendar2" data-dojo-type="dijit.Calendar" data-dojo-props='onChange:function(){ myHandler(this.id,arguments[0]) }, lang:"es-es"'/>
- <input id="calendar3" data-dojo-type="dijit.Calendar" data-dojo-props='onChange:function(){ myHandler(this.id,arguments[0]) }, lang:"zh-cn"'/>
- <input id="calendar4" data-dojo-type="dijit.Calendar" data-dojo-props='onChange:function(){ myHandler(this.id,arguments[0]) }, lang:"ar-sy"'/>
+
+ <input id="calendar1" data-dojo-type="dijit.Calendar" data-dojo-props='onChange:function(val){ myHandler(this.id, val); }, lang:"en-us"'/>
+ <input id="calendar2" data-dojo-type="dijit.Calendar" data-dojo-props='onChange:function(val){ myHandler(this.id, val); }, lang:"es-es"'/>
+ <input id="calendar3" data-dojo-type="dijit.Calendar" data-dojo-props='onChange:function(val){ myHandler(this.id, val); }, lang:"zh-cn"'/>
+ <input id="calendar4" data-dojo-type="dijit.Calendar" data-dojo-props='onChange:function(val){ myHandler(this.id, val); }, lang:"ar-sy"'/>
+
after
- <p>
- <a href="#"
- onClick="for(var i=1; i!=5; i++){
- var c = dijit.byId('calendar'+i);
- c.isDisabledDate=dojo.date.locale.isWeekend;
- c._populateGrid();
- }
- ">disable weekends</a>
- </p>
- <p>Customized template with "today" button</p>
- <div>
- <!-- Parent div used so we have a handle to use for dojo.parser.parse after BigCalendar gets defined. -->
- <!-- The input below will be replaced by BigCalendar which is defined in a dojo.addOnLoad block. -->
- <input id="calendar5" data-dojo-props='dayWidth:"abbr", value:"2008-03-15"'/>
- </div>
-<!--
- <input id="calendar5" data-dojo-type="dijit.Calendar" dayWidth="abbr" templatePath="../dijit/tests/_altCalendar.html" value="2008-03-15"/>
- -->
</body>
</html>

0 comments on commit 471f8c6

Please sign in to comment.
Something went wrong with that request. Please try again.