Permalink
Browse files

Merge branch 'master' of http://github.com/vapir/calendar_date_select

…into vapir-master
  • Loading branch information...
2 parents cd030e2 + c1f836a commit e402dc0760c054c594a8d8d63d813b97c834eb53 @sglee77 sglee77 committed Dec 19, 2010
@@ -21,6 +21,7 @@
<div id="cds_test_div">
<input type="text" id="cds_test" />
</div>
+<div id="cds_status"></div>
<!-- Tests -->
<script type="text/javascript" language="javascript">
@@ -357,6 +358,16 @@
assertEqual(1, $$(".calendar_date_select").length);
cds.close();
+ }},
+ test__dynamic_onchange_should_be_fired: function() {with (this) {
+ Event.observe($('cds_test'), 'change', function()
+ { $('cds_status').innerHTML='calendar input changed';
+ });
+ cds = new CalendarDateSelect($("cds_test"), {time: "mixed"});
+ today_now = $$(".cds_buttons a[href=#]");
+ today_now[0].onclick();
+ assertMatch('calendar input changed', $('cds_status').innerHTML, "status div should indicate date changed");
+ cds.close();
}}
});
// ]]>
@@ -88,7 +88,20 @@ CalendarDateSelect.prototype = {
minute_interval: 5,
popup_by: this.target_element,
month_year: "dropdowns",
- onchange: this.target_element.onchange,
+ onchange: function(target_element)
+ { return function()
+ { if(target_element.dispatchEvent)
+ { var event=document.createEvent('HTMLEvents');
+ event.initEvent('change', true, true);
+ target_element.dispatchEvent(event);
+ }
+ else
+ { var event=document.createEventObject();
+ event.type='onChange';
+ target_element.fireEvent('onChange', event);
+ }
+ };
+ }(this.target_element),
valid_date_check: nil
}).merge(options || {});
this.use_time = this.options.get("time");

0 comments on commit e402dc0

Please sign in to comment.