4 /*jslint browser: true*/
5 /*global $, jQuery, test, equal, ok*/
7 $.mobile.defaultTransition = "none";
11 var unit_tabbar = function ( widget, drayStyle ) {
22 created_tabbar = widget.tabbar( );
25 ok( created_tabbar, "Create" );
26 equal( widget.find( "a" ).length, drayStyle.icon.length, "Markup check icons" ) ;
28 if ( drayStyle.icon ) {
29 for ( index = 0; index < drayStyle.icon.length; index++ ) {
30 equal( widget.find( "a" )[index].getAttribute("data-icon" ), drayStyle.icon[index], "Icon check" );
31 equal( widget.find( "a span.ui-btn-text" )[index].innerHTML, drayStyle.text[index], "Text check" );
37 ww = window.innerWidth || $( window ).width( ) ;
38 wh = window.innerHeight || $( window ).height( );
39 isLandscape = ww > wh && ( ww - wh );
42 equal( widget.hasClass( "ui-landscape-tabbar" ), true, "Markup check layout" );
44 equal( widget.hasClass( "ui-portrait-tabbar" ), true, "Markup check layout" );
49 activeIndex = created_tabbar.find(".ui-btn-active" ).index( );
50 created_tabbar.tabbar( "disable", activeIndex );
51 deactiveReturn = created_tabbar.find("li:eq(" + activeIndex + " )" ).is(".ui-disabled" );
53 equal( deactiveReturn, true, "List Deactive test" );
55 created_tabbar.tabbar("enable", activeIndex );
56 activeReturn = created_tabbar.find("li:eq(" + activeIndex + " )" ).is(".ui-disabled" );
57 equal( activeReturn, false, "List Active test" );
60 test( "tabbar text style test - footer", function ( ) {
61 unit_tabbar( $("#tabbar-test-text-only" ), {icon : ['delete', 'forward', 'plus', 'back', 'search'], text : ["Menu", "Save", "Share", "Timeline", "WorldClock"]} );
64 test( "tabbar text style test - header", function ( ) {
65 unit_tabbar( $("#tabbar-test-text-only-header" ), {icon : ['delete', 'forward', 'plus', 'back', 'search'], text : ["Menu", "Save", "Share", "Timeline", "WorldClock"]} );
68 test( "tabbar text style test - footer - Dynamic", function ( ) {
70 $('#abbar-test-text-only').remove( );
71 var VirtualMarkup = '<div id= "tabbar-test-text-only" data-role= "tabbar">' +
73 '<li><a href= "#" data-icon= "delete">Menu</a></li>' +
74 '<li><a href= "#" class= "ui-btn-active" data-icon= "forward">Save</a></li>' +
75 '<li><a href= "#" data-icon= "plus">Share</a></li>' +
76 '<li><a href= "#" data-icon= "Back">Timeline</a></li>' +
77 '<li><a href= "#" data-icon= "search"WorldClock</a></li>' +
80 $('#tabbarfooter').append( VirtualMarkup ).trigger("create" );
81 unit_tabbar( $("#tabbar-test-text-only" ), {icon : ['delete', 'forward', 'plus', 'back', 'search'], text : ["Menu", "Save", "Share", "Timeline", "WorldClock"]} );
84 test( "tabbar text style test- header - Dynamic", function ( ) {
86 $('#abbar-test-text-only-header').remove( );
87 var VirtualMarkup = '<div id= "tabbar-test-text-only-header" data-role= "tabbar">' +
89 '<li><a href= "#" data-icon= "delete">Menu</a></li>' +
90 '<li><a href= "#" class= "ui-btn-active" data-icon= "forward">Save</a></li>' +
91 '<li><a href= "#" data-icon= "plus">Share</a></li>' +
92 '<li><a href= "#" data-icon= "Back">Timeline</a></li>' +
93 '<li><a href= "#" data-icon= "search"WorldClock</a></li>' +
96 $('#tabbarheader').append( VirtualMarkup ).trigger("create" );
97 unit_tabbar( $("#tabbar-test-text-only-header" ), {icon : ['delete', 'forward', 'plus', 'back', 'search'], text : ["Menu", "Save", "Share", "Timeline", "WorldClock"]} );