aboutsummaryrefslogtreecommitdiffstats
path: root/tests/unit/accordion
diff options
context:
space:
mode:
authorScott González <scott.gonzalez@gmail.com>2012-04-19 10:50:09 -0400
committerScott González <scott.gonzalez@gmail.com>2012-04-19 10:50:09 -0400
commitaf1b4d859d9563e43896d76086e1e9ebbb3ab74b (patch)
tree96c044ea80d1d5ec7badb27f9a47699b79be8afe /tests/unit/accordion
parent72a0f5c5129b77c6e06c9936d290e89bd35a9eaa (diff)
downloadjquery-ui-af1b4d859d9563e43896d76086e1e9ebbb3ab74b.tar.gz
jquery-ui-af1b4d859d9563e43896d76086e1e9ebbb3ab74b.zip
Tests: Lint.
Diffstat (limited to 'tests/unit/accordion')
-rw-r--r--tests/unit/accordion/accordion_core.js14
-rw-r--r--tests/unit/accordion/accordion_deprecated.js28
-rw-r--r--tests/unit/accordion/accordion_events.js20
-rw-r--r--tests/unit/accordion/accordion_options.js66
-rw-r--r--tests/unit/accordion/accordion_test_helpers.js4
5 files changed, 66 insertions, 66 deletions
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 );