1 | /*
|
---|
2 | * tabs_options.js
|
---|
3 | */
|
---|
4 | (function($) {
|
---|
5 |
|
---|
6 | module("tabs: options");
|
---|
7 |
|
---|
8 | test('ajaxOptions', function() {
|
---|
9 | ok(false, "missing test - untested code is broken code.");
|
---|
10 | });
|
---|
11 |
|
---|
12 | test('cache', function() {
|
---|
13 | ok(false, "missing test - untested code is broken code.");
|
---|
14 | });
|
---|
15 |
|
---|
16 | test('collapsible', function() {
|
---|
17 | expect(4);
|
---|
18 |
|
---|
19 | el = $('#tabs1');
|
---|
20 |
|
---|
21 | el.tabs({ collapsible: true });
|
---|
22 | equals(el.tabs('option', 'collapsible'), true, 'option set');
|
---|
23 | ok(el.is('.ui-tabs-collapsible'), 'extra class "ui-tabs-collapsible" attached');
|
---|
24 | el.tabs('select', 0);
|
---|
25 | equals($('div.ui-tabs-hide', '#tabs1').length, 3, 'all panels should be hidden');
|
---|
26 | el.tabs('option', 'collapsible', false);
|
---|
27 | ok(el.is(':not(.ui-tabs-collapsible)'), 'extra class "ui-tabs-collapsible" not attached');
|
---|
28 |
|
---|
29 | });
|
---|
30 |
|
---|
31 | test('cookie', function() {
|
---|
32 | expect(6);
|
---|
33 |
|
---|
34 | el = $('#tabs1');
|
---|
35 | var cookieName = 'tabs_test', cookieObj = { name: cookieName };
|
---|
36 | $.cookie(cookieName, null); // blank state
|
---|
37 | var cookie = function() {
|
---|
38 | return parseInt($.cookie(cookieName), 10);
|
---|
39 | };
|
---|
40 |
|
---|
41 | el.tabs({ cookie: cookieObj });
|
---|
42 | equals(cookie(), 0, 'initial cookie value');
|
---|
43 |
|
---|
44 | el.tabs('destroy');
|
---|
45 | el.tabs({ selected: 1, cookie: cookieObj });
|
---|
46 | equals(cookie(), 1, 'initial cookie value, from selected property');
|
---|
47 |
|
---|
48 | el.tabs('select', 2);
|
---|
49 | equals(cookie(), 2, 'cookie value updated after select');
|
---|
50 |
|
---|
51 | el.tabs('destroy');
|
---|
52 | $.cookie(cookieName, 1);
|
---|
53 | el.tabs({ cookie: cookieObj });
|
---|
54 | equals(cookie(), 1, 'initial cookie value, from existing cookie');
|
---|
55 |
|
---|
56 | el.tabs('destroy');
|
---|
57 | el.tabs({ cookie: cookieObj, collapsible: true });
|
---|
58 | el.tabs('select', 0);
|
---|
59 | equals(cookie(), -1, 'cookie value for all tabs unselected');
|
---|
60 |
|
---|
61 | el.tabs('destroy');
|
---|
62 | ok($.cookie(cookieName) === null, 'erase cookie after destroy');
|
---|
63 |
|
---|
64 | });
|
---|
65 |
|
---|
66 | test('disabled', function() {
|
---|
67 | ok(false, "missing test - untested code is broken code.");
|
---|
68 | });
|
---|
69 |
|
---|
70 | test('event', function() {
|
---|
71 | ok(false, "missing test - untested code is broken code.");
|
---|
72 | });
|
---|
73 |
|
---|
74 | test('fx', function() {
|
---|
75 | ok(false, "missing test - untested code is broken code.");
|
---|
76 | });
|
---|
77 |
|
---|
78 | test('idPrefix', function() {
|
---|
79 | ok(false, "missing test - untested code is broken code.");
|
---|
80 | });
|
---|
81 |
|
---|
82 | test('panelTemplate', function() {
|
---|
83 | ok(false, "missing test - untested code is broken code.");
|
---|
84 | });
|
---|
85 |
|
---|
86 | test('selected', function() {
|
---|
87 | expect(8);
|
---|
88 |
|
---|
89 | el = $('#tabs1').tabs();
|
---|
90 | equals(el.tabs('option', 'selected'), 0, 'should be 0 by default');
|
---|
91 |
|
---|
92 | el.tabs('destroy');
|
---|
93 | el.tabs({ selected: -1 });
|
---|
94 | equals(el.tabs('option', 'selected'), -1, 'should be -1 for all tabs unselected');
|
---|
95 | equals( $('li.ui-tabs-selected', el).length, 0, 'no tab should be selected' );
|
---|
96 | equals( $('div.ui-tabs-hide', '#tabs1').length, 3, 'all panels should be hidden' );
|
---|
97 |
|
---|
98 | el.tabs('destroy');
|
---|
99 | el.tabs({ selected: null });
|
---|
100 | equals(el.tabs('option', 'selected'), -1, 'should be -1 for all tabs unselected with value null (deprecated)');
|
---|
101 |
|
---|
102 | el.tabs('destroy');
|
---|
103 | el.tabs({ selected: 1 });
|
---|
104 | equals(el.tabs('option', 'selected'), 1, 'should be specified tab');
|
---|
105 |
|
---|
106 | el.tabs('destroy');
|
---|
107 | el.tabs({ selected: 99 });
|
---|
108 | equals(el.tabs('option', 'selected'), 0, 'selected should default to zero if given value is out of index');
|
---|
109 |
|
---|
110 | el.tabs('destroy');
|
---|
111 | el.tabs({ collapsible: true });
|
---|
112 | el.tabs('option', 'selected', 0);
|
---|
113 | equals(el.tabs('option', 'selected'), 0, 'should not collapse tab if value is same as selected');
|
---|
114 | });
|
---|
115 |
|
---|
116 | test('spinner', function() {
|
---|
117 | ok(false, "missing test - untested code is broken code.");
|
---|
118 | });
|
---|
119 |
|
---|
120 | test('tabTemplate', function() {
|
---|
121 | ok(false, "missing test - untested code is broken code.");
|
---|
122 | });
|
---|
123 |
|
---|
124 | })(jQuery);
|
---|