@@ -20,7 +20,7 @@ test( "panel ids", function() {
20
20
element . tabs ( "option" , "active" , 2 ) ;
21
21
} ) ;
22
22
23
- module ( "tabs (deprecated): options" ) ;
23
+ module ( "tabs (deprecated): options" ) ;
24
24
25
25
test ( 'ajaxOptions' , function ( ) {
26
26
ok ( false , "missing test - untested code is broken code." ) ;
@@ -30,16 +30,45 @@ test('cache', function() {
30
30
ok ( false , "missing test - untested code is broken code." ) ;
31
31
} ) ;
32
32
33
- test ( 'idPrefix' , function ( ) {
34
- ok ( false , "missing test - untested code is broken code." ) ;
33
+ test ( "idPrefix" , function ( ) {
34
+ expect ( 1 ) ;
35
+
36
+ $ ( "#tabs2" )
37
+ . one ( "tabsbeforeload" , function ( event , ui ) {
38
+ ok ( / ^ t e s t i n g - \d + $ / . test ( ui . panel . attr ( "id" ) ) , "generated id" ) ;
39
+ event . preventDefault ( ) ;
40
+ } )
41
+ . tabs ( {
42
+ idPrefix : "testing-" ,
43
+ active : 2
44
+ } ) ;
35
45
} ) ;
36
46
37
- test ( ' tabTemplate' , function ( ) {
38
- ok ( false , "missing test - untested code is broken code." ) ;
39
- } ) ;
47
+ test ( " tabTemplate + panelTemplate" , function ( ) {
48
+ // defaults are tested in the add method test
49
+ expect ( 11 ) ;
40
50
41
- test ( 'panelTemplate' , function ( ) {
42
- ok ( false , "missing test - untested code is broken code." ) ;
51
+ var element = $ ( "#tabs2" ) . tabs ( {
52
+ tabTemplate : "<li class='customTab'><a href='http://example.com/#{href}'>#{label}</a></li>" ,
53
+ panelTemplate : "<div class='customPanel'></div>"
54
+ } ) ;
55
+ element . one ( "tabsadd" , function ( event , ui ) {
56
+ var anchor = $ ( ui . tab ) ;
57
+ equal ( ui . index , 5 , "ui.index" ) ;
58
+ equal ( anchor . text ( ) , "New" , "ui.tab" ) ;
59
+ equal ( anchor . attr ( "href" ) , "http://example.com/#new" , "tab href" ) ;
60
+ ok ( anchor . parent ( ) . hasClass ( "customTab" ) , "tab custom class" ) ;
61
+ equal ( ui . panel . id , "new" , "ui.panel" ) ;
62
+ ok ( $ ( ui . panel ) . hasClass ( "customPanel" ) , "panel custom class" ) ;
63
+ } ) ;
64
+ element . tabs ( "add" , "#new" , "New" ) ;
65
+ var tab = element . find ( ".ui-tabs-nav li" ) . last ( ) ,
66
+ anchor = tab . find ( "a" ) ;
67
+ equals ( tab . text ( ) , "New" , "label" ) ;
68
+ ok ( tab . hasClass ( "customTab" ) , "tab custom class" ) ;
69
+ equals ( anchor . attr ( "href" ) , "http://example.com/#new" , "href" ) ;
70
+ equals ( anchor . attr ( "aria-controls" ) , "new" , "aria-controls" ) ;
71
+ ok ( element . find ( "#new" ) . hasClass ( "customPanel" ) , "panel custom class" ) ;
43
72
} ) ;
44
73
45
74
test ( 'cookie' , function ( ) {
0 commit comments