diff options
author | Jörn Zaefferer <joern.zaefferer@gmail.com> | 2012-04-02 15:20:37 +0200 |
---|---|---|
committer | Jörn Zaefferer <joern.zaefferer@gmail.com> | 2012-04-02 15:20:37 +0200 |
commit | 1f0e0b2bb158f6f51b1b65066ba6608471aa6034 (patch) | |
tree | ddba28a1e773ec68e002e4b4e2b44f129364c2cd /tests/unit | |
parent | ff72467038f35fd7d031b33cf61d37ee02535a52 (diff) | |
parent | 48e5c853f995a825dd9d14cd2d8f592037f8505c (diff) | |
download | jquery-ui-1f0e0b2bb158f6f51b1b65066ba6608471aa6034.tar.gz jquery-ui-1f0e0b2bb158f6f51b1b65066ba6608471aa6034.zip |
Merge branch 'master' into grunt
Diffstat (limited to 'tests/unit')
32 files changed, 397 insertions, 158 deletions
diff --git a/tests/unit/accordion/accordion.html b/tests/unit/accordion/accordion.html index 109b3094e..5c9169ea3 100644 --- a/tests/unit/accordion/accordion.html +++ b/tests/unit/accordion/accordion.html @@ -66,7 +66,7 @@ <p> your bear, you have to admit it! <br> - No, we aren't selling bears. + No, we aren't <a href="#">selling bears</a>. </p> <p> We could talk about renting one. diff --git a/tests/unit/accordion/accordion_core.js b/tests/unit/accordion/accordion_core.js index de1b66046..92d79c121 100644 --- a/tests/unit/accordion/accordion_core.js +++ b/tests/unit/accordion/accordion_core.js @@ -25,24 +25,90 @@ test( "handle click on header-descendant", function() { }); test( "accessibility", function () { - expect( 13 ); - var element = $( "#list1" ).accordion().accordion( "option", "active", 1 ); + expect( 37 ); + var element = $( "#list1" ).accordion({ + active: 1 + }); var headers = element.find( ".ui-accordion-header" ); - equal( headers.eq( 1 ).attr( "tabindex" ), 0, "active header should have tabindex=0" ); - equal( headers.eq( 0 ).attr( "tabindex" ), -1, "inactive header should have tabindex=-1" ); - equal( element.attr( "role" ), "tablist", "main role" ); - equal( headers.attr( "role" ), "tab", "tab roles" ); - equal( headers.next().attr( "role" ), "tabpanel", "tabpanel roles" ); - equal( headers.eq( 1 ).attr( "aria-expanded" ), "true", "active tab has aria-expanded" ); - equal( headers.eq( 0 ).attr( "aria-expanded" ), "false", "inactive tab has aria-expanded" ); - equal( headers.eq( 1 ).attr( "aria-selected" ), "true", "active tab has aria-selected" ); - equal( headers.eq( 0 ).attr( "aria-selected" ), "false", "inactive tab has aria-selected" ); + equal( element.attr( "role" ), "tablist", "element role" ); + headers.each(function( i ) { + var header = headers.eq( i ), + panel = header.next(); + equal( header.attr( "role" ), "tab", "header " + i + " role" ); + equal( header.attr( "aria-controls" ), panel.attr( "id" ), "header " + i + " aria-controls" ); + equal( panel.attr( "role" ), "tabpanel", "panel " + i + " role" ); + equal( panel.attr( "aria-labelledby" ), header.attr( "id" ), "panel " + i + " aria-labelledby" ); + }); + + equal( headers.eq( 1 ).attr( "tabindex" ), 0, "active header has tabindex=0" ); + equal( headers.eq( 1 ).attr( "aria-selected" ), "true", "active tab has aria-selected=true" ); + equal( headers.eq( 1 ).next().attr( "aria-expanded" ), "true", "active tabpanel has aria-expanded=true" ); + equal( headers.eq( 1 ).next().attr( "aria-hidden" ), "false", "active tabpanel has aria-hidden=false" ); + equal( headers.eq( 0 ).attr( "tabindex" ), -1, "active header has tabindex=-1" ); + equal( headers.eq( 0 ).attr( "aria-selected" ), "false", "active tab has aria-selected=false" ); + equal( headers.eq( 0 ).next().attr( "aria-expanded" ), "false", "active tabpanel has aria-expanded=false" ); + equal( headers.eq( 0 ).next().attr( "aria-hidden" ), "true", "active tabpanel has aria-hidden=true" ); + equal( headers.eq( 2 ).attr( "tabindex" ), -1, "active header has tabindex=-1" ); + equal( headers.eq( 2 ).attr( "aria-selected" ), "false", "active tab has aria-selected=false" ); + equal( headers.eq( 2 ).next().attr( "aria-expanded" ), "false", "active tabpanel has aria-expanded=false" ); + equal( headers.eq( 2 ).next().attr( "aria-hidden" ), "true", "active tabpanel has aria-hidden=true" ); + element.accordion( "option", "active", 0 ); - equal( headers.eq( 0 ).attr( "aria-expanded" ), "true", "newly active tab has aria-expanded" ); - equal( headers.eq( 1 ).attr( "aria-expanded" ), "false", "newly inactive tab has aria-expanded" ); - equal( headers.eq( 0 ).attr( "aria-selected" ), "true", "active tab has aria-selected" ); - equal( headers.eq( 1 ).attr( "aria-selected" ), "false", "inactive tab has aria-selected" ); + equal( headers.eq( 0 ).attr( "tabindex" ), 0, "active header has tabindex=0" ); + equal( headers.eq( 0 ).attr( "aria-selected" ), "true", "active tab has aria-selected=true" ); + equal( headers.eq( 0 ).next().attr( "aria-expanded" ), "true", "active tabpanel has aria-expanded=true" ); + equal( headers.eq( 0 ).next().attr( "aria-hidden" ), "false", "active tabpanel has aria-hidden=false" ); + equal( headers.eq( 1 ).attr( "tabindex" ), -1, "active header has tabindex=-1" ); + equal( headers.eq( 1 ).attr( "aria-selected" ), "false", "active tab has aria-selected=false" ); + equal( headers.eq( 1 ).next().attr( "aria-expanded" ), "false", "active tabpanel has aria-expanded=false" ); + equal( headers.eq( 1 ).next().attr( "aria-hidden" ), "true", "active tabpanel has aria-hidden=true" ); + equal( headers.eq( 2 ).attr( "tabindex" ), -1, "active header has tabindex=-1" ); + equal( headers.eq( 2 ).attr( "aria-selected" ), "false", "active tab has aria-selected=false" ); + equal( headers.eq( 2 ).next().attr( "aria-expanded" ), "false", "active tabpanel has aria-expanded=false" ); + equal( headers.eq( 2 ).next().attr( "aria-hidden" ), "true", "active tabpanel has aria-hidden=true" ); +}); + +asyncTest( "keybaord support", function() { + expect( 13 ); + var element = $( "#list1" ).accordion(), + headers = element.find( ".ui-accordion-header" ), + anchor = headers.eq( 1 ).next().find( "a" ).eq( 0 ), + keyCode = $.ui.keyCode; + equal( headers.filter( ".ui-state-focus" ).length, 0, "no headers focused on init" ); + headers.eq( 0 ).simulate( "focus" ); + setTimeout(function() { + ok( headers.eq( 0 ).is( ".ui-state-focus" ), "first header has focus" ); + headers.eq( 0 ).simulate( "keydown", { keyCode: keyCode.DOWN } ); + ok( headers.eq( 1 ).is( ".ui-state-focus" ), "DOWN moves focus to next header" ); + headers.eq( 1 ).simulate( "keydown", { keyCode: keyCode.RIGHT } ); + ok( headers.eq( 2 ).is( ".ui-state-focus" ), "RIGHT moves focus to next header" ); + headers.eq( 2 ).simulate( "keydown", { keyCode: keyCode.DOWN } ); + ok( headers.eq( 0 ).is( ".ui-state-focus" ), "DOWN wraps focus to first header" ); + + headers.eq( 0 ).simulate( "keydown", { keyCode: keyCode.UP } ); + ok( headers.eq( 2 ).is( ".ui-state-focus" ), "UP wraps focus to last header" ); + headers.eq( 2 ).simulate( "keydown", { keyCode: keyCode.LEFT } ); + ok( headers.eq( 1 ).is( ".ui-state-focus" ), "LEFT moves focus to previous header" ); + + headers.eq( 1 ).simulate( "keydown", { keyCode: keyCode.HOME } ); + ok( headers.eq( 0 ).is( ".ui-state-focus" ), "HOME moves focus to first header" ); + headers.eq( 0 ).simulate( "keydown", { keyCode: keyCode.END } ); + ok( headers.eq( 2 ).is( ".ui-state-focus" ), "END moves focus to last header" ); + + headers.eq( 2 ).simulate( "keydown", { keyCode: keyCode.ENTER } ); + equal( element.accordion( "option", "active" ) , 2, "ENTER activates panel" ); + headers.eq( 1 ).simulate( "keydown", { keyCode: keyCode.SPACE } ); + equal( element.accordion( "option", "active" ), 1, "SPACE activates panel" ); + + anchor.simulate( "focus" ); + setTimeout(function() { + ok( !headers.eq( 1 ).is( ".ui-state-focus" ), "header loses focus when focusing inside the panel" ); + anchor.simulate( "keydown", { keyCode: keyCode.UP, ctrlKey: true } ); + ok( headers.eq( 1 ).is( ".ui-state-focus" ), "CTRL+UP moves focus to header" ); + start(); + }, 1 ); + }, 1 ); }); }( jQuery ) ); diff --git a/tests/unit/accordion/accordion_deprecated.html b/tests/unit/accordion/accordion_deprecated.html index 583c1adcd..116eb43b5 100644 --- a/tests/unit/accordion/accordion_deprecated.html +++ b/tests/unit/accordion/accordion_deprecated.html @@ -64,7 +64,7 @@ <p> your bear, you have to admit it! <br> - No, we aren't selling bears. + No, we aren't <a href="#">selling bears</a>. </p> <p> We could talk about renting one. diff --git a/tests/unit/accordion/accordion_methods.js b/tests/unit/accordion/accordion_methods.js index 9f61647c4..2f4722070 100644 --- a/tests/unit/accordion/accordion_methods.js +++ b/tests/unit/accordion/accordion_methods.js @@ -10,15 +10,19 @@ test( "destroy", function() { }); test( "enable/disable", function() { - expect( 3 ); + expect( 4 ); var element = $( "#list1" ).accordion(); accordion_state( element, 1, 0, 0 ); element.accordion( "disable" ); - element.accordion( "option", "active", 1 ); + // event does nothing + element.find( ".ui-accordion-header" ).eq( 1 ).trigger( "click" ); accordion_state( element, 1, 0, 0 ); - element.accordion( "enable" ); + // option still works element.accordion( "option", "active", 1 ); accordion_state( element, 0, 1, 0 ); + element.accordion( "enable" ); + element.accordion( "option", "active", 2 ); + accordion_state( element, 0, 0, 1 ); }); test( "refresh", function() { diff --git a/tests/unit/accordion/accordion_options.js b/tests/unit/accordion/accordion_options.js index 8206b1d62..2b7176394 100644 --- a/tests/unit/accordion/accordion_options.js +++ b/tests/unit/accordion/accordion_options.js @@ -75,7 +75,175 @@ if ( $.uiBackCompat === false ) { }); } -// TODO: add animation tests +test( "{ animate: false }", function() { + expect( 3 ); + var element = $( "#list1" ).accordion({ + animate: false + }), + panels = element.find( ".ui-accordion-content" ); + animate = $.fn.animate; + $.fn.animate = function() { + ok( false, ".animate() called" ); + }; + + ok( panels.eq( 0 ).is( ":visible" ), "first panel visible" ); + element.accordion( "option", "active", 1 ); + ok( panels.eq( 0 ).is( ":hidden" ), "first panel hidden" ); + ok( panels.eq( 1 ).is( ":visible" ), "second panel visible" ); + $.fn.animate = animate; +}); + +asyncTest( "{ animate: Number }", function() { + expect( 7 ); + var element = $( "#list1" ).accordion({ + animate: 100 + }), + panels = element.find( ".ui-accordion-content" ); + animate = $.fn.animate; + // called twice (both panels) + $.fn.animate = function( props, duration, easing ) { + equal( duration, 100, "correct duration" ); + equal( easing, undefined, "default easing" ); + animate.apply( this, arguments ); + }; + + ok( panels.eq( 0 ).is( ":visible" ), "first panel visible" ); + element.accordion( "option", "active", 1 ); + panels.promise().done(function() { + ok( panels.eq( 0 ).is( ":hidden" ), "first panel hidden" ); + ok( panels.eq( 1 ).is( ":visible" ), "second panel visible" ); + $.fn.animate = animate; + start(); + }); +}); + +asyncTest( "{ animate: String }", function() { + expect( 7 ); + var element = $( "#list1" ).accordion({ + animate: "linear" + }), + panels = element.find( ".ui-accordion-content" ); + animate = $.fn.animate; + // called twice (both panels) + $.fn.animate = function( props, duration, easing ) { + equal( duration, undefined, "default duration" ); + equal( easing, "linear", "correct easing" ); + animate.apply( this, arguments ); + }; + + ok( panels.eq( 0 ).is( ":visible" ), "first panel visible" ); + element.accordion( "option", "active", 1 ); + panels.promise().done(function() { + ok( panels.eq( 0 ).is( ":hidden" ), "first panel hidden" ); + ok( panels.eq( 1 ).is( ":visible" ), "second panel visible" ); + $.fn.animate = animate; + start(); + }); +}); + +asyncTest( "{ animate: {} }", function() { + expect( 7 ); + var element = $( "#list1" ).accordion({ + animate: {} + }), + panels = element.find( ".ui-accordion-content" ); + animate = $.fn.animate; + // called twice (both panels) + $.fn.animate = function( props, duration, easing ) { + equal( duration, undefined, "default duration" ); + equal( easing, undefined, "default easing" ); + animate.apply( this, arguments ); + }; + + ok( panels.eq( 0 ).is( ":visible" ), "first panel visible" ); + element.accordion( "option", "active", 1 ); + panels.promise().done(function() { + ok( panels.eq( 0 ).is( ":hidden" ), "first panel hidden" ); + ok( panels.eq( 1 ).is( ":visible" ), "second panel visible" ); + $.fn.animate = animate; + start(); + }); +}); + +asyncTest( "{ animate: { duration, easing } }", function() { + expect( 7 ); + var element = $( "#list1" ).accordion({ + animate: { duration: 100, easing: "linear" } + }), + panels = element.find( ".ui-accordion-content" ); + animate = $.fn.animate; + // called twice (both panels) + $.fn.animate = function( props, duration, easing ) { + equal( duration, 100, "correct duration" ); + equal( easing, "linear", "correct easing" ); + animate.apply( this, arguments ); + }; + + ok( panels.eq( 0 ).is( ":visible" ), "first panel visible" ); + element.accordion( "option", "active", 1 ); + panels.promise().done(function() { + ok( panels.eq( 0 ).is( ":hidden" ), "first panel hidden" ); + ok( panels.eq( 1 ).is( ":visible" ), "second panel visible" ); + $.fn.animate = animate; + start(); + }); +}); + +asyncTest( "{ animate: { duration, easing } }, animate down", function() { + expect( 7 ); + var element = $( "#list1" ).accordion({ + active: 1, + animate: { duration: 100, easing: "linear" } + }), + panels = element.find( ".ui-accordion-content" ); + animate = $.fn.animate; + // called twice (both panels) + $.fn.animate = function( props, duration, easing ) { + equal( duration, 100, "correct duration" ); + equal( easing, "linear", "correct easing" ); + animate.apply( this, arguments ); + }; + + ok( panels.eq( 1 ).is( ":visible" ), "first panel visible" ); + element.accordion( "option", "active", 0 ); + panels.promise().done(function() { + ok( panels.eq( 1 ).is( ":hidden" ), "first panel hidden" ); + ok( panels.eq( 0 ).is( ":visible" ), "second panel visible" ); + $.fn.animate = animate; + start(); + }); +}); + +asyncTest( "{ animate: { duration, easing, down } }, animate down", function() { + expect( 7 ); + var element = $( "#list1" ).accordion({ + active: 1, + animate: { + duration: 100, + easing: "linear", + down: { + easing: "swing" + } + } + }), + panels = element.find( ".ui-accordion-content" ); + animate = $.fn.animate; + // called twice (both panels) + $.fn.animate = function( props, duration, easing ) { + equal( duration, 100, "correct duration" ); + equal( easing, "swing", "correct easing" ); + animate.apply( this, arguments ); + }; + + ok( panels.eq( 1 ).is( ":visible" ), "first panel visible" ); + element.accordion( "option", "active", 0 ); + panels.promise().done(function() { + ok( panels.eq( 1 ).is( ":hidden" ), "first panel hidden" ); + ok( panels.eq( 0 ).is( ":visible" ), "second panel visible" ); + $.fn.animate = animate; + start(); + }); +}); test( "{ collapsible: false }", function() { expect( 4 ); @@ -152,6 +320,7 @@ test( "{ event: custom }", function() { // ensure old event handlers are unbound element.find( ".ui-accordion-header" ).eq( 1 ).trigger( "custom1" ); + element.find( ".ui-accordion-header" ).eq( 1 ).trigger( "custom2" ); equal( element.accordion( "option", "active" ), 2 ); accordion_state( element, 0, 0, 1 ); diff --git a/tests/unit/accordion/accordion_test_helpers.js b/tests/unit/accordion/accordion_test_helpers.js index 7b316e983..542809ea0 100644 --- a/tests/unit/accordion/accordion_test_helpers.js +++ b/tests/unit/accordion/accordion_test_helpers.js @@ -3,7 +3,7 @@ function accordion_state( accordion ) { var actual = accordion.find( ".ui-accordion-content" ).map(function() { return $( this ).css( "display" ) === "none" ? 0 : 1; }).get(); - deepEqual( actual, expected ); + QUnit.push( QUnit.equiv(actual, expected), actual, expected ); } function accordion_equalHeights( accordion, min, max ) { diff --git a/tests/unit/accordion/all.html b/tests/unit/accordion/all.html index 0d600e172..ec9c003d9 100644 --- a/tests/unit/accordion/all.html +++ b/tests/unit/accordion/all.html @@ -4,7 +4,7 @@ <meta charset="utf-8"> <title>jQuery UI Accordion Test Suite</title> - <script src="../../../jquery-1.7.1.js"></script> + <script src="../../../jquery-1.7.2.js"></script> <link rel="stylesheet" href="../../../external/qunit.css"> <link rel="stylesheet" href="../subsuiteRunner.css"> diff --git a/tests/unit/all-active.html b/tests/unit/all-active.html index f014078f6..89c10441d 100644 --- a/tests/unit/all-active.html +++ b/tests/unit/all-active.html @@ -4,7 +4,7 @@ <meta charset="utf-8"> <title>jQuery UI Test Suite</title> - <script src="../../jquery-1.7.1.js"></script> + <script src="../../jquery-1.7.2.js"></script> <link rel="stylesheet" href="../../external/qunit.css"> <link rel="stylesheet" href="subsuiteRunner.css"> diff --git a/tests/unit/all.html b/tests/unit/all.html index d5152bb48..e48b1ac0e 100644 --- a/tests/unit/all.html +++ b/tests/unit/all.html @@ -4,7 +4,7 @@ <meta charset="utf-8"> <title>jQuery UI Test Suite</title> - <script src="../../jquery-1.7.1.js"></script> + <script src="../../jquery-1.7.2.js"></script> <link rel="stylesheet" href="../../external/qunit.css"> <link rel="stylesheet" href="subsuiteRunner.css"> diff --git a/tests/unit/autocomplete/all.html b/tests/unit/autocomplete/all.html index c644e2728..87cde75fb 100644 --- a/tests/unit/autocomplete/all.html +++ b/tests/unit/autocomplete/all.html @@ -4,7 +4,7 @@ <meta charset="utf-8"> <title>jQuery UI Autocomplete Test Suite</title> - <script src="../../../jquery-1.7.1.js"></script> + <script src="../../../jquery-1.7.2.js"></script> <link rel="stylesheet" href="../../../external/qunit.css"> <link rel="stylesheet" href="../subsuiteRunner.css"> diff --git a/tests/unit/button/all.html b/tests/unit/button/all.html index fa9e22485..115743e94 100644 --- a/tests/unit/button/all.html +++ b/tests/unit/button/all.html @@ -4,7 +4,7 @@ <meta charset="utf-8"> <title>jQuery UI Button Test Suite</title> - <script src="../../../jquery-1.7.1.js"></script> + <script src="../../../jquery-1.7.2.js"></script> <link rel="stylesheet" href="../../../external/qunit.css"> <link rel="stylesheet" href="../subsuiteRunner.css"> diff --git a/tests/unit/core/all.html b/tests/unit/core/all.html index e8d84e12f..78bbe9aef 100644 --- a/tests/unit/core/all.html +++ b/tests/unit/core/all.html @@ -4,7 +4,7 @@ <meta charset="utf-8"> <title>jQuery UI Core Test Suite</title> - <script src="../../../jquery-1.7.1.js"></script> + <script src="../../../jquery-1.7.2.js"></script> <link rel="stylesheet" href="../../../external/qunit.css"> <link rel="stylesheet" href="../subsuiteRunner.css"> diff --git a/tests/unit/datepicker/all.html b/tests/unit/datepicker/all.html index 67d5cb2f9..1540705f8 100644 --- a/tests/unit/datepicker/all.html +++ b/tests/unit/datepicker/all.html @@ -4,7 +4,7 @@ <meta charset="utf-8"> <title>jQuery UI Datepicker Test Suite</title> - <script src="../../../jquery-1.7.1.js"></script> + <script src="../../../jquery-1.7.2.js"></script> <link rel="stylesheet" href="../../../external/qunit.css"> <link rel="stylesheet" href="../subsuiteRunner.css"> diff --git a/tests/unit/datepicker/datepicker_core.js b/tests/unit/datepicker/datepicker_core.js index b674c708a..bbc447ffe 100644 --- a/tests/unit/datepicker/datepicker_core.js +++ b/tests/unit/datepicker/datepicker_core.js @@ -235,132 +235,132 @@ test('keystrokes', function() { var inp = init('#inp'); var date = new Date(); inp.val('').datepicker('show'). - simulate('keydown', {keyCode: $.simulate.VK_ENTER}); + simulate('keydown', {keyCode: $.ui.keyCode.ENTER}); equalsDate(inp.datepicker('getDate'), date, 'Keystroke enter'); inp.val('02/04/2008').datepicker('show'). - simulate('keydown', {keyCode: $.simulate.VK_ENTER}); + simulate('keydown', {keyCode: $.ui.keyCode.ENTER}); equalsDate(inp.datepicker('getDate'), new Date(2008, 2 - 1, 4), 'Keystroke enter - preset'); inp.val('02/04/2008').datepicker('show'). - simulate('keydown', {ctrlKey: true, keyCode: $.simulate.VK_HOME}). - simulate('keydown', {keyCode: $.simulate.VK_ENTER}); + simulate('keydown', {ctrlKey: true, keyCode: $.ui.keyCode.HOME}). + simulate('keydown', {keyCode: $.ui.keyCode.ENTER}); equalsDate(inp.datepicker('getDate'), date, 'Keystroke ctrl+home'); inp.val('02/04/2008').datepicker('show'). - simulate('keydown', {ctrlKey: true, keyCode: $.simulate.VK_END}); + simulate('keydown', {ctrlKey: true, keyCode: $.ui.keyCode.END}); ok(inp.datepicker('getDate') == null, 'Keystroke ctrl+end'); inp.val('').datepicker('show'). - simulate('keydown', {keyCode: $.simulate.VK_ESC}); + simulate('keydown', {keyCode: $.ui.keyCode.ESCAPE}); ok(inp.datepicker('getDate') == null, 'Keystroke esc'); inp.val('02/04/2008').datepicker('show'). - simulate('keydown', {keyCode: $.simulate.VK_ESC}); + simulate('keydown', {keyCode: $.ui.keyCode.ESCAPE}); equalsDate(inp.datepicker('getDate'), new Date(2008, 2 - 1, 4), 'Keystroke esc - preset'); inp.val('02/04/2008').datepicker('show'). - simulate('keydown', {ctrlKey: true, keyCode: $.simulate.VK_PGUP}). - simulate('keydown', {keyCode: $.simulate.VK_ESC}); + simulate('keydown', {ctrlKey: true, keyCode: $.ui.keyCode.PAGE_UP}). + simulate('keydown', {keyCode: $.ui.keyCode.ESCAPE}); equalsDate(inp.datepicker('getDate'), new Date(2008, 2 - 1, 4), 'Keystroke esc - abandoned'); // Moving by day or week inp.val('').datepicker('show'). - simulate('keydown', {ctrlKey: true, keyCode: $.simulate.VK_LEFT}). - simulate('keydown', {keyCode: $.simulate.VK_ENTER}); + simulate('keydown', {ctrlKey: true, keyCode: $.ui.keyCode.LEFT}). + simulate('keydown', {keyCode: $.ui.keyCode.ENTER}); date.setDate(date.getDate() - 1); equalsDate(inp.datepicker('getDate'), date, 'Keystroke ctrl+left'); inp.val('').datepicker('show'). - simulate('keydown', {keyCode: $.simulate.VK_LEFT}). - simulate('keydown', {keyCode: $.simulate.VK_ENTER}); + simulate('keydown', {keyCode: $.ui.keyCode.LEFT}). + simulate('keydown', {keyCode: $.ui.keyCode.ENTER}); date.setDate(date.getDate() + 1); equalsDate(inp.datepicker('getDate'), date, 'Keystroke left'); inp.val('').datepicker('show'). - simulate('keydown', {ctrlKey: true, keyCode: $.simulate.VK_RIGHT}). - simulate('keydown', {keyCode: $.simulate.VK_ENTER}); + simulate('keydown', {ctrlKey: true, keyCode: $.ui.keyCode.RIGHT}). + simulate('keydown', {keyCode: $.ui.keyCode.ENTER}); date.setDate(date.getDate() + 1); equalsDate(inp.datepicker('getDate'), date, 'Keystroke ctrl+right'); inp.val('').datepicker('show'). - simulate('keydown', {keyCode: $.simulate.VK_RIGHT}). - simulate('keydown', {keyCode: $.simulate.VK_ENTER}); + simulate('keydown', {keyCode: $.ui.keyCode.RIGHT}). + simulate('keydown', {keyCode: $.ui.keyCode.ENTER}); date.setDate(date.getDate() - 1); equalsDate(inp.datepicker('getDate'), date, 'Keystroke right'); inp.val('').datepicker('show'). - simulate('keydown', {ctrlKey: true, keyCode: $.simulate.VK_UP}). - simulate('keydown', {keyCode: $.simulate.VK_ENTER}); + simulate('keydown', {ctrlKey: true, keyCode: $.ui.keyCode.UP}). + simulate('keydown', {keyCode: $.ui.keyCode.ENTER}); date.setDate(date.getDate() - 7); equalsDate(inp.datepicker('getDate'), date, 'Keystroke ctrl+up'); inp.val('').datepicker('show'). - simulate('keydown', {keyCode: $.simulate.VK_UP}). - simulate('keydown', {keyCode: $.simulate.VK_ENTER}); + simulate('keydown', {keyCode: $.ui.keyCode.UP}). + simulate('keydown', {keyCode: $.ui.keyCode.ENTER}); date.setDate(date.getDate() + 7); equalsDate(inp.datepicker('getDate'), date, 'Keystroke up'); inp.val('').datepicker('show'). - simulate('keydown', {ctrlKey: true, keyCode: $.simulate.VK_DOWN}). - simulate('keydown', {keyCode: $.simulate.VK_ENTER}); + simulate('keydown', {ctrlKey: true, keyCode: $.ui.keyCode.DOWN}). + simulate('keydown', {keyCode: $.ui.keyCode.ENTER}); date.setDate(date.getDate() + 7); equalsDate(inp.datepicker('getDate'), date, 'Keystroke ctrl+down'); inp.val('').datepicker('show'). - simulate('keydown', {keyCode: $.simulate.VK_DOWN}). - simulate('keydown', {keyCode: $.simulate.VK_ENTER}); + simulate('keydown', {keyCode: $.ui.keyCode.DOWN}). + simulate('keydown', {keyCode: $.ui.keyCode.ENTER}); date.setDate(date.getDate() - 7); equalsDate(inp.datepicker('getDate'), date, 'Keystroke down'); // Moving by month or year inp.val('02/04/2008').datepicker('show'). - simulate('keydown', {keyCode: $.simulate.VK_PGUP}). - simulate('keydown', {keyCode: $.simulate.VK_ENTER}); + simulate('keydown', {keyCode: $.ui.keyCode.PAGE_UP}). + simulate('keydown', {keyCode: $.ui.keyCode.ENTER}); equalsDate(inp.datepicker('getDate'), new Date(2008, 1 - 1, 4), 'Keystroke pgup'); inp.val('02/04/2008').datepicker('show'). - simulate('keydown', {keyCode: $.simulate.VK_PGDN}). - simulate('keydown', {keyCode: $.simulate.VK_ENTER}); + simulate('keydown', {keyCode: $.ui.keyCode.PAGE_DOWN}). + simulate('keydown', {keyCode: $.ui.keyCode.ENTER}); equalsDate(inp.datepicker('getDate'), new Date(2008, 3 - 1, 4), 'Keystroke pgdn'); inp.val('02/04/2008').datepicker('show'). - simulate('keydown', {ctrlKey: true, keyCode: $.simulate.VK_PGUP}). - simulate('keydown', {keyCode: $.simulate.VK_ENTER}); + simulate('keydown', {ctrlKey: true, keyCode: $.ui.keyCode.PAGE_UP}). + simulate('keydown', {keyCode: $.ui.keyCode.ENTER}); equalsDate(inp.datepicker('getDate'), new Date(2007, 2 - 1, 4), 'Keystroke ctrl+pgup'); inp.val('02/04/2008').datepicker('show'). - simulate('keydown', {ctrlKey: true, keyCode: $.simulate.VK_PGDN}). - simulate('keydown', {keyCode: $.simulate.VK_ENTER}); + simulate('keydown', {ctrlKey: true, keyCode: $.ui.keyCode.PAGE_DOWN}). + simulate('keydown', {keyCode: $.ui.keyCode.ENTER}); equalsDate(inp.datepicker('getDate'), new Date(2009, 2 - 1, 4), 'Keystroke ctrl+pgdn'); // Check for moving to short months inp.val('03/31/2008').datepicker('show'). - simulate('keydown', {keyCode: $.simulate.VK_PGUP}). - simulate('keydown', {keyCode: $.simulate.VK_ENTER}); + simulate('keydown', {keyCode: $.ui.keyCode.PAGE_UP}). + simulate('keydown', {keyCode: $.ui.keyCode.ENTER}); equalsDate(inp.datepicker('getDate'), new Date(2008, 2 - 1, 29), 'Keystroke pgup - Feb'); inp.val('01/30/2008').datepicker('show'). - simulate('keydown', {keyCode: $.simulate.VK_PGDN}). - simulate('keydown', {keyCode: $.simulate.VK_ENTER}); + simulate('keydown', {keyCode: $.ui.keyCode.PAGE_DOWN}). + simulate('keydown', {keyCode: $.ui.keyCode.ENTER}); equalsDate(inp.datepicker('getDate'), new Date(2008, 2 - 1, 29), 'Keystroke pgdn - Feb'); inp.val('02/29/2008').datepicker('show'). - simulate('keydown', {ctrlKey: true, keyCode: $.simulate.VK_PGUP}). - simulate('keydown', {keyCode: $.simulate.VK_ENTER}); + simulate('keydown', {ctrlKey: true, keyCode: $.ui.keyCode.PAGE_UP}). + simulate('keydown', {keyCode: $.ui.keyCode.ENTER}); equalsDate(inp.datepicker('getDate'), new Date(2007, 2 - 1, 28), 'Keystroke ctrl+pgup - Feb'); inp.val('02/29/2008').datepicker('show'). - simulate('keydown', {ctrlKey: true, keyCode: $.simulate.VK_PGDN}). - simulate('keydown', {keyCode: $.simulate.VK_ENTER}); + simulate('keydown', {ctrlKey: true, keyCode: $.ui.keyCode.PAGE_DOWN}). + simulate('keydown', {keyCode: $.ui.keyCode.ENTER}); equalsDate(inp.datepicker('getDate'), new Date(2009, 2 - 1, 28), 'Keystroke ctrl+pgdn - Feb'); // Goto current inp.datepicker('option', {gotoCurrent: true}). datepicker('hide').val('02/04/2008').datepicker('show'). - simulate('keydown', {keyCode: $.simulate.VK_PGDN}). - simulate('keydown', {ctrlKey: true, keyCode: $.simulate.VK_HOME}). - simulate('keydown', {keyCode: $.simulate.VK_ENTER}); + simulate('keydown', {keyCode: $.ui.keyCode.PAGE_DOWN}). + simulate('keydown', {ctrlKey: true, keyCode: $.ui.keyCode.HOME}). + simulate('keydown', {keyCode: $.ui.keyCode.ENTER}); equalsDate(inp.datepicker('getDate'), new Date(2008, 2 - 1, 4), 'Keystroke ctrl+home'); // Change steps inp.datepicker('option', {stepMonths: 2, gotoCurrent: false}). datepicker('hide').val('02/04/2008').datepicker('show'). - simulate('keydown', {keyCode: $.simulate.VK_PGUP}). - simulate('keydown', {keyCode: $.simulate.VK_ENTER}); + simulate('keydown', {keyCode: $.ui.keyCode.PAGE_UP}). + simulate('keydown', {keyCode: $.ui.keyCode.ENTER}); equalsDate(inp.datepicker('getDate'), new Date(2007, 12 - 1, 4), 'Keystroke pgup step 2'); inp.val('02/04/2008').datepicker('show'). - simulate('keydown', {keyCode: $.simulate.VK_PGDN}). - simulate('keydown', {keyCode: $.simulate.VK_ENTER}); + simulate('keydown', {keyCode: $.ui.keyCode.PAGE_DOWN}). + simulate('keydown', {keyCode: $.ui.keyCode.ENTER}); equalsDate(inp.datepicker('getDate'), new Date(2008, 4 - 1, 4), 'Keystroke pgdn step 2'); }); diff --git a/tests/unit/datepicker/datepicker_events.js b/tests/unit/datepicker/datepicker_events.js index fc312216f..9876b7e60 100644 --- a/tests/unit/datepicker/datepicker_events.js +++ b/tests/unit/datepicker/datepicker_events.js @@ -26,24 +26,24 @@ test('events', function() { var date = new Date(); // onSelect inp.val('').datepicker('show'). - simulate('keydown', {keyCode: $.simulate.VK_ENTER}); + simulate('keydown', {keyCode: $.ui.keyCode.ENTER}); equal(selectedThis, inp[0], 'Callback selected this'); equal(selectedInst, $.data(inp[0], PROP_NAME), 'Callback selected inst'); equal(selectedDate, $.datepicker.formatDate('mm/dd/yy', date), 'Callback selected date'); inp.val('').datepicker('show'). - simulate('keydown', {ctrlKey: true, keyCode: $.simulate.VK_DOWN}). - simulate('keydown', {keyCode: $.simulate.VK_ENTER}); + simulate('keydown', {ctrlKey: true, keyCode: $.ui.keyCode.DOWN}). + simulate('keydown', {keyCode: $.ui.keyCode.ENTER}); date.setDate(date.getDate() + 7); equal(selectedDate, $.datepicker.formatDate('mm/dd/yy', date), 'Callback selected date - ctrl+down'); inp.val('').datepicker('show'). - simulate('keydown', {keyCode: $.simulate.VK_ESC}); + simulate('keydown', {keyCode: $.ui.keyCode.ESCAPE}); equal(selectedDate, $.datepicker.formatDate('mm/dd/yy', date), 'Callback selected date - esc'); var dateStr = '02/04/2008'; inp.val(dateStr).datepicker('show'). - simulate('keydown', {keyCode: $.simulate.VK_ENTER}); + simulate('keydown', {keyCode: $.ui.keyCode.ENTER}); equal(dateStr, selectedDate, 'onSelect is called after enter keydown'); // onChangeMonthYear @@ -54,25 +54,25 @@ test('events', function() { }; date = new Date(); date.setDate(1); - inp.simulate('keydown', {keyCode: $.simulate.VK_PGUP}); + inp.simulate('keydown', {keyCode: $.ui.keyCode.PAGE_UP}); date.setMonth(date.getMonth() - 1); equal(selectedThis, inp[0], 'Callback change month/year this'); equal(selectedInst, $.data(inp[0], PROP_NAME), 'Callback change month/year inst'); equal(selectedDate, newMonthYear(date), 'Callback change month/year date - pgup'); - inp.simulate('keydown', {keyCode: $.simulate.VK_PGDN}); + inp.simulate('keydown', {keyCode: $.ui.keyCode.PAGE_DOWN}); date.setMonth(date.getMonth() + 1); equal(selectedDate, newMonthYear(date), 'Callback change month/year date - pgdn'); - inp.simulate('keydown', {ctrlKey: true, keyCode: $.simulate.VK_PGUP}); + inp.simulate('keydown', {ctrlKey: true, keyCode: $.ui.keyCode.PAGE_UP}); date.setFullYear(date.getFullYear() - 1); equal(selectedDate, newMonthYear(date), 'Callback change month/year date - ctrl+pgup'); - inp.simulate('keydown', {ctrlKey: true, keyCode: $.simulate.VK_HOME}); + inp.simulate('keydown', {ctrlKey: true, keyCode: $.ui.keyCode.HOME}); date.setFullYear(date.getFullYear() + 1); equal(selectedDate, newMonthYear(date), 'Callback change month/year date - ctrl+home'); - inp.simulate('keydown', {ctrlKey: true, keyCode: $.simulate.VK_PGDN}); + inp.simulate('keydown', {ctrlKey: true, keyCode: $.ui.keyCode.PAGE_DOWN}); date.setFullYear(date.getFullYear() + 1); equal(selectedDate, newMonthYear(date), 'Callback change month/year date - ctrl+pgdn'); @@ -84,38 +84,38 @@ test('events', function() { // onChangeMonthYear step by 2 inp.datepicker('option', {stepMonths: 2}). datepicker('hide').val('').datepicker('show'). - simulate('keydown', {keyCode: $.simulate.VK_PGUP}); + simulate('keydown', {keyCode: $.ui.keyCode.PAGE_UP}); date.setMonth(date.getMonth() - 14); equal(selectedDate, newMonthYear(date), 'Callback change month/year by 2 date - pgup'); - inp.simulate('keydown', {ctrlKey: true, keyCode: $.simulate.VK_PGUP}); + inp.simulate('keydown', {ctrlKey: true, keyCode: $.ui.keyCode.PAGE_UP}); date.setMonth(date.getMonth() - 12); equal(selectedDate, newMonthYear(date), 'Callback change month/year by 2 date - ctrl+pgup'); - inp.simulate('keydown', {keyCode: $.simulate.VK_PGDN}); + inp.simulate('keydown', {keyCode: $.ui.keyCode.PAGE_DOWN}); date.setMonth(date.getMonth() + 2); equal(selectedDate, newMonthYear(date), 'Callback change month/year by 2 date - pgdn'); - inp.simulate('keydown', {ctrlKey: true, keyCode: $.simulate.VK_PGDN}); + inp.simulate('keydown', {ctrlKey: true, keyCode: $.ui.keyCode.PAGE_DOWN}); date.setMonth(date.getMonth() + 12); equal(selectedDate, newMonthYear(date), 'Callback change month/year by 2 date - ctrl+pgdn'); // onClose inp.datepicker('option', {onClose: callback, onChangeMonthYear: null, stepMonths: 1}). val('').datepicker('show'). - simulate('keydown', {keyCode: $.simulate.VK_ESC}); + simulate('keydown', {keyCode: $.ui.keyCode.ESCAPE}); equal(selectedThis, inp[0], 'Callback close this'); equal(selectedInst, $.data(inp[0], PROP_NAME), 'Callback close inst'); equal(selectedDate, '', 'Callback close date - esc'); inp.val('').datepicker('show'). - simulate('keydown', {keyCode: $.simulate.VK_ENTER}); + simulate('keydown', {keyCode: $.ui.keyCode.ENTER}); equal(selectedDate, $.datepicker.formatDate('mm/dd/yy', new Date()), 'Callback close date - enter'); inp.val('02/04/2008').datepicker('show'). - simulate('keydown', {keyCode: $.simulate.VK_ESC}); + simulate('keydown', {keyCode: $.ui.keyCode.ESCAPE}); equal(selectedDate, '02/04/2008', 'Callback close date - preset'); inp.val('02/04/2008').datepicker('show'). - simulate('keydown', {ctrlKey: true, keyCode: $.simulate.VK_END}); + simulate('keydown', {ctrlKey: true, keyCode: $.ui.keyCode.END}); equal(selectedDate, '', 'Callback close date - ctrl+end'); var inp2 = init('#inp2'); diff --git a/tests/unit/datepicker/datepicker_options.js b/tests/unit/datepicker/datepicker_options.js index bab6ed45a..f538c6d03 100644 --- a/tests/unit/datepicker/datepicker_options.js +++ b/tests/unit/datepicker/datepicker_options.js @@ -77,7 +77,7 @@ test('invocation', function() { ok(image.length == 0, 'Focus - image absent'); inp.focus(); ok(dp.is(':visible'), 'Focus - rendered on focus'); - inp.simulate('keydown', {keyCode: $.simulate.VK_ESC}); + inp.simulate('keydown', {keyCode: $.ui.keyCode.ESCAPE}); ok(!dp.is(':visible'), 'Focus - hidden on exit'); inp.focus(); ok(dp.is(':visible'), 'Focus - rendered on focus'); @@ -161,93 +161,93 @@ test('defaultDate', function() { var inp = init('#inp'); var date = new Date(); inp.val('').datepicker('show'). - simulate('keydown', {keyCode: $.simulate.VK_ENTER}); + simulate('keydown', {keyCode: $.ui.keyCode.ENTER}); equalsDate(inp.datepicker('getDate'), date, 'Default date null'); // Numeric values inp.datepicker('option', {defaultDate: -2}). datepicker('hide').val('').datepicker('show'). - simulate('keydown', {keyCode: $.simulate.VK_ENTER}); + simulate('keydown', {keyCode: $.ui.keyCode.ENTER}); date.setDate(date.getDate() - 2); equalsDate(inp.datepicker('getDate'), date, 'Default date -2'); inp.datepicker('option', {defaultDate: 3}). datepicker('hide').val('').datepicker('show'). - simulate('keydown', {keyCode: $.simulate.VK_ENTER}); + simulate('keydown', {keyCode: $.ui.keyCode.ENTER}); date.setDate(date.getDate() + 5); equalsDate(inp.datepicker('getDate'), date, 'Default date 3'); inp.datepicker('option', {defaultDate: 1 / 0}). datepicker('hide').val('').datepicker('show'). - simulate('keydown', {keyCode: $.simulate.VK_ENTER}); + simulate('keydown', {keyCode: $.ui.keyCode.ENTER}); date.setDate(date.getDate() - 3); equalsDate(inp.datepicker('getDate'), date, 'Default date Infinity'); inp.datepicker('option', {defaultDate: 1 / 'a'}). datepicker('hide').val('').datepicker('show'). - simulate('keydown', {keyCode: $.simulate.VK_ENTER}); + simulate('keydown', {keyCode: $.ui.keyCode.ENTER}); equalsDate(inp.datepicker('getDate'), date, 'Default date NaN'); // String offset values inp.datepicker('option', {defaultDate: '-1d'}). datepicker('hide').val('').datepicker('show'). - simulate('keydown', {keyCode: $.simulate.VK_ENTER}); + simulate('keydown', {keyCode: $.ui.keyCode.ENTER}); date.setDate(date.getDate() - 1); equalsDate(inp.datepicker('getDate'), date, 'Default date -1d'); inp.datepicker('option', {defaultDate: '+3D'}). datepicker('hide').val('').datepicker('show'). - simulate('keydown', {keyCode: $.simulate.VK_ENTER}); + simulate('keydown', {keyCode: $.ui.keyCode.ENTER}); date.setDate(date.getDate() + 4); equalsDate(inp.datepicker('getDate'), date, 'Default date +3D'); inp.datepicker('option', {defaultDate: ' -2 w '}). datepicker('hide').val('').datepicker('show'). - simulate('keydown', {keyCode: $.simulate.VK_ENTER}); + simulate('keydown', {keyCode: $.ui.keyCode.ENTER}); date = new Date(); date.setDate(date.getDate() - 14); equalsDate(inp.datepicker('getDate'), date, 'Default date -2 w'); inp.datepicker('option', {defaultDate: '+1 W'}). datepicker('hide').val('').datepicker('show'). - simulate('keydown', {keyCode: $.simulate.VK_ENTER}); + simulate('keydown', {keyCode: $.ui.keyCode.ENTER}); date.setDate(date.getDate() + 21); equalsDate(inp.datepicker('getDate'), date, 'Default date +1 W'); inp.datepicker('option', {defaultDate: ' -1 m '}). datepicker('hide').val('').datepicker('show'). - simulate('keydown', {keyCode: $.simulate.VK_ENTER}); + simulate('keydown', {keyCode: $.ui.keyCode.ENTER}); date = addMonths(new Date(), -1); equalsDate(inp.datepicker('getDate'), date, 'Default date -1 m'); inp.datepicker('option', {defaultDate: '+2M'}). datepicker('hide').val('').datepicker('show'). - simulate('keydown', {keyCode: $.simulate.VK_ENTER}); + simulate('keydown', {keyCode: $.ui.keyCode.ENTER}); date = addMonths(new Date(), 2); equalsDate(inp.datepicker('getDate'), date, 'Default date +2M'); inp.datepicker('option', {defaultDate: '-2y'}). datepicker('hide').val('').datepicker('show'). - simulate('keydown', {keyCode: $.simulate.VK_ENTER}); + simulate('keydown', {keyCode: $.ui.keyCode.ENTER}); date = new Date(); date.setFullYear(date.getFullYear() - 2); equalsDate(inp.datepicker('getDate'), date, 'Default date -2y'); inp.datepicker('option', {defaultDate: '+1 Y '}). datepicker('hide').val('').datepicker('show'). - simulate('keydown', {keyCode: $.simulate.VK_ENTER}); + simulate('keydown', {keyCode: $.ui.keyCode.ENTER}); date.setFullYear(date.getFullYear() + 3); equalsDate(inp.datepicker('getDate'), date, 'Default date +1 Y'); inp.datepicker('option', {defaultDate: '+1M +10d'}). datepicker('hide').val('').datepicker('show'). - simulate('keydown', {keyCode: $.simulate.VK_ENTER}); + simulate('keydown', {keyCode: $.ui.keyCode.ENTER}); date = addMonths(new Date(), 1); date.setDate(date.getDate() + 10); equalsDate(inp.datepicker('getDate'), date, 'Default date +1M +10d'); // String date values inp.datepicker('option', {defaultDate: '07/04/2007'}). datepicker('hide').val('').datepicker('show'). - simulate('keydown', {keyCode: $.simulate.VK_ENTER}); + simulate('keydown', {keyCode: $.ui.keyCode.ENTER}); date = new Date(2007, 7 - 1, 4); equalsDate(inp.datepicker('getDate'), date, 'Default date 07/04/2007'); inp.datepicker('option', {dateFormat: 'yy-mm-dd', defaultDate: '2007-04-02'}). datepicker('hide').val('').datepicker('show'). - simulate('keydown', {keyCode: $.simulate.VK_ENTER}); + simulate('keydown', {keyCode: $.ui.keyCode.ENTER}); date = new Date(2007, 4 - 1, 2); equalsDate(inp.datepicker('getDate'), date, 'Default date 2007-04-02'); // Date value date = new Date(2007, 1 - 1, 26); inp.datepicker('option', {dateFormat: 'mm/dd/yy', defaultDate: date}). datepicker('hide').val('').datepicker('show'). - simulate('keydown', {keyCode: $.simulate.VK_ENTER}); + simulate('keydown', {keyCode: $.ui.keyCode.ENTER}); equalsDate(inp.datepicker('getDate'), date, 'Default date 01/26/2007'); }); @@ -293,7 +293,7 @@ test('miscellaneous', function() { longNames[date.getMonth()], 'Navigation current - as date format'); equal(dp.find('.ui-datepicker-next').text(), shortNames[2] + ' >', 'Navigation next - as date format'); - inp.simulate('keydown', {keyCode: $.simulate.VK_PGDN}); + inp.simulate('keydown', {keyCode: $.ui.keyCode.PAGE_DOWN}); equal(dp.find('.ui-datepicker-prev').text(), '< ' + shortNames[1], 'Navigation prev - as date format + pgdn'); equal(dp.find('.ui-datepicker-current').text(), @@ -317,46 +317,46 @@ test('minMax', function() { var minDate = new Date(2008, 2 - 1, 29); var maxDate = new Date(2008, 12 - 1, 7); inp.val('06/04/2008').datepicker('show'); - inp.simulate('keydown', {ctrlKey: true, keyCode: $.simulate.VK_PGUP}). - simulate('keydown', {keyCode: $.simulate.VK_ENTER}); + inp.simulate('keydown', {ctrlKey: true, keyCode: $.ui.keyCode.PAGE_UP}). + simulate('keydown', {keyCode: $.ui.keyCode.ENTER}); equalsDate(inp.datepicker('getDate'), lastYear, 'Min/max - null, null - ctrl+pgup'); inp.val('06/04/2008').datepicker('show'); - inp.simulate('keydown', {ctrlKey: true, keyCode: $.simulate.VK_PGDN}). - simulate('keydown', {keyCode: $.simulate.VK_ENTER}); + inp.simulate('keydown', {ctrlKey: true, keyCode: $.ui.keyCode.PAGE_DOWN}). + simulate('keydown', {keyCode: $.ui.keyCode.ENTER}); equalsDate(inp.datepicker('getDate'), nextYear, 'Min/max - null, null - ctrl+pgdn'); inp.datepicker('option', {minDate: minDate}). datepicker('hide').val('06/04/2008').datepicker('show'); - inp.simulate('keydown', {ctrlKey: true, keyCode: $.simulate.VK_PGUP}). - simulate('keydown', {keyCode: $.simulate.VK_ENTER}); + inp.simulate('keydown', {ctrlKey: true, keyCode: $.ui.keyCode.PAGE_UP}). + simulate('keydown', {keyCode: $.ui.keyCode.ENTER}); equalsDate(inp.datepicker('getDate'), minDate, 'Min/max - 02/29/2008, null - ctrl+pgup'); inp.val('06/04/2008').datepicker('show'); - inp.simulate('keydown', {ctrlKey: true, keyCode: $.simulate.VK_PGDN}). - simulate('keydown', {keyCode: $.simulate.VK_ENTER}); + inp.simulate('keydown', {ctrlKey: true, keyCode: $.ui.keyCode.PAGE_DOWN}). + simulate('keydown', {keyCode: $.ui.keyCode.ENTER}); equalsDate(inp.datepicker('getDate'), nextYear, 'Min/max - 02/29/2008, null - ctrl+pgdn'); inp.datepicker('option', {maxDate: maxDate}). datepicker('hide').val('06/04/2008').datepicker('show'); - inp.simulate('keydown', {ctrlKey: true, keyCode: $.simulate.VK_PGUP}). - simulate('keydown', {keyCode: $.simulate.VK_ENTER}); + inp.simulate('keydown', {ctrlKey: true, keyCode: $.ui.keyCode.PAGE_UP}). + simulate('keydown', {keyCode: $.ui.keyCode.ENTER}); equalsDate(inp.datepicker('getDate'), minDate, 'Min/max - 02/29/2008, 12/07/2008 - ctrl+pgup'); inp.val('06/04/2008').datepicker('show'); - inp.simulate('keydown', {ctrlKey: true, keyCode: $.simulate.VK_PGDN}). - simulate('keydown', {keyCode: $.simulate.VK_ENTER}); + inp.simulate('keydown', {ctrlKey: true, keyCode: $.ui.keyCode.PAGE_DOWN}). + simulate('keydown', {keyCode: $.ui.keyCode.ENTER}); equalsDate(inp.datepicker('getDate'), maxDate, 'Min/max - 02/29/2008, 12/07/2008 - ctrl+pgdn'); inp.datepicker('option', {minDate: null}). datepicker('hide').val('06/04/2008').datepicker('show'); - inp.simulate('keydown', {ctrlKey: true, keyCode: $.simulate.VK_PGUP}). - simulate('keydown', {keyCode: $.simulate.VK_ENTER}); + inp.simulate('keydown', {ctrlKey: true, keyCode: $.ui.keyCode.PAGE_UP}). + simulate('keydown', {keyCode: $.ui.keyCode.ENTER}); equalsDate(inp.datepicker('getDate'), lastYear, 'Min/max - null, 12/07/2008 - ctrl+pgup'); inp.val('06/04/2008').datepicker('show'); - inp.simulate('keydown', {ctrlKey: true, keyCode: $.simulate.VK_PGDN}). - simulate('keydown', {keyCode: $.simulate.VK_ENTER}); + inp.simulate('keydown', {ctrlKey: true, keyCode: $.ui.keyCode.PAGE_DOWN}). + simulate('keydown', {keyCode: $.ui.keyCode.ENTER}); equalsDate(inp.datepicker('getDate'), maxDate, 'Min/max - null, 12/07/2008 - ctrl+pgdn'); // Relative dates @@ -364,15 +364,15 @@ test('minMax', function() { date.setDate(date.getDate() - 7); inp.datepicker('option', {minDate: '-1w', maxDate: '+1 M +10 D '}). datepicker('hide').val('').datepicker('show'); - inp.simulate('keydown', {ctrlKey: true, keyCode: $.simulate.VK_PGUP}). - simulate('keydown', {keyCode: $.simulate.VK_ENTER}); + inp.simulate('keydown', {ctrlKey: true, keyCode: $.ui.keyCode.PAGE_UP}). + simulate('keydown', {keyCode: $.ui.keyCode.ENTER}); equalsDate(inp.datepicker('getDate'), date, 'Min/max - -1w, +1 M +10 D - ctrl+pgup'); date = addMonths(new Date(), 1); date.setDate(date.getDate() + 10); inp.val('').datepicker('show'); - inp.simulate('keydown', {ctrlKey: true, keyCode: $.simulate.VK_PGDN}). - simulate('keydown', {keyCode: $.simulate.VK_ENTER}); + inp.simulate('keydown', {ctrlKey: true, keyCode: $.ui.keyCode.PAGE_DOWN}). + simulate('keydown', {keyCode: $.ui.keyCode.ENTER}); equalsDate(inp.datepicker('getDate'), date, 'Min/max - -1w, +1 M +10 D - ctrl+pgdn'); // With existing date @@ -477,34 +477,34 @@ test('altField', function() { // No alternate field set alt.val(''); inp.val('06/04/2008').datepicker('show'); - inp.simulate('keydown', {keyCode: $.simulate.VK_ENTER}); + inp.simulate('keydown', {keyCode: $.ui.keyCode.ENTER}); equal(inp.val(), '06/04/2008', 'Alt field - dp - enter'); equal(alt.val(), '', 'Alt field - alt not set'); // Alternate field set alt.val(''); inp.datepicker('option', {altField: '#alt', altFormat: 'yy-mm-dd'}). val('06/04/2008').datepicker('show'); - inp.simulate('keydown', {keyCode: $.simulate.VK_ENTER}); + inp.simulate('keydown', {keyCode: $.ui.keyCode.ENTER}); equal(inp.val(), '06/04/2008', 'Alt field - dp - enter'); equal(alt.val(), '2008-06-04', 'Alt field - alt - enter'); // Move from initial date alt.val(''); inp.val('06/04/2008').datepicker('show'); - inp.simulate('keydown', {keyCode: $.simulate.VK_PGDN}). - simulate('keydown', {keyCode: $.simulate.VK_ENTER}); + inp.simulate('keydown', {keyCode: $.ui.keyCode.PAGE_DOWN}). + simulate('keydown', {keyCode: $.ui.keyCode.ENTER}); equal(inp.val(), '07/04/2008', 'Alt field - dp - pgdn'); equal(alt.val(), '2008-07-04', 'Alt field - alt - pgdn'); // Alternate field set - closed alt.val(''); inp.val('06/04/2008').datepicker('show'); - inp.simulate('keydown', {keyCode: $.simulate.VK_PGDN}). - simulate('keydown', {keyCode: $.simulate.VK_ESC}); + inp.simulate('keydown', {keyCode: $.ui.keyCode.PAGE_DOWN}). + simulate('keydown', {keyCode: $.ui.keyCode.ESCAPE}); equal(inp.val(), '06/04/2008', 'Alt field - dp - pgdn/esc'); equal(alt.val(), '', 'Alt field - alt - pgdn/esc'); // Clear date and alternate alt.val(''); inp.val('06/04/2008').datepicker('show'); - inp.simulate('keydown', {ctrlKey: true, keyCode: $.simulate.VK_END}); + inp.simulate('keydown', {ctrlKey: true, keyCode: $.ui.keyCode.END}); equal(inp.val(), '', 'Alt field - dp - ctrl+end'); equal(alt.val(), '', 'Alt field - alt - ctrl+end'); @@ -725,7 +725,7 @@ test('localisation', function() { 'Localisation - day ' + day); day = (day + 1) % 7; }); - inp.simulate('keydown', {keyCode: $.simulate.VK_ENTER}); + inp.simulate('keydown', {keyCode: $.ui.keyCode.ENTER}); var date = new Date(); equal(inp.val(), $.datepicker.regional['fr'].dayNames[date.getDay()] + ', ' + date.getDate() + ' ' + $.datepicker.regional['fr'].monthNames[date.getMonth()] + diff --git a/tests/unit/dialog/all.html b/tests/unit/dialog/all.html index e0416ecd1..973119c08 100644 --- a/tests/unit/dialog/all.html +++ b/tests/unit/dialog/all.html @@ -4,7 +4,7 @@ <meta charset="utf-8"> <title>jQuery UI Dialog Test Suite</title> - <script src="../../../jquery-1.7.1.js"></script> + <script src="../../../jquery-1.7.2.js"></script> <link rel="stylesheet" href="../../../external/qunit.css"> <link rel="stylesheet" href="../subsuiteRunner.css"> diff --git a/tests/unit/draggable/all.html b/tests/unit/draggable/all.html index 3796d3f75..1b2a511a5 100644 --- a/tests/unit/draggable/all.html +++ b/tests/unit/draggable/all.html @@ -4,7 +4,7 @@ <meta charset="utf-8"> <title>jQuery UI Draggable Test Suite</title> - <script src="../../../jquery-1.7.1.js"></script> + <script src="../../../jquery-1.7.2.js"></script> <link rel="stylesheet" href="../../../external/qunit.css"> <link rel="stylesheet" href="../subsuiteRunner.css"> diff --git a/tests/unit/droppable/all.html b/tests/unit/droppable/all.html index e7f274c25..535f41521 100644 --- a/tests/unit/droppable/all.html +++ b/tests/unit/droppable/all.html @@ -4,7 +4,7 @@ <meta charset="utf-8"> <title>jQuery UI Droppable Test Suite</title> - <script src="../../../jquery-1.7.1.js"></script> + <script src="../../../jquery-1.7.2.js"></script> <link rel="stylesheet" href="../../../external/qunit.css"> <link rel="stylesheet" href="../subsuiteRunner.css"> diff --git a/tests/unit/effects/all.html b/tests/unit/effects/all.html index 56890ba1d..0ef901292 100644 --- a/tests/unit/effects/all.html +++ b/tests/unit/effects/all.html @@ -4,7 +4,7 @@ <meta charset="utf-8"> <title>jQuery UI Effects Test Suite</title> - <script src="../../../jquery-1.7.1.js"></script> + <script src="../../../jquery-1.7.2.js"></script> <link rel="stylesheet" href="../../../external/qunit.css"> <link rel="stylesheet" href="../subsuiteRunner.css"> diff --git a/tests/unit/menu/all.html b/tests/unit/menu/all.html index 38b76030b..a58e15299 100644 --- a/tests/unit/menu/all.html +++ b/tests/unit/menu/all.html @@ -4,7 +4,7 @@ <meta charset="utf-8"> <title>jQuery UI Menu Test Suite</title> - <script src="../../../jquery-1.7.1.js"></script> + <script src="../../../jquery-1.7.2.js"></script> <link rel="stylesheet" href="../../../external/qunit.css"> <link rel="stylesheet" href="../subsuiteRunner.css"> diff --git a/tests/unit/position/all.html b/tests/unit/position/all.html index 07676f134..fa3ecf23d 100644 --- a/tests/unit/position/all.html +++ b/tests/unit/position/all.html @@ -4,7 +4,7 @@ <meta charset="utf-8"> <title>jQuery UI Position Test Suite</title> - <script src="../../../jquery-1.7.1.js"></script> + <script src="../../../jquery-1.7.2.js"></script> <link rel="stylesheet" href="../../../external/qunit.css"> <link rel="stylesheet" href="../subsuiteRunner.css"> diff --git a/tests/unit/progressbar/all.html b/tests/unit/progressbar/all.html index 52c195037..eefb9c135 100644 --- a/tests/unit/progressbar/all.html +++ b/tests/unit/progressbar/all.html @@ -4,7 +4,7 @@ <meta charset="utf-8"> <title>jQuery UI Progressbar Test Suite</title> - <script src="../../../jquery-1.7.1.js"></script> + <script src="../../../jquery-1.7.2.js"></script> <link rel="stylesheet" href="../../../external/qunit.css"> <link rel="stylesheet" href="../subsuiteRunner.css"> diff --git a/tests/unit/resizable/all.html b/tests/unit/resizable/all.html index 2f56d02fd..1c6811282 100644 --- a/tests/unit/resizable/all.html +++ b/tests/unit/resizable/all.html @@ -4,7 +4,7 @@ <meta charset="utf-8"> <title>jQuery UI Resizable Test Suite</title> - <script src="../../../jquery-1.7.1.js"></script> + <script src="../../../jquery-1.7.2.js"></script> <link rel="stylesheet" href="../../../external/qunit.css"> <link rel="stylesheet" href="../subsuiteRunner.css"> diff --git a/tests/unit/selectable/all.html b/tests/unit/selectable/all.html index e77829b4e..bfebf46c2 100644 --- a/tests/unit/selectable/all.html +++ b/tests/unit/selectable/all.html @@ -4,7 +4,7 @@ <meta charset="utf-8"> <title>jQuery UI Selectable Test Suite</title> - <script src="../../../jquery-1.7.1.js"></script> + <script src="../../../jquery-1.7.2.js"></script> <link rel="stylesheet" href="../../../external/qunit.css"> <link rel="stylesheet" href="../subsuiteRunner.css"> diff --git a/tests/unit/slider/all.html b/tests/unit/slider/all.html index cbdbd2f5f..5aac26ced 100644 --- a/tests/unit/slider/all.html +++ b/tests/unit/slider/all.html @@ -4,7 +4,7 @@ <meta charset="utf-8"> <title>jQuery UI Slider Test Suite</title> - <script src="../../../jquery-1.7.1.js"></script> + <script src="../../../jquery-1.7.2.js"></script> <link rel="stylesheet" href="../../../external/qunit.css"> <link rel="stylesheet" href="../subsuiteRunner.css"> diff --git a/tests/unit/sortable/all.html b/tests/unit/sortable/all.html index 0ee6b5648..89e239250 100644 --- a/tests/unit/sortable/all.html +++ b/tests/unit/sortable/all.html @@ -4,7 +4,7 @@ <meta charset="utf-8"> <title>jQuery UI Sortable Test Suite</title> - <script src="../../../jquery-1.7.1.js"></script> + <script src="../../../jquery-1.7.2.js"></script> <link rel="stylesheet" href="../../../external/qunit.css"> <link rel="stylesheet" href="../subsuiteRunner.css"> diff --git a/tests/unit/spinner/all.html b/tests/unit/spinner/all.html index 10753625f..e41e088c4 100644 --- a/tests/unit/spinner/all.html +++ b/tests/unit/spinner/all.html @@ -4,7 +4,7 @@ <meta charset="utf-8"> <title>jQuery UI Spinner Test Suite</title> - <script src="../../../jquery-1.7.1.js"></script> + <script src="../../../jquery-1.7.2.js"></script> <link rel="stylesheet" href="../../../external/qunit.css"> <link rel="stylesheet" href="../subsuiteRunner.css"> diff --git a/tests/unit/subsuite.js b/tests/unit/subsuite.js index e584d2885..03e8c9706 100644 --- a/tests/unit/subsuite.js +++ b/tests/unit/subsuite.js @@ -1,6 +1,6 @@ (function() { -var versions = [ "1.6", "1.6.1", "1.6.2", "1.6.3", "1.6.4", "1.7", "1.7.1", "git" ]; +var versions = [ "1.6", "1.6.1", "1.6.2", "1.6.3", "1.6.4", "1.7", "1.7.1", "1.7.2", "git" ]; var additionalTests = { accordion: [ "accordion_deprecated.html" ], diff --git a/tests/unit/tabs/all.html b/tests/unit/tabs/all.html index 363edc002..1da3ecad2 100644 --- a/tests/unit/tabs/all.html +++ b/tests/unit/tabs/all.html @@ -4,7 +4,7 @@ <meta charset="utf-8"> <title>jQuery UI Tabs Test Suite</title> - <script src="../../../jquery-1.7.1.js"></script> + <script src="../../../jquery-1.7.2.js"></script> <link rel="stylesheet" href="../../../external/qunit.css"> <link rel="stylesheet" href="../subsuiteRunner.css"> diff --git a/tests/unit/tooltip/all.html b/tests/unit/tooltip/all.html index 0ef6e090e..deb628e2f 100644 --- a/tests/unit/tooltip/all.html +++ b/tests/unit/tooltip/all.html @@ -4,7 +4,7 @@ <meta charset="utf-8"> <title>jQuery UI Tooltip Test Suite</title> - <script src="../../../jquery-1.7.1.js"></script> + <script src="../../../jquery-1.7.2.js"></script> <link rel="stylesheet" href="../../../external/qunit.css"> <link rel="stylesheet" href="../subsuiteRunner.css"> diff --git a/tests/unit/widget/all.html b/tests/unit/widget/all.html index ae8bc3c66..cad4bdd72 100644 --- a/tests/unit/widget/all.html +++ b/tests/unit/widget/all.html @@ -4,7 +4,7 @@ <meta charset="utf-8"> <title>jQuery UI Widget Test Suite</title> - <script src="../../../jquery-1.7.1.js"></script> + <script src="../../../jquery-1.7.2.js"></script> <link rel="stylesheet" href="../../../external/qunit.css"> <link rel="stylesheet" href="../subsuiteRunner.css"> |