From f64a7a4812ca9af126617a4c362a72f03b2c66e5 Mon Sep 17 00:00:00 2001 From: Felix Nagel Date: Wed, 12 Oct 2016 01:31:22 +0200 Subject: [PATCH] Calendar: Use name space for timestamp data attribute --- tests/unit/calendar/methods.js | 4 ++-- tests/unit/calendar/options.js | 10 +++++++--- tests/unit/datepicker/methods.js | 4 ++-- ui/widgets/calendar.js | 4 ++-- 4 files changed, 13 insertions(+), 9 deletions(-) diff --git a/tests/unit/calendar/methods.js b/tests/unit/calendar/methods.js index c66f146b9..c27e80303 100644 --- a/tests/unit/calendar/methods.js +++ b/tests/unit/calendar/methods.js @@ -49,7 +49,7 @@ test( "value", function( assert ) { assert.expect( 3 ); 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" ), "first day marked as selected" ); @@ -67,7 +67,7 @@ test( "valueAsDate", function( assert ) { date2; 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" ), "First day marked as selected" ); diff --git a/tests/unit/calendar/options.js b/tests/unit/calendar/options.js index 3cce60ac7..bd87edb6c 100644 --- a/tests/unit/calendar/options.js +++ b/tests/unit/calendar/options.js @@ -134,7 +134,7 @@ test( "eachDay", function( assert ) { firstCell = this.widget.find( "td[id]:first" ); 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" ); // Do not render the 1st of the month @@ -144,7 +144,7 @@ test( "eachDay", function( assert ) { } } ); 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" ); // 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 ); 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" ); assert.dateEqual( this.element.calendar( "option", "value" ), date, "Value after invalid parameter" ); diff --git a/tests/unit/datepicker/methods.js b/tests/unit/datepicker/methods.js index 2e9b94dad..161af1946 100644 --- a/tests/unit/datepicker/methods.js +++ b/tests/unit/datepicker/methods.js @@ -75,7 +75,7 @@ test( "value", function( assert ) { this.element.datepicker( "open" ); 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" ); 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 ) ); equal( this.element.val(), "1/1/14", "Input's value set" ); 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" ); assert.dateEqual( this.element.datepicker( "valueAsDate" ), new Date( 2014, 0, 1 ), "Getter" ); diff --git a/ui/widgets/calendar.js b/ui/widgets/calendar.js index 71f712166..ba45c1c84 100644 --- a/ui/widgets/calendar.js +++ b/ui/widgets/calendar.js @@ -128,7 +128,7 @@ return $.widget( "ui.calendar", { _select: function( event ) { 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" ); // Allow datepicker to handle focus @@ -489,7 +489,7 @@ return $.widget( "ui.calendar", { attributes = " class='" + classes.join( " " ) + "'"; if ( selectable ) { - attributes += " tabindex='-1' data-timestamp='" + day.timestamp + "'"; + attributes += " tabindex='-1' data-ui-calendar-timestamp='" + day.timestamp + "'"; } else { attributes += " disabled='disabled'"; }