diff options
author | Felix Nagel <info@felixnagel.com> | 2016-10-12 01:23:24 +0200 |
---|---|---|
committer | Felix Nagel <info@felixnagel.com> | 2016-10-12 01:23:24 +0200 |
commit | 890510c0a070fb8ceb55b97c71015ce246e178ab (patch) | |
tree | d2bf1d3fbea1d47e5d07f26e789ebc04706cc31f | |
parent | 96b5a760c42644c4585be1d90ad5c94889833043 (diff) | |
download | jquery-ui-890510c0a070fb8ceb55b97c71015ce246e178ab.tar.gz jquery-ui-890510c0a070fb8ceb55b97c71015ce246e178ab.zip |
Calendar tests: Use assert.expect instead of global expect
-rw-r--r-- | tests/unit/calendar/core.js | 12 | ||||
-rw-r--r-- | tests/unit/calendar/events.js | 8 | ||||
-rw-r--r-- | tests/unit/calendar/methods.js | 16 | ||||
-rw-r--r-- | tests/unit/calendar/options.js | 24 | ||||
-rw-r--r-- | tests/unit/datepicker/core.js | 20 | ||||
-rw-r--r-- | tests/unit/datepicker/events.js | 20 | ||||
-rw-r--r-- | tests/unit/datepicker/methods.js | 24 | ||||
-rw-r--r-- | tests/unit/datepicker/options.js | 24 |
8 files changed, 74 insertions, 74 deletions
diff --git a/tests/unit/calendar/core.js b/tests/unit/calendar/core.js index 5cc78c423..97f8a43b7 100644 --- a/tests/unit/calendar/core.js +++ b/tests/unit/calendar/core.js @@ -14,8 +14,8 @@ module( "calendar: core", { } } ); -test( "base structure", function() { - expect( 28 ); +test( "base structure", function( assert ) { + assert.expect( 28 ); var that = this, buttons, header, title, table, thead, week, child, buttonpane; @@ -90,8 +90,8 @@ test( "base structure", function() { step1(); } ); -test( "Localization", function() { - expect( 10 ); +test( "Localization", function( assert ) { + assert.expect( 10 ); var that = this, date = new Date( 2014, 0, 1 ), @@ -142,7 +142,7 @@ test( "Localization", function() { } ); asyncTest( "keyboard handling", function( assert ) { - expect( 10 ); + assert.expect( 10 ); var that = this; @@ -313,7 +313,7 @@ asyncTest( "keyboard handling", function( assert ) { } ); asyncTest( "mouse", function( assert ) { - expect( 6 ); + assert.expect( 6 ); var that = this, date = new Date(); diff --git a/tests/unit/calendar/events.js b/tests/unit/calendar/events.js index fef9d6bf5..87df2d8e0 100644 --- a/tests/unit/calendar/events.js +++ b/tests/unit/calendar/events.js @@ -10,8 +10,8 @@ module( "calendar: events", { } } ); -test( "change", function() { - expect( 6 ); +test( "change", function( assert ) { + assert.expect( 6 ); var shouldFire, eventType; @@ -46,8 +46,8 @@ test( "change", function() { this.element.find( "tbody button" ).first().simulate( eventType ); } ); -asyncTest( "select", function() { - expect( 6 ); +asyncTest( "select", function( assert ) { + assert.expect( 6 ); var that = this, message, eventType; diff --git a/tests/unit/calendar/methods.js b/tests/unit/calendar/methods.js index 77c2c8ce5..c66f146b9 100644 --- a/tests/unit/calendar/methods.js +++ b/tests/unit/calendar/methods.js @@ -14,7 +14,7 @@ module( "calendar: methods", { } ); test( "destroy", function( assert ) { - expect( 1 ); + assert.expect( 1 ); var div = $( "<div>" ).appendTo( "#qunit-fixture" ); @@ -23,8 +23,8 @@ test( "destroy", function( assert ) { } ); } ); -test( "enable / disable", function() { - expect( 8 ); +test( "enable / disable", function( assert ) { + assert.expect( 8 ); this.element.calendar( "disable" ); ok( this.element.calendar( "option", "disabled" ), "disabled option is set" ); @@ -39,14 +39,14 @@ test( "enable / disable", function() { equal( this.element.attr( "aria-disabled" ), "false", "no longer has ARIA disabled" ); } ); -test( "widget", function() { - expect( 1 ); +test( "widget", function( assert ) { + assert.expect( 1 ); strictEqual( this.widget[ 0 ], this.element[ 0 ] ); } ); -test( "value", function() { - expect( 3 ); +test( "value", function( assert ) { + assert.expect( 3 ); this.element.calendar( "value", "1/1/14" ); ok( this.element.find( "button[data-timestamp]:first" ) @@ -60,7 +60,7 @@ test( "value", function() { } ); test( "valueAsDate", function( assert ) { - expect( 11 ); + assert.expect( 11 ); var minDate, maxDate, dateAndTimeToSet, dateAndTimeClone, date1 = new Date( 2008, 6 - 1, 4 ), diff --git a/tests/unit/calendar/options.js b/tests/unit/calendar/options.js index 9fb49b362..3cce60ac7 100644 --- a/tests/unit/calendar/options.js +++ b/tests/unit/calendar/options.js @@ -13,8 +13,8 @@ module( "calendar: options", { } } ); -test( "buttons", function() { - expect( 21 ); +test( "buttons", function( assert ) { + assert.expect( 21 ); var button, i, newButtons, that = this, @@ -86,8 +86,8 @@ test( "buttons", function() { equal( this.element.hasClass( "ui-calendar-buttons" ), false, "calendar element removes class about having buttons" ); } ); -test( "buttons - advanced", function() { - expect( 7 ); +test( "buttons - advanced", function( assert ) { + assert.expect( 7 ); var that = this, buttons; @@ -115,8 +115,8 @@ test( "buttons - advanced", function() { buttons.click(); } ); -test( "dateFormat", function() { - expect( 2 ); +test( "dateFormat", function( assert ) { + assert.expect( 2 ); this.element.calendar( "value", "1/1/14" ); @@ -127,8 +127,8 @@ test( "dateFormat", function() { equal( this.element.calendar( "value" ), "Wednesday, January 1, 2014", "updated formatting" ); } ); -test( "eachDay", function() { - expect( 5 ); +test( "eachDay", function( assert ) { + assert.expect( 5 ); var timestamp, firstCell = this.widget.find( "td[id]:first" ); @@ -187,7 +187,7 @@ test( "showWeek", function() { } ); test( "min / max", function( assert ) { - expect( 17 ); + assert.expect( 17 ); // With existing date var prevButton = this.widget.find( ".ui-calendar-prev" ), @@ -264,8 +264,8 @@ test( "min / max", function( assert ) { ok( !prevButton.hasClass( "ui-state-disabled" ), "Other year below min: Prev button enabled after click" ); } ); -test( "numberOfMonths", function() { - expect( 6 ); +test( "numberOfMonths", function( assert ) { + assert.expect( 6 ); var date = new Date( 2015, 8 - 1, 1 ); @@ -311,7 +311,7 @@ test( "numberOfMonths", function() { } ); test( "value", function( assert ) { - expect( 4 ); + assert.expect( 4 ); var date = new Date( 2016, 5 - 1, 23 ); diff --git a/tests/unit/datepicker/core.js b/tests/unit/datepicker/core.js index 46f2a1989..88e327b8b 100644 --- a/tests/unit/datepicker/core.js +++ b/tests/unit/datepicker/core.js @@ -13,8 +13,8 @@ module( "datepicker: core", { } } ); -test( "input's value determines starting date", function() { - expect( 3 ); +test( "input's value determines starting date", function( assert ) { + assert.expect( 3 ); this.element = $( "<input>" ).appendTo( "#qunit-fixture" ); this.element.val( "1/1/14" ).datepicker(); @@ -27,8 +27,8 @@ test( "input's value determines starting date", function() { equal( this.widget.find( ".ui-state-active" ).html(), "1", "correct day highlighted" ); } ); -asyncTest( "base structure", function() { - expect( 5 ); +asyncTest( "base structure", function( assert ) { + assert.expect( 5 ); var that = this; @@ -46,8 +46,8 @@ asyncTest( "base structure", function() { }, 50 ); } ); -asyncTest( "Keyboard handling: focus", function() { - expect( 2 ); +asyncTest( "Keyboard handling: focus", function( assert ) { + assert.expect( 2 ); var that = this; @@ -60,8 +60,8 @@ asyncTest( "Keyboard handling: focus", function() { }, 100 ); } ); -asyncTest( "Keyboard handling: keystroke up", function() { - expect( 2 ); +asyncTest( "Keyboard handling: keystroke up", function( assert ) { + assert.expect( 2 ); var that = this; @@ -75,7 +75,7 @@ asyncTest( "Keyboard handling: keystroke up", function() { } ); test( "Keyboard handling: input", function( assert ) { - expect( 6 ); + assert.expect( 6 ); var that = this, instance = that.element.datepicker( "instance" ); @@ -125,7 +125,7 @@ test( "ARIA", function() { } ); asyncTest( "mouse", function( assert ) { - expect( 4 ); + assert.expect( 4 ); var that = this; diff --git a/tests/unit/datepicker/events.js b/tests/unit/datepicker/events.js index 394a94d68..cf1002084 100644 --- a/tests/unit/datepicker/events.js +++ b/tests/unit/datepicker/events.js @@ -13,8 +13,8 @@ module( "datepicker: events", { } } ); -test( "beforeOpen", function() { - expect( 3 ); +test( "beforeOpen", function( assert ) { + assert.expect( 3 ); var that = this; @@ -42,8 +42,8 @@ test( "beforeOpen", function() { .datepicker( "open" ); } ); -test( "change", function() { - expect( 4 ); +test( "change", function( assert ) { + assert.expect( 4 ); var shouldFire; @@ -71,8 +71,8 @@ test( "change", function() { this.widget.find( "tbody button" ).eq( 2 ).simulate( "mousedown" ); } ); -test( "close", function() { - expect( 4 ); +test( "close", function( assert ) { + assert.expect( 4 ); var shouldFire; @@ -103,8 +103,8 @@ test( "close", function() { this.widget.find( "tbody tr:first button:first" ).simulate( "mousedown" ); } ); -test( "open", function() { - expect( 2 ); +test( "open", function( assert ) { + assert.expect( 2 ); var that = this; @@ -118,8 +118,8 @@ test( "open", function() { this.element.datepicker( "open" ); } ); -asyncTest( "select", function() { - expect( 4 ); +asyncTest( "select", function( assert ) { + assert.expect( 4 ); var message = "", that = this; diff --git a/tests/unit/datepicker/methods.js b/tests/unit/datepicker/methods.js index 3ce146861..2e9b94dad 100644 --- a/tests/unit/datepicker/methods.js +++ b/tests/unit/datepicker/methods.js @@ -14,7 +14,7 @@ module( "datepicker: methods", { } ); test( "destroy", function( assert ) { - expect( 3 ); + assert.expect( 3 ); var input = $( "<input>" ).appendTo( "#qunit-fixture" ); @@ -26,8 +26,8 @@ test( "destroy", function( assert ) { } ); } ); -test( "enable / disable", function() { - expect( 10 ); +test( "enable / disable", function( assert ) { + assert.expect( 10 ); this.element.datepicker( "disable" ); ok( this.element.datepicker( "option", "disabled" ), "disabled option is set" ); @@ -44,15 +44,15 @@ test( "enable / disable", function() { equal( this.element.attr( "disabled" ), undefined, "input no longer disabled" ); } ); -test( "widget", function() { - expect( 1 ); +test( "widget", function( assert ) { + assert.expect( 1 ); deepEqual( $( "body > .ui-front" )[ 0 ], this.widget[ 0 ] ); this.widget.remove(); } ); -test( "open / close", function() { - expect( 7 ); +test( "open / close", function( assert ) { + assert.expect( 7 ); ok( this.widget.is( ":hidden" ), "calendar hidden on init" ); @@ -67,8 +67,8 @@ test( "open / close", function() { equal( this.widget.attr( "aria-expanded" ), "false", "close: calendar aria-expanded" ); } ); -test( "value", function() { - expect( 4 ); +test( "value", function( assert ) { + assert.expect( 4 ); this.element.datepicker( "value", "1/1/14" ); equal( this.element.val(), "1/1/14", "input's value set" ); @@ -85,7 +85,7 @@ test( "value", function() { } ); test( "valueAsDate", function( assert ) { - expect( 5 ); + assert.expect( 5 ); strictEqual( this.element.datepicker( "valueAsDate" ), null, "Default" ); @@ -101,8 +101,8 @@ test( "valueAsDate", function( assert ) { equal( this.element.datepicker( "valueAsDate" ), null, "Invalid dates return null" ); } ); -test( "isValid", function() { - expect( 2 ); +test( "isValid", function( assert ) { + assert.expect( 2 ); this.element.val( "1/1/14" ); ok( this.element.datepicker( "isValid" ) ); diff --git a/tests/unit/datepicker/options.js b/tests/unit/datepicker/options.js index e5b142acc..b6e0cb13e 100644 --- a/tests/unit/datepicker/options.js +++ b/tests/unit/datepicker/options.js @@ -13,8 +13,8 @@ module( "datepicker: options", { } } ); -test( "appendTo", function() { - expect( 6 ); +test( "appendTo", function( assert ) { + assert.expect( 6 ); var container = this.widget.parent()[ 0 ], detached = $( "<div>" ); @@ -49,7 +49,7 @@ test( "appendTo", function() { } ); test( "min / max", function( assert ) { - expect( 10 ); + assert.expect( 10 ); var min, max; @@ -87,8 +87,8 @@ test( "min / max", function( assert ) { } ); -test( "Pass-through options", function() { - expect( 11 ); +test( "Pass-through options", function( assert ) { + assert.expect( 11 ); var options = { buttons: { "Test": $.noop }, @@ -124,7 +124,7 @@ test( "Pass-through options", function() { } ); asyncTest( "position", function( assert ) { - expect( 3 ); + assert.expect( 3 ); var input = $( "<input>" ).datepicker().appendTo( "body" ).css( { position: "absolute", @@ -152,8 +152,8 @@ asyncTest( "position", function( assert ) { } ); } ); -test( "Stop datepicker from appearing with beforeOpen event handler - nothing", function() { - expect( 1 ); +test( "Stop datepicker from appearing with beforeOpen event handler - nothing", function( assert ) { + assert.expect( 1 ); this.element.datepicker( { beforeOpen: function() {} @@ -163,8 +163,8 @@ test( "Stop datepicker from appearing with beforeOpen event handler - nothing", ok( this.element.datepicker( "widget" ).is( ":visible" ), "beforeOpen returns nothing" ); } ); -test( "Stop datepicker from appearing with beforeOpen event handler - true", function() { - expect( 1 ); +test( "Stop datepicker from appearing with beforeOpen event handler - true", function( assert ) { + assert.expect( 1 ); this.element.datepicker( { beforeOpen: function() { @@ -175,8 +175,8 @@ test( "Stop datepicker from appearing with beforeOpen event handler - true", fun ok( this.element.datepicker( "widget" ).is( ":visible" ), "beforeOpen returns true" ); } ); -test( "Stop datepicker from appearing with beforeOpen event handler - false", function() { - expect( 1 ); +test( "Stop datepicker from appearing with beforeOpen event handler - false", function( assert ) { + assert.expect( 1 ); this.element.datepicker( { beforeOpen: function() { |