tests for datetimefield

This commit is contained in:
vitalets 2013-04-02 13:36:18 +04:00
parent b0684d0174
commit 2778630c7b
5 changed files with 17 additions and 7 deletions

@ -195,6 +195,11 @@
type = 'combodate';
}
}
//`datetime` should be datetimefield in 'inline' mode
if(type === 'datetime' && options.mode === 'inline') {
type = 'datetimefield';
}
//change wysihtml5 to textarea for jquery UI and plain versions
if(type === 'wysihtml5' && !$.fn.editabletypes[type]) {

@ -80,7 +80,11 @@ $(function(){
value2html: function(value, element) {
//formatDate works with UTCDate!
var text = value ? this.dpg.formatDate(this.toUTC(value), this.parsedViewFormat, this.options.datetimepicker.language, this.options.formatType) : '';
DateTime.superclass.value2html(text, element);
if(element) {
DateTime.superclass.value2html(text, element);
} else {
return text;
}
},
html2value: function(html) {

@ -34,10 +34,10 @@ Automatically shown in inline mode.
}, this));
},
value2input: function(value) {
this.$input.val(value ? this.dpg.formatDate(value, this.parsedViewFormat, this.options.datepicker.language) : '');
this.$tpl.datepicker('update');
this.$input.val(this.value2html(value));
this.$tpl.datetimepicker('update');
},
input2value: function() {
@ -62,7 +62,7 @@ Automatically shown in inline mode.
@property inputclass
@default 'input-small'
**/
inputclass: 'input-small',
inputclass: 'input-medium',
/* datetimepicker config */
datetimepicker:{

@ -38,6 +38,7 @@ require(["loader", jqurl], function(loader) {
case 'bootstrap':
custom = ['test/unit/datefield',
'test/unit/date',
'test/unit/datetimefield',
'test/unit/datetime',
'test/unit/wysihtml5',
'test/unit/typeahead'

@ -50,8 +50,8 @@ $(function () {
equal(p.find('input').val(), d, 'date set correct');
//open picker
p.find('span').click();
var picker = p.find('span').parent().data().datepicker.picker;
p.find('span.add-on').click();
var picker = p.find('span.add-on').parent().data().datepicker.picker;
ok(picker.is(':visible'), 'picker shown');
ok(picker.find('td.day.active').is(':visible'), 'active day is visible');