|
1 |
| -/* |
2 |
| - * tabs_methods.js |
3 |
| - */ |
4 |
| -(function($) { |
| 1 | +(function( $ ) { |
5 | 2 |
|
6 |
| -module("tabs: methods"); |
7 |
| - |
8 |
| -test('init', function() { |
9 |
| - expect(9); |
10 |
| - |
11 |
| - el = $('#tabs1').tabs(); |
12 |
| - |
13 |
| - ok(true, '.tabs() called on element'); |
14 |
| - ok( el.is('.ui-tabs.ui-widget.ui-widget-content.ui-corner-all'), 'attach classes to container'); |
15 |
| - ok( $('ul', el).is('.ui-tabs-nav.ui-helper-reset.ui-helper-clearfix.ui-widget-header.ui-corner-all'), 'attach classes to list' ); |
16 |
| - ok( $('div:eq(0)', el).is('.ui-tabs-panel.ui-widget-content.ui-corner-bottom'), 'attach classes to panel' ); |
17 |
| - ok( $('li:eq(0)', el).is('.ui-tabs-active.ui-state-active.ui-corner-top'), 'attach classes to active li'); |
18 |
| - ok( $('li:eq(1)', el).is('.ui-state-default.ui-corner-top'), 'attach classes to inactive li'); |
19 |
| - equals( el.tabs('option', 'active'), 0, 'active option set' ); |
20 |
| - equals( $('li', el).index( $('li.ui-tabs-active', el) ), 0, 'second tab active'); |
21 |
| - equals( $('div', el).index( $('div:hidden', '#tabs1') ), 1, 'second panel should be hidden' ); |
22 |
| -}); |
23 |
| - |
24 |
| -test('init with hash', function() { |
25 |
| - expect(5); |
26 |
| - |
27 |
| - //set a hash in the url |
28 |
| - location.hash = '#fragment-2'; |
29 |
| - |
30 |
| - //selection of tab with divs ordered differently than list |
31 |
| - el = $('#tabs1').tabs(); |
32 |
| - |
33 |
| - equals(el.tabs('option', 'active'), 1, 'second tab should be active'); |
34 |
| - |
35 |
| - ok(!$('#tabs1 ul li:eq(0)').is('.ui-tabs-active.ui-state-active'), 'first tab should not be selected nor active'); |
36 |
| - ok($('#tabs1 div:eq(0)').is(':hidden'), 'first div for first tab should be hidden'); |
37 |
| - |
38 |
| - ok($('#tabs1 ul li:eq(1)').is('.ui-tabs-active.ui-state-active'), 'second tab should be selected and active'); |
39 |
| - ok(!$('#tabs1 div:eq(1)').is(':hidden'), 'second div for second tab should not be hidden'); |
40 |
| -}); |
41 |
| - |
42 |
| -test('init mismatched order with hash', function() { |
43 |
| - expect(5); |
44 |
| - |
45 |
| - //set a hash in the url |
46 |
| - location.hash = '#tabs7-2'; |
47 |
| - |
48 |
| - //selection of tab with divs ordered differently than list |
49 |
| - el = $('#tabs7').tabs(); |
50 |
| - |
51 |
| - equals(el.tabs('option', 'active'), 1, 'second tab should be active'); |
52 |
| - |
53 |
| - ok(!$('#tabs7-list li:eq(0)').is('.ui-tabs-active.ui-state-active'), 'first tab should not be selected nor active'); |
54 |
| - ok($('#tabs7 div:eq(1)').is(':hidden'), 'second div for first tab should be hidden'); |
55 |
| - |
56 |
| - ok($('#tabs7-list li:eq(1)').is('.ui-tabs-active.ui-state-active'), 'second tab should be selected and active'); |
57 |
| - ok(!$('#tabs7 div:eq(0)').is(':hidden'), 'first div for second tab should not be hidden'); |
58 |
| -}); |
| 3 | +module( "tabs: methods" ); |
59 | 4 |
|
60 | 5 | test('destroy', function() {
|
61 | 6 | expect(6);
|
@@ -162,4 +107,4 @@ test('load', function() {
|
162 | 107 | ok(false, "missing test - untested code is broken code.");
|
163 | 108 | });
|
164 | 109 |
|
165 |
| -})(jQuery); |
| 110 | +}( jQuery ) ); |
0 commit comments