diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/unit/tabs/spinner.gif | bin | 0 -> 2530 bytes | |||
-rw-r--r-- | tests/unit/tabs/tabs.html | 12 | ||||
-rw-r--r-- | tests/unit/tabs/tabs_core.js | 29 | ||||
-rw-r--r-- | tests/unit/tabs/tabs_defaults.js | 2 | ||||
-rw-r--r-- | tests/unit/tabs/test.html | 1 |
5 files changed, 37 insertions, 7 deletions
diff --git a/tests/unit/tabs/spinner.gif b/tests/unit/tabs/spinner.gif Binary files differnew file mode 100644 index 000000000..85b99d46b --- /dev/null +++ b/tests/unit/tabs/spinner.gif diff --git a/tests/unit/tabs/tabs.html b/tests/unit/tabs/tabs.html index d9cb4d138..69cd8f481 100644 --- a/tests/unit/tabs/tabs.html +++ b/tests/unit/tabs/tabs.html @@ -24,9 +24,9 @@ <div id="main"> <div id="tabs1"> <ul> - <li><a href="#fragment-1">1</a></li> - <li><a href="#fragment-2">2</a></li> - <li><a href="#fragment-3">3</a></li> + <li><a href="#fragment-1"><span>1</span></a></li> + <li><a href="#fragment-2"><span>2</span></a></li> + <li><a href="#fragment-3"><span>3</span></a></li> </ul> <div id="fragment-1"></div> <div id="fragment-2"></div> @@ -34,9 +34,9 @@ </div> <div id="tabs2"> <ul> - <li><a href="#colon:test">1</a></li> - <li><a href="#inline-style">2</a></li> - <li><a href="test.html#test">1</a></li> + <li><a href="#colon:test"><span>1</span></a></li> + <li><a href="#inline-style"><span>2</span></a></li> + <li><a href="test.html#test"><span>3</span></a></li> </ul> <div id="colon:test"></div> <div style="height: 300px;" id="inline-style"></div> diff --git a/tests/unit/tabs/tabs_core.js b/tests/unit/tabs/tabs_core.js index ba5f3d014..79e95ea41 100644 --- a/tests/unit/tabs/tabs_core.js +++ b/tests/unit/tabs/tabs_core.js @@ -7,4 +7,33 @@ var el; module("tabs: core"); +test('ajax', function() { + expect(4); + stop(); + + el = $('#tabs2'); + + el.tabs({ + selected: 2, + load: function() { + // spinner: default spinner + equals($('li:eq(2) > a > span', el).length, 1, "should restore tab markup after spinner is removed"); + equals($('li:eq(2) > a > span', el).html(), '3', "should restore tab label after spinner is removed"); + el.tabs('destroy'); + el.tabs({ + selected: 2, + spinner: '<img src="spinner.gif" alt="">', + load: function() { + // spinner: image + equals($('li:eq(2) > a > span', el).length, 1, "should restore tab markup after spinner is removed"); + equals($('li:eq(2) > a > span', el).html(), '3', "should restore tab label after spinner is removed"); + start(); + } + }); + } + }); + +}); + + })(jQuery); diff --git a/tests/unit/tabs/tabs_defaults.js b/tests/unit/tabs/tabs_defaults.js index 306e8c86e..f5a583e2c 100644 --- a/tests/unit/tabs/tabs_defaults.js +++ b/tests/unit/tabs/tabs_defaults.js @@ -12,7 +12,7 @@ var tabs_defaults = { fx: null, idPrefix: 'ui-tabs-', panelTemplate: '<div></div>', - spinner: 'Loading…', + spinner: '<em>Loading…</em>', tabTemplate: '<li><a href="#{href}"><span>#{label}</span></a></li>' }; diff --git a/tests/unit/tabs/test.html b/tests/unit/tabs/test.html new file mode 100644 index 000000000..cd59e6415 --- /dev/null +++ b/tests/unit/tabs/test.html @@ -0,0 +1 @@ +<p>…content loaded via Ajax.</p>
\ No newline at end of file |