Skip to content

Commit f64a7a4

Browse files
committed
Calendar: Use name space for timestamp data attribute
1 parent 890510c commit f64a7a4

File tree

4 files changed

+13
-9
lines changed

4 files changed

+13
-9
lines changed

tests/unit/calendar/methods.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ test( "value", function( assert ) {
4949
assert.expect( 3 );
5050

5151
this.element.calendar( "value", "1/1/14" );
52-
ok( this.element.find( "button[data-timestamp]:first" )
52+
ok( this.element.find( "button[data-ui-calendar-timestamp]:first" )
5353
.hasClass( "ui-state-active" ),
5454
"first day marked as selected"
5555
);
@@ -67,7 +67,7 @@ test( "valueAsDate", function( assert ) {
6767
date2;
6868

6969
this.element.calendar( "valueAsDate", new Date( 2014, 0, 1 ) );
70-
ok( this.element.find( "button[data-timestamp]:first" )
70+
ok( this.element.find( "button[data-ui-calendar-timestamp]:first" )
7171
.hasClass( "ui-state-active" ),
7272
"First day marked as selected"
7373
);

tests/unit/calendar/options.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ test( "eachDay", function( assert ) {
134134
firstCell = this.widget.find( "td[id]:first" );
135135

136136
equal( firstCell.find( "button" ).length, 1, "days are selectable by default" );
137-
timestamp = parseInt( firstCell.find( "button" ).attr( "data-timestamp" ), 10 );
137+
timestamp = parseInt( firstCell.find( "button" ).attr( "data-ui-calendar-timestamp" ), 10 );
138138
equal( new Date( timestamp ).getDate(), 1, "first available day is the 1st by default" );
139139

140140
// Do not render the 1st of the month
@@ -144,7 +144,7 @@ test( "eachDay", function( assert ) {
144144
}
145145
} );
146146
firstCell = this.widget.find( "td[id]:first" );
147-
timestamp = parseInt( firstCell.find( "button" ).attr( "data-timestamp" ), 10 );
147+
timestamp = parseInt( firstCell.find( "button" ).attr( "data-ui-calendar-timestamp" ), 10 );
148148
equal( new Date( timestamp ).getDate(), 2, "first available day is the 2nd" );
149149

150150
// Display the 1st of the month but make it not selectable.
@@ -319,7 +319,11 @@ test( "value", function( assert ) {
319319

320320
this.element.calendar( "option", "value", date );
321321
assert.dateEqual( this.element.calendar( "option", "value" ), date, "Value set" );
322-
equal( this.widget.find( "table button.ui-state-active" ).data( "timestamp" ), 1463954400000, "Active button timestamp" );
322+
equal(
323+
this.widget.find( "table button.ui-state-active" ).data( "ui-calendar-timestamp" ),
324+
1463954400000,
325+
"Active button timestamp"
326+
);
323327

324328
this.element.calendar( "option", "value", "invalid" );
325329
assert.dateEqual( this.element.calendar( "option", "value" ), date, "Value after invalid parameter" );

tests/unit/datepicker/methods.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ test( "value", function( assert ) {
7575

7676
this.element.datepicker( "open" );
7777
ok(
78-
this.widget.find( "button[data-timestamp]" ).eq( 0 ).hasClass( "ui-state-active" ),
78+
this.widget.find( "button[data-ui-calendar-timestamp]" ).eq( 0 ).hasClass( "ui-state-active" ),
7979
"first day marked as selected"
8080
);
8181
equal( this.element.datepicker( "value" ), "1/1/14", "getter" );
@@ -92,7 +92,7 @@ test( "valueAsDate", function( assert ) {
9292
this.element.datepicker( "valueAsDate", new Date( 2014, 0, 1 ) );
9393
equal( this.element.val(), "1/1/14", "Input's value set" );
9494
ok(
95-
this.widget.find( "button[data-timestamp]" ).eq( 0 ).hasClass( "ui-state-active" ),
95+
this.widget.find( "button[data-ui-calendar-timestamp]" ).eq( 0 ).hasClass( "ui-state-active" ),
9696
"First day marked as selected"
9797
);
9898
assert.dateEqual( this.element.datepicker( "valueAsDate" ), new Date( 2014, 0, 1 ), "Getter" );

ui/widgets/calendar.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ return $.widget( "ui.calendar", {
128128
_select: function( event ) {
129129
var oldValue = this.options.value ? this.options.value.getTime() : "";
130130

131-
this._setOption( "value", new Date( $( event.currentTarget ).data( "timestamp" ) ) );
131+
this._setOption( "value", new Date( $( event.currentTarget ).data( "ui-calendar-timestamp" ) ) );
132132
this._updateDayElement( "ui-state-active" );
133133

134134
// Allow datepicker to handle focus
@@ -489,7 +489,7 @@ return $.widget( "ui.calendar", {
489489

490490
attributes = " class='" + classes.join( " " ) + "'";
491491
if ( selectable ) {
492-
attributes += " tabindex='-1' data-timestamp='" + day.timestamp + "'";
492+
attributes += " tabindex='-1' data-ui-calendar-timestamp='" + day.timestamp + "'";
493493
} else {
494494
attributes += " disabled='disabled'";
495495
}

0 commit comments

Comments
 (0)