diff options
author | Scott González <scott.gonzalez@gmail.com> | 2012-04-19 10:50:09 -0400 |
---|---|---|
committer | Scott González <scott.gonzalez@gmail.com> | 2012-04-19 10:50:09 -0400 |
commit | af1b4d859d9563e43896d76086e1e9ebbb3ab74b (patch) | |
tree | 96c044ea80d1d5ec7badb27f9a47699b79be8afe | |
parent | 72a0f5c5129b77c6e06c9936d290e89bd35a9eaa (diff) | |
download | jquery-ui-af1b4d859d9563e43896d76086e1e9ebbb3ab74b.tar.gz jquery-ui-af1b4d859d9563e43896d76086e1e9ebbb3ab74b.zip |
Tests: Lint.
-rw-r--r-- | grunt.js | 2 | ||||
-rw-r--r-- | tests/unit/accordion/accordion_core.js | 14 | ||||
-rw-r--r-- | tests/unit/accordion/accordion_deprecated.js | 28 | ||||
-rw-r--r-- | tests/unit/accordion/accordion_events.js | 20 | ||||
-rw-r--r-- | tests/unit/accordion/accordion_options.js | 66 | ||||
-rw-r--r-- | tests/unit/accordion/accordion_test_helpers.js | 4 | ||||
-rw-r--r-- | tests/unit/autocomplete/autocomplete_events.js | 2 | ||||
-rw-r--r-- | tests/unit/button/button_core.js | 11 | ||||
-rw-r--r-- | tests/unit/button/button_methods.js | 4 |
9 files changed, 77 insertions, 74 deletions
@@ -347,6 +347,8 @@ grunt.initConfig({ }, defaults ), // TODO: don't create so many globals in tests globals: { + accordion_equalHeights: true, + accordion_setupTeardown: true, accordion_state: true, asyncTest: true, commonWidgetTests: true, diff --git a/tests/unit/accordion/accordion_core.js b/tests/unit/accordion/accordion_core.js index 92d79c121..b08a5caea 100644 --- a/tests/unit/accordion/accordion_core.js +++ b/tests/unit/accordion/accordion_core.js @@ -27,9 +27,9 @@ test( "handle click on header-descendant", function() { test( "accessibility", function () { expect( 37 ); var element = $( "#list1" ).accordion({ - active: 1 - }); - var headers = element.find( ".ui-accordion-header" ); + active: 1 + }), + headers = element.find( ".ui-accordion-header" ); equal( element.attr( "role" ), "tablist", "element role" ); headers.each(function( i ) { @@ -85,22 +85,22 @@ asyncTest( "keybaord support", function() { 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" ); diff --git a/tests/unit/accordion/accordion_deprecated.js b/tests/unit/accordion/accordion_deprecated.js index eec034e18..47180e785 100644 --- a/tests/unit/accordion/accordion_deprecated.js +++ b/tests/unit/accordion/accordion_deprecated.js @@ -110,8 +110,8 @@ test( "{ autoHeight: true }, default", function() { test( "{ autoHeight: false }", function() { expect( 3 ); - var element = $( "#navigation" ).accordion({ autoHeight: false }); - var sizes = []; + var element = $( "#navigation" ).accordion({ autoHeight: false }), + sizes = []; element.find( ".ui-accordion-content" ).each(function() { sizes.push( $(this).height() ); }); @@ -220,7 +220,7 @@ test( "{ navigation: true, navigationFilter: header }", function() { var element = $( "#navigation" ).accordion({ navigation: true, navigationFilter: function() { - return /\?p=1\.1\.3$/.test( this.href ); + return (/\?p=1\.1\.3$/).test( this.href ); } }); equal( element.accordion( "option", "active" ), 2 ); @@ -232,7 +232,7 @@ test( "{ navigation: true, navigationFilter: content }", function() { var element = $( "#navigation" ).accordion({ navigation: true, navigationFilter: function() { - return /\?p=1\.1\.3\.2$/.test( this.href ); + return (/\?p=1\.1\.3\.2$/).test( this.href ); } }); equal( element.accordion( "option", "active" ), 2 ); @@ -248,11 +248,11 @@ module( "accordion (deprecated) - changestart/change events", accordion_setupTea test( "changestart", function() { expect( 26 ); var element = $( "#list1" ).accordion({ - active: false, - collapsible: true - }); - var headers = element.find( ".ui-accordion-header" ); - var content = element.find( ".ui-accordion-content" ); + active: false, + collapsible: true + }), + headers = element.find( ".ui-accordion-header" ), + content = element.find( ".ui-accordion-content" ); element.one( "accordionchangestart", function( event, ui ) { equal( ui.oldHeader.size(), 0 ); @@ -296,11 +296,11 @@ test( "changestart", function() { test( "change", function() { expect( 20 ); var element = $( "#list1" ).accordion({ - active: false, - collapsible: true - }); - var headers = element.find( ".ui-accordion-header" ); - var content = element.find( ".ui-accordion-content" ); + active: false, + collapsible: true + }), + headers = element.find( ".ui-accordion-header" ), + content = element.find( ".ui-accordion-content" ); element.one( "accordionchange", function( event, ui ) { equal( ui.oldHeader.size(), 0 ); diff --git a/tests/unit/accordion/accordion_events.js b/tests/unit/accordion/accordion_events.js index dbb3e37df..7e3d1f8d0 100644 --- a/tests/unit/accordion/accordion_events.js +++ b/tests/unit/accordion/accordion_events.js @@ -44,11 +44,11 @@ test( "create", function() { test( "beforeActivate", function() { expect( 38 ); var element = $( "#list1" ).accordion({ - active: false, - collapsible: true - }); - var headers = element.find( ".ui-accordion-header" ); - var content = element.find( ".ui-accordion-content" ); + active: false, + collapsible: true + }), + headers = element.find( ".ui-accordion-header" ), + content = element.find( ".ui-accordion-content" ); element.one( "accordionbeforeactivate", function( event, ui ) { ok( !( "originalEvent" in event ) ); @@ -109,11 +109,11 @@ test( "beforeActivate", function() { test( "activate", function() { expect( 21 ); var element = $( "#list1" ).accordion({ - active: false, - collapsible: true - }); - var headers = element.find( ".ui-accordion-header" ); - var content = element.find( ".ui-accordion-content" ); + active: false, + collapsible: true + }), + headers = element.find( ".ui-accordion-header" ), + content = element.find( ".ui-accordion-content" ); element.one( "accordionactivate", function( event, ui ) { equal( ui.oldHeader.size(), 0 ); diff --git a/tests/unit/accordion/accordion_options.js b/tests/unit/accordion/accordion_options.js index 2b7176394..a29c7f07d 100644 --- a/tests/unit/accordion/accordion_options.js +++ b/tests/unit/accordion/accordion_options.js @@ -80,7 +80,7 @@ test( "{ animate: false }", function() { var element = $( "#list1" ).accordion({ animate: false }), - panels = element.find( ".ui-accordion-content" ); + panels = element.find( ".ui-accordion-content" ), animate = $.fn.animate; $.fn.animate = function() { ok( false, ".animate() called" ); @@ -98,7 +98,7 @@ asyncTest( "{ animate: Number }", function() { var element = $( "#list1" ).accordion({ animate: 100 }), - panels = element.find( ".ui-accordion-content" ); + panels = element.find( ".ui-accordion-content" ), animate = $.fn.animate; // called twice (both panels) $.fn.animate = function( props, duration, easing ) { @@ -120,10 +120,10 @@ asyncTest( "{ animate: Number }", function() { asyncTest( "{ animate: String }", function() { expect( 7 ); var element = $( "#list1" ).accordion({ - animate: "linear" - }), - panels = element.find( ".ui-accordion-content" ); - animate = $.fn.animate; + 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" ); @@ -144,10 +144,10 @@ asyncTest( "{ animate: String }", function() { asyncTest( "{ animate: {} }", function() { expect( 7 ); var element = $( "#list1" ).accordion({ - animate: {} - }), - panels = element.find( ".ui-accordion-content" ); - animate = $.fn.animate; + 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" ); @@ -168,10 +168,10 @@ asyncTest( "{ animate: {} }", function() { 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; + 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" ); @@ -192,11 +192,11 @@ asyncTest( "{ animate: { duration, easing } }", function() { 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; + 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" ); @@ -217,17 +217,17 @@ asyncTest( "{ animate: { duration, easing } }, animate down", function() { asyncTest( "{ animate: { duration, easing, down } }, animate down", function() { expect( 7 ); var element = $( "#list1" ).accordion({ - active: 1, - animate: { - duration: 100, - easing: "linear", - down: { - easing: "swing" + active: 1, + animate: { + duration: 100, + easing: "linear", + down: { + easing: "swing" + } } - } - }), - panels = element.find( ".ui-accordion-content" ); - animate = $.fn.animate; + }), + panels = element.find( ".ui-accordion-content" ), + animate = $.fn.animate; // called twice (both panels) $.fn.animate = function( props, duration, easing ) { equal( duration, 100, "correct duration" ); @@ -360,10 +360,10 @@ test( "{ heightStyle: 'auto' }", function() { test( "{ heightStyle: 'content' }", function() { expect( 3 ); - var element = $( "#navigation" ).accordion({ heightStyle: "content" }); - var sizes = element.find( ".ui-accordion-content" ).map(function() { - return $( this ).height(); - }).get(); + var element = $( "#navigation" ).accordion({ heightStyle: "content" }), + sizes = element.find( ".ui-accordion-content" ).map(function() { + return $( this ).height(); + }).get(); ok( sizes[ 0 ] >= 70 && sizes[ 0 ] <= 105, "was " + sizes[ 0 ] ); ok( sizes[ 1 ] >= 98 && sizes[ 1 ] <= 126, "was " + sizes[ 1 ] ); ok( sizes[ 2 ] >= 42 && sizes[ 2 ] <= 54, "was " + sizes[ 2 ] ); diff --git a/tests/unit/accordion/accordion_test_helpers.js b/tests/unit/accordion/accordion_test_helpers.js index 542809ea0..889608fba 100644 --- a/tests/unit/accordion/accordion_test_helpers.js +++ b/tests/unit/accordion/accordion_test_helpers.js @@ -1,6 +1,6 @@ function accordion_state( accordion ) { - var expected = $.makeArray( arguments ).slice( 1 ); - var actual = accordion.find( ".ui-accordion-content" ).map(function() { + var expected = $.makeArray( arguments ).slice( 1 ), + actual = accordion.find( ".ui-accordion-content" ).map(function() { return $( this ).css( "display" ) === "none" ? 0 : 1; }).get(); QUnit.push( QUnit.equiv(actual, expected), actual, expected ); diff --git a/tests/unit/autocomplete/autocomplete_events.js b/tests/unit/autocomplete/autocomplete_events.js index 1c7ff7462..082263a35 100644 --- a/tests/unit/autocomplete/autocomplete_events.js +++ b/tests/unit/autocomplete/autocomplete_events.js @@ -123,7 +123,7 @@ asyncTest( "cancel search", function() { asyncTest( "cancel focus", function() { expect( 1 ); - var customVal = "custom value"; + var customVal = "custom value", element = $( "#autocomplete" ).autocomplete({ delay: 0, source: data, diff --git a/tests/unit/button/button_core.js b/tests/unit/button/button_core.js index c110b4311..0d93ecedf 100644 --- a/tests/unit/button/button_core.js +++ b/tests/unit/button/button_core.js @@ -8,7 +8,7 @@ module("button: core"); test("checkbox", function() { - var input = $("#check"); + var input = $("#check"), label = $("label[for=check]"); ok( input.is(":visible") ); ok( label.is(":not(.ui-button)") ); @@ -18,7 +18,7 @@ test("checkbox", function() { }); test("radios", function() { - var inputs = $("#radio0 input"); + var inputs = $("#radio0 input"), labels = $("#radio0 label"); ok( inputs.is(":visible") ); ok( labels.is(":not(.ui-button)") ); @@ -51,7 +51,7 @@ test("radio groups", function() { }); test("input type submit, don't create child elements", function() { - var input = $("#submit") + var input = $("#submit"); deepEqual( input.children().length, 0 ); input.button(); deepEqual( input.children().length, 0 ); @@ -68,11 +68,12 @@ test("buttonset", function() { }); test("buttonset (rtl)", function() { - var parent = $("#radio1").parent(); + var set, + parent = $("#radio1").parent(); // Set to rtl parent.attr("dir", "rtl"); - var set = $("#radio1").buttonset(); + set = $("#radio1").buttonset(); ok( set.is(".ui-buttonset") ); deepEqual( set.children(".ui-button").length, 3 ); deepEqual( set.children("input:radio.ui-helper-hidden-accessible").length, 3 ); diff --git a/tests/unit/button/button_methods.js b/tests/unit/button/button_methods.js index a83a73ba4..347806d4e 100644 --- a/tests/unit/button/button_methods.js +++ b/tests/unit/button/button_methods.js @@ -7,8 +7,8 @@ module("button: methods"); test("destroy", function() { - var beforeHtml = $("#button").parent().html(); - var afterHtml = $("#button").button().button("destroy").parent().html(); + var beforeHtml = $("#button").parent().html(), + afterHtml = $("#button").button().button("destroy").parent().html(); // Opera 9 outputs role="" instead of removing the attribute like everyone else if ($.browser.opera) { afterHtml = afterHtml.replace(/ role=""/g, ""); |