mirror of
https://github.com/jquery/jquery-ui.git
synced 2025-01-07 20:34:24 +00:00
Calendar: Use name space for timestamp data attribute
This commit is contained in:
parent
890510c0a0
commit
f64a7a4812
@ -49,7 +49,7 @@ test( "value", function( assert ) {
|
|||||||
assert.expect( 3 );
|
assert.expect( 3 );
|
||||||
|
|
||||||
this.element.calendar( "value", "1/1/14" );
|
this.element.calendar( "value", "1/1/14" );
|
||||||
ok( this.element.find( "button[data-timestamp]:first" )
|
ok( this.element.find( "button[data-ui-calendar-timestamp]:first" )
|
||||||
.hasClass( "ui-state-active" ),
|
.hasClass( "ui-state-active" ),
|
||||||
"first day marked as selected"
|
"first day marked as selected"
|
||||||
);
|
);
|
||||||
@ -67,7 +67,7 @@ test( "valueAsDate", function( assert ) {
|
|||||||
date2;
|
date2;
|
||||||
|
|
||||||
this.element.calendar( "valueAsDate", new Date( 2014, 0, 1 ) );
|
this.element.calendar( "valueAsDate", new Date( 2014, 0, 1 ) );
|
||||||
ok( this.element.find( "button[data-timestamp]:first" )
|
ok( this.element.find( "button[data-ui-calendar-timestamp]:first" )
|
||||||
.hasClass( "ui-state-active" ),
|
.hasClass( "ui-state-active" ),
|
||||||
"First day marked as selected"
|
"First day marked as selected"
|
||||||
);
|
);
|
||||||
|
@ -134,7 +134,7 @@ test( "eachDay", function( assert ) {
|
|||||||
firstCell = this.widget.find( "td[id]:first" );
|
firstCell = this.widget.find( "td[id]:first" );
|
||||||
|
|
||||||
equal( firstCell.find( "button" ).length, 1, "days are selectable by default" );
|
equal( firstCell.find( "button" ).length, 1, "days are selectable by default" );
|
||||||
timestamp = parseInt( firstCell.find( "button" ).attr( "data-timestamp" ), 10 );
|
timestamp = parseInt( firstCell.find( "button" ).attr( "data-ui-calendar-timestamp" ), 10 );
|
||||||
equal( new Date( timestamp ).getDate(), 1, "first available day is the 1st by default" );
|
equal( new Date( timestamp ).getDate(), 1, "first available day is the 1st by default" );
|
||||||
|
|
||||||
// Do not render the 1st of the month
|
// Do not render the 1st of the month
|
||||||
@ -144,7 +144,7 @@ test( "eachDay", function( assert ) {
|
|||||||
}
|
}
|
||||||
} );
|
} );
|
||||||
firstCell = this.widget.find( "td[id]:first" );
|
firstCell = this.widget.find( "td[id]:first" );
|
||||||
timestamp = parseInt( firstCell.find( "button" ).attr( "data-timestamp" ), 10 );
|
timestamp = parseInt( firstCell.find( "button" ).attr( "data-ui-calendar-timestamp" ), 10 );
|
||||||
equal( new Date( timestamp ).getDate(), 2, "first available day is the 2nd" );
|
equal( new Date( timestamp ).getDate(), 2, "first available day is the 2nd" );
|
||||||
|
|
||||||
// Display the 1st of the month but make it not selectable.
|
// Display the 1st of the month but make it not selectable.
|
||||||
@ -319,7 +319,11 @@ test( "value", function( assert ) {
|
|||||||
|
|
||||||
this.element.calendar( "option", "value", date );
|
this.element.calendar( "option", "value", date );
|
||||||
assert.dateEqual( this.element.calendar( "option", "value" ), date, "Value set" );
|
assert.dateEqual( this.element.calendar( "option", "value" ), date, "Value set" );
|
||||||
equal( this.widget.find( "table button.ui-state-active" ).data( "timestamp" ), 1463954400000, "Active button timestamp" );
|
equal(
|
||||||
|
this.widget.find( "table button.ui-state-active" ).data( "ui-calendar-timestamp" ),
|
||||||
|
1463954400000,
|
||||||
|
"Active button timestamp"
|
||||||
|
);
|
||||||
|
|
||||||
this.element.calendar( "option", "value", "invalid" );
|
this.element.calendar( "option", "value", "invalid" );
|
||||||
assert.dateEqual( this.element.calendar( "option", "value" ), date, "Value after invalid parameter" );
|
assert.dateEqual( this.element.calendar( "option", "value" ), date, "Value after invalid parameter" );
|
||||||
|
@ -75,7 +75,7 @@ test( "value", function( assert ) {
|
|||||||
|
|
||||||
this.element.datepicker( "open" );
|
this.element.datepicker( "open" );
|
||||||
ok(
|
ok(
|
||||||
this.widget.find( "button[data-timestamp]" ).eq( 0 ).hasClass( "ui-state-active" ),
|
this.widget.find( "button[data-ui-calendar-timestamp]" ).eq( 0 ).hasClass( "ui-state-active" ),
|
||||||
"first day marked as selected"
|
"first day marked as selected"
|
||||||
);
|
);
|
||||||
equal( this.element.datepicker( "value" ), "1/1/14", "getter" );
|
equal( this.element.datepicker( "value" ), "1/1/14", "getter" );
|
||||||
@ -92,7 +92,7 @@ test( "valueAsDate", function( assert ) {
|
|||||||
this.element.datepicker( "valueAsDate", new Date( 2014, 0, 1 ) );
|
this.element.datepicker( "valueAsDate", new Date( 2014, 0, 1 ) );
|
||||||
equal( this.element.val(), "1/1/14", "Input's value set" );
|
equal( this.element.val(), "1/1/14", "Input's value set" );
|
||||||
ok(
|
ok(
|
||||||
this.widget.find( "button[data-timestamp]" ).eq( 0 ).hasClass( "ui-state-active" ),
|
this.widget.find( "button[data-ui-calendar-timestamp]" ).eq( 0 ).hasClass( "ui-state-active" ),
|
||||||
"First day marked as selected"
|
"First day marked as selected"
|
||||||
);
|
);
|
||||||
assert.dateEqual( this.element.datepicker( "valueAsDate" ), new Date( 2014, 0, 1 ), "Getter" );
|
assert.dateEqual( this.element.datepicker( "valueAsDate" ), new Date( 2014, 0, 1 ), "Getter" );
|
||||||
|
@ -128,7 +128,7 @@ return $.widget( "ui.calendar", {
|
|||||||
_select: function( event ) {
|
_select: function( event ) {
|
||||||
var oldValue = this.options.value ? this.options.value.getTime() : "";
|
var oldValue = this.options.value ? this.options.value.getTime() : "";
|
||||||
|
|
||||||
this._setOption( "value", new Date( $( event.currentTarget ).data( "timestamp" ) ) );
|
this._setOption( "value", new Date( $( event.currentTarget ).data( "ui-calendar-timestamp" ) ) );
|
||||||
this._updateDayElement( "ui-state-active" );
|
this._updateDayElement( "ui-state-active" );
|
||||||
|
|
||||||
// Allow datepicker to handle focus
|
// Allow datepicker to handle focus
|
||||||
@ -489,7 +489,7 @@ return $.widget( "ui.calendar", {
|
|||||||
|
|
||||||
attributes = " class='" + classes.join( " " ) + "'";
|
attributes = " class='" + classes.join( " " ) + "'";
|
||||||
if ( selectable ) {
|
if ( selectable ) {
|
||||||
attributes += " tabindex='-1' data-timestamp='" + day.timestamp + "'";
|
attributes += " tabindex='-1' data-ui-calendar-timestamp='" + day.timestamp + "'";
|
||||||
} else {
|
} else {
|
||||||
attributes += " disabled='disabled'";
|
attributes += " disabled='disabled'";
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user