From 9cf884eabb1e84d9bde024f92dd2f27694aa53ff Mon Sep 17 00:00:00 2001 From: Ghislain Seguin Date: Fri, 24 Jun 2011 09:18:24 -0700 Subject: [PATCH] Coding standards --- .../unit/checkboxradio/checkboxradio_core.js | 90 +++++++++---------- 1 file changed, 45 insertions(+), 45 deletions(-) diff --git a/tests/unit/checkboxradio/checkboxradio_core.js b/tests/unit/checkboxradio/checkboxradio_core.js index a4f1f2a6..cc8e09a4 100644 --- a/tests/unit/checkboxradio/checkboxradio_core.js +++ b/tests/unit/checkboxradio/checkboxradio_core.js @@ -2,87 +2,87 @@ * mobile checkboxradio unit tests */ (function($){ - module('jquery.mobile.forms.checkboxradio.js'); + module( 'jquery.mobile.forms.checkboxradio.js' ); test( "widget can be disabled and enabled", function(){ - var input = $("#checkbox-1"); - var button = input.parent().find(".ui-btn"); + var input = $( "#checkbox-1" ), + button = input.parent().find( ".ui-btn" ); - input.checkboxradio("disable"); - input.checkboxradio("enable"); - ok(!input.attr("disabled"), "start input as enabled"); - ok(!input.parent().hasClass("ui-disabled"), "no disabled styles"); - ok(!input.attr("checked"), "not checked before click"); - button.trigger("click"); - ok(input.attr("checked"), "checked after click"); - ok(button.hasClass("ui-checkbox-on"), "active styles after click"); - button.trigger("click"); + input.checkboxradio( "disable" ); + input.checkboxradio( "enable" ); + ok( !input.attr( "disabled" ), "start input as enabled" ); + ok( !input.parent().hasClass( "ui-disabled" ), "no disabled styles" ); + ok( !input.attr( "checked" ), "not checked before click" ); + button.trigger( "click" ); + ok( input.attr( "checked" ), "checked after click" ); + ok( button.hasClass( "ui-checkbox-on" ), "active styles after click" ); + button.trigger( "click" ); - input.checkboxradio("disable"); - ok(input.attr("disabled"), "input disabled"); - ok(input.parent().hasClass("ui-disabled"), "disabled styles"); - ok(!input.attr("checked"), "not checked before click"); - button.trigger("click"); - ok(!input.attr("checked"), "not checked after click"); - ok(!button.hasClass("ui-checkbox-on"), "no active styles after click"); + input.checkboxradio( "disable" ); + ok( input.attr( "disabled" ), "input disabled" ); + ok( input.parent().hasClass( "ui-disabled" ), "disabled styles" ); + ok( !input.attr( "checked" ), "not checked before click" ); + button.trigger( "click" ); + ok( !input.attr( "checked" ), "not checked after click" ); + ok( !button.hasClass( "ui-checkbox-on" ), "no active styles after click" ); }); asyncTest( "change events fired on checkbox for both check and uncheck", function(){ - var $checkbox = $("#checkbox-2"), - $checkboxLabel = $checkbox.parent().find(".ui-btn"); + var $checkbox = $( "#checkbox-2" ), + $checkboxLabel = $checkbox.parent().find( ".ui-btn" ); - $checkbox.unbind("change"); + $checkbox.unbind( "change" ); expect( 2 ); $checkbox.change(function(){ - ok(true, "change fired on click to check the box"); + ok( true, "change fired on click to check the box" ); }); - $checkboxLabel.trigger("click"); + $checkboxLabel.trigger( "click" ); //test above will be triggered twice, and the start here once - $checkbox.change(function(){ + $checkbox.change( function(){ start(); }); - $checkboxLabel.trigger("click"); + $checkboxLabel.trigger( "click" ); }); asyncTest( "radio button labels should update the active button class to last clicked and clear checked", function(){ - var $radioBtns = $('#radio-active-btn-test input'), - singleActiveAndChecked = function(){ - same($("#radio-active-btn-test .ui-radio-on").length, 1, "there should be only one active button"); - same($("#radio-active-btn-test :checked").length, 1, "there should be only one checked"); - }; + var $radioBtns = $( '#radio-active-btn-test input' ), + singleActiveAndChecked = function(){ + same( $( "#radio-active-btn-test .ui-radio-on" ).length, 1, "there should be only one active button" ); + same( $( "#radio-active-btn-test :checked" ).length, 1, "there should be only one checked" ); + }; $.testHelper.sequence([ function(){ - $radioBtns.last().siblings('label').click(); + $radioBtns.last().siblings( 'label' ).click(); }, function(){ - ok($radioBtns.last().attr('checked')); - ok($radioBtns.last().siblings('label').hasClass('ui-radio-on'), - "last input label is an active button"); + ok( $radioBtns.last().attr( 'checked' ) ); + ok( $radioBtns.last().siblings( 'label' ).hasClass( 'ui-radio-on' ), + "last input label is an active button" ); - ok(!$radioBtns.first().attr('checked')); - ok(!$radioBtns.first().siblings('label').hasClass('ui-radio-on'), - "first input label is not active"); + ok( !$radioBtns.first().attr( 'checked' ) ); + ok( !$radioBtns.first().siblings( 'label' ).hasClass( 'ui-radio-on' ), + "first input label is not active" ); singleActiveAndChecked(); - $radioBtns.first().siblings('label').click(); + $radioBtns.first().siblings( 'label' ).click(); }, function(){ - ok($radioBtns.first().attr('checked')); - ok($radioBtns.first().siblings('label').hasClass('ui-radio-on'), - "first input label is an active button"); + ok( $radioBtns.first().attr( 'checked' )); + ok( $radioBtns.first().siblings( 'label' ).hasClass( 'ui-radio-on' ), + "first input label is an active button" ); - ok(!$radioBtns.last().attr('checked')); - ok(!$radioBtns.last().siblings('label').hasClass('ui-radio-on'), - "last input label is not active"); + ok( !$radioBtns.last().attr( 'checked' )); + ok( !$radioBtns.last().siblings( 'label' ).hasClass( 'ui-radio-on' ), + "last input label is not active" ); singleActiveAndChecked();