Skip to content

Commit 9cf884e

Browse files
gseguinscottjehl
authored andcommitted
Coding standards
1 parent 7a14f2e commit 9cf884e

File tree

1 file changed

+47
-47
lines changed

1 file changed

+47
-47
lines changed

tests/unit/checkboxradio/checkboxradio_core.js

Lines changed: 47 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -2,87 +2,87 @@
22
* mobile checkboxradio unit tests
33
*/
44
(function($){
5-
module('jquery.mobile.forms.checkboxradio.js');
5+
module( 'jquery.mobile.forms.checkboxradio.js' );
66

77
test( "widget can be disabled and enabled", function(){
8-
var input = $("#checkbox-1");
9-
var button = input.parent().find(".ui-btn");
10-
11-
input.checkboxradio("disable");
12-
input.checkboxradio("enable");
13-
ok(!input.attr("disabled"), "start input as enabled");
14-
ok(!input.parent().hasClass("ui-disabled"), "no disabled styles");
15-
ok(!input.attr("checked"), "not checked before click");
16-
button.trigger("click");
17-
ok(input.attr("checked"), "checked after click");
18-
ok(button.hasClass("ui-checkbox-on"), "active styles after click");
19-
button.trigger("click");
20-
21-
input.checkboxradio("disable");
22-
ok(input.attr("disabled"), "input disabled");
23-
ok(input.parent().hasClass("ui-disabled"), "disabled styles");
24-
ok(!input.attr("checked"), "not checked before click");
25-
button.trigger("click");
26-
ok(!input.attr("checked"), "not checked after click");
27-
ok(!button.hasClass("ui-checkbox-on"), "no active styles after click");
8+
var input = $( "#checkbox-1" ),
9+
button = input.parent().find( ".ui-btn" );
10+
11+
input.checkboxradio( "disable" );
12+
input.checkboxradio( "enable" );
13+
ok( !input.attr( "disabled" ), "start input as enabled" );
14+
ok( !input.parent().hasClass( "ui-disabled" ), "no disabled styles" );
15+
ok( !input.attr( "checked" ), "not checked before click" );
16+
button.trigger( "click" );
17+
ok( input.attr( "checked" ), "checked after click" );
18+
ok( button.hasClass( "ui-checkbox-on" ), "active styles after click" );
19+
button.trigger( "click" );
20+
21+
input.checkboxradio( "disable" );
22+
ok( input.attr( "disabled" ), "input disabled" );
23+
ok( input.parent().hasClass( "ui-disabled" ), "disabled styles" );
24+
ok( !input.attr( "checked" ), "not checked before click" );
25+
button.trigger( "click" );
26+
ok( !input.attr( "checked" ), "not checked after click" );
27+
ok( !button.hasClass( "ui-checkbox-on" ), "no active styles after click" );
2828
});
2929

3030
asyncTest( "change events fired on checkbox for both check and uncheck", function(){
31-
var $checkbox = $("#checkbox-2"),
32-
$checkboxLabel = $checkbox.parent().find(".ui-btn");
31+
var $checkbox = $( "#checkbox-2" ),
32+
$checkboxLabel = $checkbox.parent().find( ".ui-btn" );
3333

34-
$checkbox.unbind("change");
34+
$checkbox.unbind( "change" );
3535

3636
expect( 2 );
3737

3838
$checkbox.change(function(){
39-
ok(true, "change fired on click to check the box");
39+
ok( true, "change fired on click to check the box" );
4040
});
4141

42-
$checkboxLabel.trigger("click");
42+
$checkboxLabel.trigger( "click" );
4343

4444
//test above will be triggered twice, and the start here once
45-
$checkbox.change(function(){
45+
$checkbox.change( function(){
4646
start();
4747
});
4848

49-
$checkboxLabel.trigger("click");
49+
$checkboxLabel.trigger( "click" );
5050
});
5151

5252
asyncTest( "radio button labels should update the active button class to last clicked and clear checked", function(){
53-
var $radioBtns = $('#radio-active-btn-test input'),
54-
singleActiveAndChecked = function(){
55-
same($("#radio-active-btn-test .ui-radio-on").length, 1, "there should be only one active button");
56-
same($("#radio-active-btn-test :checked").length, 1, "there should be only one checked");
57-
};
53+
var $radioBtns = $( '#radio-active-btn-test input' ),
54+
singleActiveAndChecked = function(){
55+
same( $( "#radio-active-btn-test .ui-radio-on" ).length, 1, "there should be only one active button" );
56+
same( $( "#radio-active-btn-test :checked" ).length, 1, "there should be only one checked" );
57+
};
5858

5959
$.testHelper.sequence([
6060
function(){
61-
$radioBtns.last().siblings('label').click();
61+
$radioBtns.last().siblings( 'label' ).click();
6262
},
6363

6464
function(){
65-
ok($radioBtns.last().attr('checked'));
66-
ok($radioBtns.last().siblings('label').hasClass('ui-radio-on'),
67-
"last input label is an active button");
65+
ok( $radioBtns.last().attr( 'checked' ) );
66+
ok( $radioBtns.last().siblings( 'label' ).hasClass( 'ui-radio-on' ),
67+
"last input label is an active button" );
6868

69-
ok(!$radioBtns.first().attr('checked'));
70-
ok(!$radioBtns.first().siblings('label').hasClass('ui-radio-on'),
71-
"first input label is not active");
69+
ok( !$radioBtns.first().attr( 'checked' ) );
70+
ok( !$radioBtns.first().siblings( 'label' ).hasClass( 'ui-radio-on' ),
71+
"first input label is not active" );
7272

7373
singleActiveAndChecked();
7474

75-
$radioBtns.first().siblings('label').click();
75+
$radioBtns.first().siblings( 'label' ).click();
7676
},
7777

7878
function(){
79-
ok($radioBtns.first().attr('checked'));
80-
ok($radioBtns.first().siblings('label').hasClass('ui-radio-on'),
81-
"first input label is an active button");
79+
ok( $radioBtns.first().attr( 'checked' ));
80+
ok( $radioBtns.first().siblings( 'label' ).hasClass( 'ui-radio-on' ),
81+
"first input label is an active button" );
8282

83-
ok(!$radioBtns.last().attr('checked'));
84-
ok(!$radioBtns.last().siblings('label').hasClass('ui-radio-on'),
85-
"last input label is not active");
83+
ok( !$radioBtns.last().attr( 'checked' ));
84+
ok( !$radioBtns.last().siblings( 'label' ).hasClass( 'ui-radio-on' ),
85+
"last input label is not active" );
8686

8787
singleActiveAndChecked();
8888

0 commit comments

Comments
 (0)