4 * Hyunjung Kim <hjnim.kim@samsung.com>
7 $( "#checkpage" ).live( "pageinit", function( event ){
11 var unit_check = function ( widget, type ) {
15 classPrefix = "ui-checkbox";
17 widget.checkboxradio();
18 checkbox = widget.parent();
19 ok( checkbox.hasClass(classPrefix) , "Create - Checkbox" );
21 checkClass = classPrefix + "-on";
22 if( !widget.is(":checked") ){
23 checkClass = classPrefix + "-off";
25 if( widget.hasClass( "favorite" )){
26 ok( checkbox.hasClass( "favorite" ), "Style - Favorite" );
29 // Text Trim, Cause jQueryMobile(JQM) 1.1 forced to add - "\u00a0" in buttonIcon(ButtonMarkup)
30 // JQM 1.1 buttonMarkup code :
31 // - if( buttonIcon ) buttonIcon.appendChild( document.createTextNode( "\u00a0" ) );
32 label = checkbox.children().last();
33 equal ( label.text().trim(), type, "label, type string must be same" );
35 label.trigger( "vclick" );
36 if( !widget.is( ":disabled" ) ) {
37 checkClass = classPrefix + "-on";
38 ok( label.hasClass( checkClass ) , "Click - Normal Checkbox On" );
40 checkClass = classPrefix + "-off";
41 label.trigger( "vclick" );
42 ok( label.hasClass( checkClass ) , "Click - Normal Checkbox Off" );
44 ok( label.hasClass( checkClass ) , "Click - Disable Checkbox" );
48 test( "checkbox - Normal" , function () {
49 unit_check( $( "#checkbox-1" ), "Normal" );
52 test( "checkbox - Checked, Disabled" , function () {
53 unit_check( $( "#checkbox-2" ), "Checked, Disabled" );
56 test( "checkbox - Disabled" , function () {
57 unit_check( $( "#checkbox-3" ), "Disabled" );
60 test( "Favorite - Favorite" , function () {
61 unit_check( $( "#checkbox-4" ), "Favorite" );
64 test( "Favorite - Favorite Checked, Disabled" , function () {
65 unit_check( $( "#checkbox-5" ), "Favorite Checked, Disabled" );
68 test( "Favorite - Favorite, Disabled" , function () {
69 unit_check( $( "#checkbox-6" ), "Favorite, Disabled" );