2 * controlbar unit tests
6 $.mobile.defaultTransition = "none";
8 module( "Controlbar" );
10 var unit_controlbar = function ( widget, type, drayStyle ) {
17 created_controlbar = widget.controlbar();
20 ok( created_controlbar, "Create" );
22 /* Check Parameters */
23 equal( type, created_controlbar.jqmData("style"), "Parameter: data-style" );
26 if ( drayStyle == "icon" ) {
27 equal( created_controlbar.find( "a" ).is(".ui-btn-icon_only" ), true, "Icon only style test");
28 } else if ( drayStyle == "text" ) {
29 equal( created_controlbar.is(".ui-navbar-noicons" ), true, "Text only style test");
34 activeIndex = created_controlbar.find(".ui-btn-active").index();
35 created_controlbar.controlbar( "disable", activeIndex );
36 deactiveReturn = created_controlbar.find("li:eq(" + activeIndex + ")").is(".ui-disabled");
38 equal( deactiveReturn, true, "List Deactive test" );
40 created_controlbar.controlbar("enable", activeIndex);
41 activeReturn = created_controlbar.find("li:eq(" + activeIndex + ")").is(".ui-disabled");
42 equal( activeReturn, false, "List Active test" );
45 test( "controlbar normal style test -> tabbar", function () {
46 unit_controlbar( $("#controlbar-tabbar-test"), "tabbar" );
49 test( "controlbar icon style test -> tabbar", function () {
50 unit_controlbar( $("#controlbar-tabbar-test-icon-only"), "tabbar", "icon" );
53 test( "controlbar text style test -> tabbar", function () {
54 unit_controlbar( $("#controlbar-tabbar-test-text-only"), "tabbar", "text" );
57 test( "controlbar normal style test -> toolbar", function () {
58 unit_controlbar( $("#controlbar-toolbar-test"), "toolbar" );
61 test( "controlbar icon style test -> toolbar", function () {
62 unit_controlbar( $("#controlbar-toolbar-test-icon-only"), "toolbar", "icon" );
65 test( "controlbar text style test -> tabbar", function () {
66 unit_controlbar( $("#controlbar-toolbar-test-text-only"), "toolbar", "text" );