diff options
author | Michał Gołębiowski-Owczarek <m.goleb@gmail.com> | 2021-06-07 00:58:12 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-06-07 00:58:12 +0200 |
commit | 70dae67b73dfea9126f126f516fe8286f1e73417 (patch) | |
tree | e61eafab41ee74330fecf1da2ce125050cfac49b /tests/unit/datepicker | |
parent | a12c98574d07f002fd59d166f9fc1fd391581b91 (diff) | |
download | jquery-ui-70dae67b73dfea9126f126f516fe8286f1e73417.tar.gz jquery-ui-70dae67b73dfea9126f126f516fe8286f1e73417.zip |
Build: Migrate from JSHint & JSCS to ESLint
Fixes #15393
Closes gh-1958
Diffstat (limited to 'tests/unit/datepicker')
-rw-r--r-- | tests/unit/datepicker/core.js | 5 | ||||
-rw-r--r-- | tests/unit/datepicker/events.js | 9 | ||||
-rw-r--r-- | tests/unit/datepicker/helper.js | 1 | ||||
-rw-r--r-- | tests/unit/datepicker/methods.js | 1 | ||||
-rw-r--r-- | tests/unit/datepicker/options.js | 82 |
5 files changed, 70 insertions, 28 deletions
diff --git a/tests/unit/datepicker/core.js b/tests/unit/datepicker/core.js index 2c4b77402..74320931e 100644 --- a/tests/unit/datepicker/core.js +++ b/tests/unit/datepicker/core.js @@ -7,6 +7,7 @@ define( [ "ui/widgets/datepicker", "ui/i18n/datepicker-he" ], function( QUnit, $, common, helper, testHelper ) { +"use strict"; QUnit.module( "datepicker: core", { beforeEach: function() { @@ -15,8 +16,6 @@ QUnit.module( "datepicker: core", { afterEach: helper.moduleAfterEach } ); -common.testJshint( "widgets/datepicker" ); - QUnit.test( "initialization - Reinitialization after body had been emptied.", function( assert ) { assert.expect( 1 ); var bodyContent = $( "body" ).children(), inp = $( "#inp" ); @@ -57,7 +56,7 @@ QUnit.test( "baseStructure", function( assert ) { assert.ok( header.is( "div.ui-datepicker-header" ), "Structure - header division" ); assert.equal( header.children().length, 3, "Structure - header child count" ); assert.ok( header.children().first().is( "a.ui-datepicker-prev" ) && header.children().first().html() !== "", "Structure - prev link" ); - assert.ok( header.children().eq( 1 ).is( "a.ui-datepicker-next" ) && header.children().eq ( 1 ).html() !== "", "Structure - next link" ); + assert.ok( header.children().eq( 1 ).is( "a.ui-datepicker-next" ) && header.children().eq( 1 ).html() !== "", "Structure - next link" ); title = header.children().last(); assert.ok( title.is( "div.ui-datepicker-title" ) && title.html() !== "", "Structure - title division" ); diff --git a/tests/unit/datepicker/events.js b/tests/unit/datepicker/events.js index 44064ee21..50ee07b86 100644 --- a/tests/unit/datepicker/events.js +++ b/tests/unit/datepicker/events.js @@ -4,6 +4,7 @@ define( [ "./helper", "ui/widgets/datepicker" ], function( QUnit, $, testHelper ) { +"use strict"; var beforeAfterEach = testHelper.beforeAfterEach; @@ -136,8 +137,12 @@ QUnit.test( "events", function( assert ) { QUnit.test( "beforeShowDay-getDate", function( assert ) { assert.expect( 3 ); - var inp = testHelper.init( "#inp", { beforeShowDay: function() { inp.datepicker( "getDate" ); return [ true, "" ]; } } ), - dp = $( "#ui-datepicker-div" ); + var inp = testHelper.init( "#inp", { + beforeShowDay: function() { + inp.datepicker( "getDate" ); return [ true, "" ]; + } + } ); + var dp = $( "#ui-datepicker-div" ); inp.val( "01/01/2010" ).datepicker( "show" ); // Contains non-breaking space diff --git a/tests/unit/datepicker/helper.js b/tests/unit/datepicker/helper.js index 85485ddf4..652609d54 100644 --- a/tests/unit/datepicker/helper.js +++ b/tests/unit/datepicker/helper.js @@ -4,6 +4,7 @@ define( [ "lib/helper", "ui/widgets/datepicker" ], function( QUnit, $, helper ) { +"use strict"; return $.extend( helper, { addMonths: function( date, offset ) { diff --git a/tests/unit/datepicker/methods.js b/tests/unit/datepicker/methods.js index fed04ccdd..32d611748 100644 --- a/tests/unit/datepicker/methods.js +++ b/tests/unit/datepicker/methods.js @@ -4,6 +4,7 @@ define( [ "./helper", "ui/widgets/datepicker" ], function( QUnit, $, testHelper ) { +"use strict"; var beforeAfterEach = testHelper.beforeAfterEach; diff --git a/tests/unit/datepicker/options.js b/tests/unit/datepicker/options.js index 51ed93b71..50260d816 100644 --- a/tests/unit/datepicker/options.js +++ b/tests/unit/datepicker/options.js @@ -8,6 +8,7 @@ define( [ "ui/i18n/datepicker-zh-CN", "ui/ie" ], function( QUnit, $, testHelper ) { +"use strict"; var beforeAfterEach = testHelper.beforeAfterEach; @@ -902,7 +903,7 @@ QUnit.test( "localisation", function( assert ) { assert.expect( 24 ); var dp, month, day, date, inp = testHelper.init( "#inp", $.datepicker.regional.fr ); - inp.datepicker( "option", { dateFormat: "DD, d MM yy", showButtonPanel:true, changeMonth:true, changeYear:true } ).val( "" ).datepicker( "show" ); + inp.datepicker( "option", { dateFormat: "DD, d MM yy", showButtonPanel: true, changeMonth: true, changeYear: true } ).val( "" ).datepicker( "show" ); dp = $( "#ui-datepicker-div" ); assert.equal( $( ".ui-datepicker-close", dp ).text(), "Fermer", "Localisation - close" ); $( ".ui-datepicker-close", dp ).simulate( "mouseover" ); @@ -1039,50 +1040,85 @@ QUnit.test( "parseDateErrors", function( assert ) { try { expr(); assert.ok( false, "Parsed error " + value ); - } - catch ( e ) { + } catch ( e ) { assert.equal( e, error, "Parsed error " + value ); } } - expectError( function() { $.datepicker.parseDate( null, "Sat 2 01" ); }, + expectError( function() { + $.datepicker.parseDate( null, "Sat 2 01" ); + }, "Sat 2 01", "Invalid arguments" ); - expectError( function() { $.datepicker.parseDate( "d m y", null ); }, + expectError( function() { + $.datepicker.parseDate( "d m y", null ); + }, "null", "Invalid arguments" ); - expectError( function() { $.datepicker.parseDate( "d m y", "Sat 2 01" ); }, + expectError( function() { + $.datepicker.parseDate( "d m y", "Sat 2 01" ); + }, "Sat 2 01 - d m y", "Missing number at position 0" ); - expectError( function() { $.datepicker.parseDate( "dd mm yy", "Sat 2 01" ); }, + expectError( function() { + $.datepicker.parseDate( "dd mm yy", "Sat 2 01" ); + }, "Sat 2 01 - dd mm yy", "Missing number at position 0" ); - expectError( function() { $.datepicker.parseDate( "d m y", "3 Feb 01" ); }, + expectError( function() { + $.datepicker.parseDate( "d m y", "3 Feb 01" ); + }, "3 Feb 01 - d m y", "Missing number at position 2" ); - expectError( function() { $.datepicker.parseDate( "dd mm yy", "3 Feb 01" ); }, + expectError( function() { + $.datepicker.parseDate( "dd mm yy", "3 Feb 01" ); + }, "3 Feb 01 - dd mm yy", "Missing number at position 2" ); - expectError( function() { $.datepicker.parseDate( "mm dd yy", "2 1 01" ); }, + expectError( function() { + $.datepicker.parseDate( "mm dd yy", "2 1 01" ); + }, "2 1 01 - dd mm yy", "Missing number at position 4" ); - expectError( function() { $.datepicker.parseDate( "d m y", "3 2 AD01" ); }, + expectError( function() { + $.datepicker.parseDate( "d m y", "3 2 AD01" ); + }, "3 2 AD01 - d m y", "Missing number at position 4" ); - expectError( function() { $.datepicker.parseDate( "d m yy", "3 2 AD01" ); }, + expectError( function() { + $.datepicker.parseDate( "d m yy", "3 2 AD01" ); + }, "3 2 AD01 - dd mm yy", "Missing number at position 4" ); - expectError( function() { $.datepicker.parseDate( "y-o", "01-D01" ); }, + expectError( function() { + $.datepicker.parseDate( "y-o", "01-D01" ); + }, "2001-D01 - y-o", "Missing number at position 3" ); - expectError( function() { $.datepicker.parseDate( "yy-oo", "2001-D01" ); }, + expectError( function() { + $.datepicker.parseDate( "yy-oo", "2001-D01" ); + }, "2001-D01 - yy-oo", "Missing number at position 5" ); - expectError( function() { $.datepicker.parseDate( "D d M y", "D7 3 Feb 01" ); }, + expectError( function() { + $.datepicker.parseDate( "D d M y", "D7 3 Feb 01" ); + }, "D7 3 Feb 01 - D d M y", "Unknown name at position 0" ); - expectError( function() { $.datepicker.parseDate( "D d M y", "Sat 3 M2 01" ); }, + expectError( function() { + $.datepicker.parseDate( "D d M y", "Sat 3 M2 01" ); + }, "Sat 3 M2 01 - D d M y", "Unknown name at position 6" ); - expectError( function() { $.datepicker.parseDate( "DD, MM d, yy", "Saturday- Feb 3, 2001" ); }, + expectError( function() { + $.datepicker.parseDate( "DD, MM d, yy", "Saturday- Feb 3, 2001" ); + }, "Saturday- Feb 3, 2001 - DD, MM d, yy", "Unexpected literal at position 8" ); - expectError( function() { $.datepicker.parseDate( "'day' d 'of' MM (''DD''), yy", - "day 3 of February (\"Saturday\"), 2001" ); }, + expectError( function() { + $.datepicker.parseDate( "'day' d 'of' MM (''DD''), yy", + "day 3 of February (\"Saturday\"), 2001" ); + }, "day 3 of Mon2 ('Day7'), 2001", "Unexpected literal at position 19" ); - expectError( function() { $.datepicker.parseDate( "d m y", "29 2 01" ); }, + expectError( function() { + $.datepicker.parseDate( "d m y", "29 2 01" ); + }, "29 2 01 - d m y", "Invalid date" ); fr = $.datepicker.regional.fr; settings = { dayNamesShort: fr.dayNamesShort, dayNames: fr.dayNames, monthNamesShort: fr.monthNamesShort, monthNames: fr.monthNames }; - expectError( function() { $.datepicker.parseDate( "D d M y", "Mon 9 Avr 01", settings ); }, + expectError( function() { + $.datepicker.parseDate( "D d M y", "Mon 9 Avr 01", settings ); + }, "Mon 9 Avr 01 - D d M y", "Unknown name at position 0" ); - expectError( function() { $.datepicker.parseDate( "D d M y", "Lun. 9 Apr 01", settings ); }, + expectError( function() { + $.datepicker.parseDate( "D d M y", "Lun. 9 Apr 01", settings ); + }, "Lun. 9 Apr 01 - D d M y", "Unknown name at position 7" ); } ); @@ -1092,7 +1128,7 @@ QUnit.test( "Ticket #7244: date parser does not fail when too many numbers are p try { date = $.datepicker.parseDate( "dd/mm/yy", "18/04/19881" ); assert.ok( false, "Did not properly detect an invalid date" ); - }catch ( e ) { + } catch ( e ) { assert.ok( "invalid date detected" ); } |