diff options
author | Felix Nagel <info@felixnagel.com> | 2012-08-11 19:45:43 +0200 |
---|---|---|
committer | Felix Nagel <info@felixnagel.com> | 2012-08-11 19:45:43 +0200 |
commit | dd272e75689a7e105f7d852f0fc903e4f4bda245 (patch) | |
tree | 5c097bc4ce4ab3ead310c63ac228bb1f0d3683b6 /tests | |
parent | 549b97ed6cc718087ce8b9bff3c8556ab4ca7848 (diff) | |
parent | 30b579f598a3abdc9b0b7ad18bc76c8b5438d5ca (diff) | |
download | jquery-ui-dd272e75689a7e105f7d852f0fc903e4f4bda245.tar.gz jquery-ui-dd272e75689a7e105f7d852f0fc903e4f4bda245.zip |
Merge branch 'master' into selectmenu
Diffstat (limited to 'tests')
-rw-r--r-- | tests/jquery.simulate.js | 2 | ||||
-rw-r--r-- | tests/unit/dialog/dialog_tickets.js | 2 | ||||
-rw-r--r-- | tests/unit/menu/menu_events.js | 18 | ||||
-rw-r--r-- | tests/unit/slider/slider_core.js | 8 | ||||
-rw-r--r-- | tests/unit/slider/slider_events.js | 6 | ||||
-rw-r--r-- | tests/unit/slider/slider_methods.js | 19 | ||||
-rw-r--r-- | tests/unit/slider/slider_options.js | 12 | ||||
-rw-r--r-- | tests/unit/tabs/tabs_core.js | 18 | ||||
-rw-r--r-- | tests/visual/effects/effects.css | 4 |
9 files changed, 32 insertions, 57 deletions
diff --git a/tests/jquery.simulate.js b/tests/jquery.simulate.js index 874d274cc..e281e2fee 100644 --- a/tests/jquery.simulate.js +++ b/tests/jquery.simulate.js @@ -3,7 +3,7 @@ * http://jqueryui.com * * Copyright 2012 jQuery Foundation and other contributors - * Dual licensed under the MIT or GPL Version 2 licenses. + * Released under the MIT license. * http://jquery.org/license */ diff --git a/tests/unit/dialog/dialog_tickets.js b/tests/unit/dialog/dialog_tickets.js index 201ea3a87..5c3277c2f 100644 --- a/tests/unit/dialog/dialog_tickets.js +++ b/tests/unit/dialog/dialog_tickets.js @@ -10,7 +10,7 @@ asyncTest( "#3123: Prevent tabbing out of modal dialogs", function() { var el = $( "<div><input id='t3123-first'><input id='t3123-last'></div>" ).dialog({ modal: true }), inputs = el.find( "input" ), - widget = el.dialog( "widget" ); + widget = el.dialog( "widget" )[ 0 ]; function checkTab() { ok( $.contains( widget, document.activeElement ), "Tab key event moved focus within the modal" ); diff --git a/tests/unit/menu/menu_events.js b/tests/unit/menu/menu_events.js index 8eb8ee8c6..69ae2e14f 100644 --- a/tests/unit/menu/menu_events.js +++ b/tests/unit/menu/menu_events.js @@ -577,22 +577,4 @@ test( "handle keyboard navigation with spelling of menu items", function() { element.focus(); }); -asyncTest( "handle page up and page down before the menu has focus", function() { - expect( 1 ); - var element = $( "#menu1" ).menu({ - focus: function( event, ui ) { - log( $( event.target ).find( ".ui-state-focus" ).parent().index() ); - } - }); - - log( "keydown", true ); - element.simulate( "keydown", { keyCode: $.ui.keyCode.PAGE_DOWN } ); - element.blur(); - setTimeout( function() { - element.simulate( "keydown", { keyCode: $.ui.keyCode.PAGE_UP } ); - equal( logOutput(), "keydown,0,0", "Page Up and Page Down bring initial focus to first item" ); - start(); - }, 500 ); -}); - })( jQuery ); diff --git a/tests/unit/slider/slider_core.js b/tests/unit/slider/slider_core.js index e5f21ee1b..86a516875 100644 --- a/tests/unit/slider/slider_core.js +++ b/tests/unit/slider/slider_core.js @@ -16,6 +16,7 @@ function handle() { module("slider: core"); test("keydown HOME on handle sets value to min", function() { + expect( 2 ); el = $('<div></div>'); options = { max: 5, @@ -50,6 +51,7 @@ test("keydown HOME on handle sets value to min", function() { }); test("keydown END on handle sets value to max", function() { + expect( 2 ); el = $('<div></div>'); options = { max: 5, @@ -84,6 +86,7 @@ test("keydown END on handle sets value to max", function() { }); test("keydown PAGE_UP on handle increases value by 1/5 range, not greater than max", function() { + expect( 4 ); $.each(['horizontal', 'vertical'], function(i, orientation) { el = $('<div></div>'); options = { @@ -107,6 +110,7 @@ test("keydown PAGE_UP on handle increases value by 1/5 range, not greater than m }); test("keydown PAGE_DOWN on handle decreases value by 1/5 range, not less than min", function() { + expect( 4 ); $.each(['horizontal', 'vertical'], function(i, orientation) { el = $('<div></div>'); options = { @@ -130,6 +134,7 @@ test("keydown PAGE_DOWN on handle decreases value by 1/5 range, not less than mi }); test("keydown UP on handle increases value by step, not greater than max", function() { + expect( 4 ); el = $('<div></div>'); options = { max: 5, @@ -170,6 +175,7 @@ test("keydown UP on handle increases value by step, not greater than max", funct }); test("keydown RIGHT on handle increases value by step, not greater than max", function() { + expect( 4 ); el = $('<div></div>'); options = { max: 5, @@ -210,6 +216,7 @@ test("keydown RIGHT on handle increases value by step, not greater than max", fu }); test("keydown DOWN on handle decreases value by step, not less than min", function() { + expect( 4 ); el = $('<div></div>'); options = { max: 5, @@ -250,6 +257,7 @@ test("keydown DOWN on handle decreases value by step, not less than min", functi }); test("keydown LEFT on handle decreases value by step, not less than min", function() { + expect( 4 ); el = $('<div></div>'); options = { max: 5, diff --git a/tests/unit/slider/slider_events.js b/tests/unit/slider/slider_events.js index 9e39d2a3e..4d0896442 100644 --- a/tests/unit/slider/slider_events.js +++ b/tests/unit/slider/slider_events.js @@ -12,8 +12,7 @@ module( "slider: events" ); test( "mouse based interaction", function() { expect(4); - var el = $( "<div></div>" ) - .appendTo( "body" ) + var el = $( "#slider1" ) .slider({ start: function(event, ui) { equal( event.originalEvent.type, "mousedown", "start triggered by mousedown" ); @@ -37,8 +36,7 @@ test( "keyboard based interaction", function() { expect(3); // Test keyup at end of handle slide (keyboard) - var el = $( "<div></div>" ) - .appendTo( "body" ) + var el = $( "#slider1" ) .slider({ start: function(event, ui) { equal( event.originalEvent.type, "keydown", "start triggered by keydown" ); diff --git a/tests/unit/slider/slider_methods.js b/tests/unit/slider/slider_methods.js index 79f80e868..1a6b493c9 100644 --- a/tests/unit/slider/slider_methods.js +++ b/tests/unit/slider/slider_methods.js @@ -27,21 +27,14 @@ test("init", function() { }); test("destroy", function() { - $("<div></div>").appendTo('body').slider().slider("destroy").remove(); - ok(true, '.slider("destroy") called on element'); - - $([]).slider().slider("destroy").remove(); - ok(true, '.slider("destroy") called on empty collection'); - - $('<div></div>').appendTo('body').remove().slider().slider("destroy").remove(); - ok(true, '.slider("destroy") called on disconnected DOMElement'); - - var expected = $('<div></div>').slider(), - actual = expected.slider('destroy'); - equal(actual, expected, 'destroy is chainable'); + expect( 1 ); + domEqual( "#slider1", function() { + $( "#slider1" ).slider().slider( "destroy" ); + }); }); test("enable", function() { + expect( 5 ); var el, expected = $('<div></div>').slider(), actual = expected.slider('enable'); @@ -56,6 +49,7 @@ test("enable", function() { }); test("disable", function() { + expect( 5 ); var el, expected = $('<div></div>').slider(), actual = expected.slider('disable'); @@ -70,6 +64,7 @@ test("disable", function() { }); test("value", function() { + expect( 17 ); $([false, 'min', 'max']).each(function() { var el = $('<div></div>').slider({ range: this, diff --git a/tests/unit/slider/slider_options.js b/tests/unit/slider/slider_options.js index 09067a3e9..96d0d45d0 100644 --- a/tests/unit/slider/slider_options.js +++ b/tests/unit/slider/slider_options.js @@ -12,6 +12,7 @@ function handle() { module("slider: options"); test("max", function() { + expect( 2 ); el = $('<div></div>'); options = { @@ -30,6 +31,7 @@ test("max", function() { }); test("min", function() { + expect( 2 ); el = $('<div></div>'); options = { @@ -48,7 +50,8 @@ test("min", function() { }); test("orientation", function() { - el = $('<div></div>'); + expect( 6 ); + el = $('#slider1'); options = { max: 2, @@ -62,7 +65,7 @@ test("orientation", function() { el.slider(options).slider("option", "orientation", "horizontal"); ok(el.is('.ui-slider-horizontal'), "horizontal slider has class .ui-slider-horizontal"); ok(!el.is('.ui-slider-vertical'), "horizontal slider does not have class .ui-slider-vertical"); - equal(handle().css('left'), percentVal + '%', "horizontal slider handle is positioned with left: %"); + equal(handle()[0].style.left, percentVal + '%', "horizontal slider handle is positioned with left: %"); el.slider('destroy'); @@ -78,7 +81,7 @@ test("orientation", function() { el.slider(options).slider("option", "orientation", "vertical"); ok(el.is('.ui-slider-vertical'), "vertical slider has class .ui-slider-vertical"); ok(!el.is('.ui-slider-horizontal'), "vertical slider does not have class .ui-slider-horizontal"); - equal(handle().css('bottom'), percentVal + '%', "vertical slider handle is positioned with bottom: %"); + equal(handle()[0].style.bottom, percentVal + '%', "vertical slider handle is positioned with bottom: %"); el.slider('destroy'); @@ -92,6 +95,7 @@ test("orientation", function() { // value option/method: the value option is not restricted by min/max/step. // What is returned by the value method is restricted by min (>=), max (<=), and step (even multiple) test("step", function() { + expect( 9 ); var el = $('<div></div>').slider({ min: 0, value: 0, @@ -112,7 +116,7 @@ test("step", function() { el.slider("value", 19); equal( el.slider("value"), 20 ); -el = $('<div></div>').slider({ + el = $('<div></div>').slider({ min: 0, value: 0, step: 20, diff --git a/tests/unit/tabs/tabs_core.js b/tests/unit/tabs/tabs_core.js index f1a2d72c1..53dd50a98 100644 --- a/tests/unit/tabs/tabs_core.js +++ b/tests/unit/tabs/tabs_core.js @@ -285,11 +285,7 @@ asyncTest( "keyboard support - LEFT, RIGHT, UP, DOWN, HOME, END, SPACE, ENTER", equal( panels.eq( 2 ).attr( "aria-expanded" ), "false", "third panel has aria-expanded=false" ); equal( panels.eq( 2 ).attr( "aria-hidden" ), "true", "third panel has aria-hidden=true" ); - // support: Firefox 12 - // Firefox <13 passes arguments so we can't use setTimeout( start, 1 ) - setTimeout(function() { - start(); - }, 1 ); + setTimeout( start, 1 ); } setTimeout( step1, 1 ); @@ -482,11 +478,7 @@ asyncTest( "keyboard support - CTRL navigation", function() { equal( panels.eq( 0 ).attr( "aria-expanded" ), "false", "first panel has aria-expanded=false" ); equal( panels.eq( 0 ).attr( "aria-hidden" ), "true", "first panel has aria-hidden=true" ); - // support: Firefox 12 - // Firefox <13 passes arguments so we can't use setTimeout( start, 1 ) - setTimeout(function() { - start(); - }, 1 ); + setTimeout( start, 1 ); } setTimeout( step1, 1 ); @@ -578,11 +570,7 @@ asyncTest( "keyboard support - CTRL+UP, ALT+PAGE_DOWN, ALT+PAGE_UP", function() panels.eq( 1 ).simulate( "keydown", { keyCode: keyCode.UP, ctrlKey: true } ); strictEqual( document.activeElement, tabs[ 1 ], "second tab is activeElement" ); - // support: Firefox 12 - // Firefox <13 passes arguments so we can't use setTimeout( start, 1 ) - setTimeout(function() { - start(); - }, 1 ); + setTimeout( start, 1 ); } setTimeout( step1, 1 ); diff --git a/tests/visual/effects/effects.css b/tests/visual/effects/effects.css index 460019f24..8e9ee0ffd 100644 --- a/tests/visual/effects/effects.css +++ b/tests/visual/effects/effects.css @@ -1,8 +1,8 @@ body { margin: 1em; padding: 0; - background: #191919; - color: #fff; + background: #fff; + color: #000; } ul.effects { |