From ecc0ef53dee0eb3ce432348762abf4550aad8b36 Mon Sep 17 00:00:00 2001 From: Scott González Date: Mon, 24 Jan 2011 16:00:34 -0500 Subject: Accordion tests: Getting really ghetto in an attempt to get deprecated tests to run in TestSwarm. --- tests/unit/accordion/accordio.html | 139 +++++++++++++++++++ .../accordion/accordion_defaults_deprecated.js | 22 +++ tests/unit/accordion/accordion_deprecated.js | 154 +++++++++++++++++++++ tests/unit/accordion/deprecated/accordion.html | 139 ------------------- .../deprecated/accordion_defaults_deprecated.js | 22 --- .../accordion/deprecated/accordion_deprecated.js | 154 --------------------- 6 files changed, 315 insertions(+), 315 deletions(-) create mode 100644 tests/unit/accordion/accordio.html create mode 100644 tests/unit/accordion/accordion_defaults_deprecated.js create mode 100644 tests/unit/accordion/accordion_deprecated.js delete mode 100644 tests/unit/accordion/deprecated/accordion.html delete mode 100644 tests/unit/accordion/deprecated/accordion_defaults_deprecated.js delete mode 100644 tests/unit/accordion/deprecated/accordion_deprecated.js diff --git a/tests/unit/accordion/accordio.html b/tests/unit/accordion/accordio.html new file mode 100644 index 000000000..c104df4d5 --- /dev/null +++ b/tests/unit/accordion/accordio.html @@ -0,0 +1,139 @@ + + + + + jQuery UI Accordion Test Suite + + + + + + + + + + + + + + + + + + + + + + + + + + + +

jQuery UI Accordion Test Suite

+

+

+
    +
+ +
+ +
+
+

There is one obvious advantage:

+
+

+ You've seen it coming! +
+ Buy now and get nothing for free! +
+ Well, at least no free beer. Perhaps a bear, if you can afford it. +

+
+

Now that you've got...

+
+

+ your bear, you have to admit it! +
+ No, we aren't selling bears. +

+

+ We could talk about renting one. +

+
+

Rent one bear, ...

+
+

+ get two for three beer. +

+

+ And now, for something completely different. +

+
+
+
+ + + +
+ + + diff --git a/tests/unit/accordion/accordion_defaults_deprecated.js b/tests/unit/accordion/accordion_defaults_deprecated.js new file mode 100644 index 000000000..386354e83 --- /dev/null +++ b/tests/unit/accordion/accordion_defaults_deprecated.js @@ -0,0 +1,22 @@ + +var accordion_defaults = { + active: 0, + animated: false, + autoHeight: true, + clearStyle: false, + collapsible: false, + disabled: false, + event: "click", + fillSpace: false, + header: "> li > :first-child,> :not(li):even", + heightStyle: null, + icons: { + "activeHeader": null, + "header": "ui-icon-triangle-1-e", + "headerSelected": "ui-icon-triangle-1-s" + }, + navigation: false, + navigationFilter: function() {} +}; + +commonWidgetTests( "accordion", { defaults: accordion_defaults } ); diff --git a/tests/unit/accordion/accordion_deprecated.js b/tests/unit/accordion/accordion_deprecated.js new file mode 100644 index 000000000..b219cf8c3 --- /dev/null +++ b/tests/unit/accordion/accordion_deprecated.js @@ -0,0 +1,154 @@ +/* + * accordion_core.js + */ + + +(function($) { + +module("accordion (deprecated): expanded active option, activate method"); + +test("activate", function() { + var expected = $('#list1').accordion(), + actual = expected.accordion('activate', 2); + equals(actual, expected, 'activate is chainable'); +}); + +test("activate, numeric", function() { + var ac = $('#list1').accordion({ active: 1 }); + state(ac, 0, 1, 0); + ac.accordion("activate", 2); + state(ac, 0, 0, 1); + ac.accordion("activate", 0); + state(ac, 1, 0, 0); + ac.accordion("activate", 1); + state(ac, 0, 1, 0); + ac.accordion("activate", 2); + state(ac, 0, 0, 1); +}); + +test("activate, boolean and numeric, collapsible:true", function() { + var ac = $('#list1').accordion({collapsible: true}).accordion("activate", 2); + state(ac, 0, 0, 1); + ok("x", "----"); + ac.accordion("activate", 0); + state(ac, 1, 0, 0); + ok("x", "----"); + ac.accordion("activate", -1); + state(ac, 0, 0, 0); +}); + +test("activate, boolean, collapsible: false", function() { + var ac = $('#list1').accordion().accordion("activate", 2); + state(ac, 0, 0, 1); + ac.accordion("activate", false); + state(ac, 0, 0, 1); +}); + +test("activate, string expression", function() { + var ac = $('#list1').accordion({ active: "h3:last" }); + state(ac, 0, 0, 1); + ac.accordion("activate", ":first"); + state(ac, 1, 0, 0); + ac.accordion("activate", ":eq(1)"); + state(ac, 0, 1, 0); + ac.accordion("activate", ":last"); + state(ac, 0, 0, 1); +}); + +test("activate, jQuery or DOM element", function() { + var ac = $('#list1').accordion({ active: $("#list1 h3:last") }); + state(ac, 0, 0, 1); + ac.accordion("activate", $("#list1 h3:first")); + state(ac, 1, 0, 0); + ac.accordion("activate", $("#list1 h3")[1]); + state(ac, 0, 1, 0); +}); + +test("{ active: Selector }", function() { + var ac = $("#list1").accordion({ + active: "h3:last" + }); + state(ac, 0, 0, 1); + ac.accordion('option', 'active', "h3:eq(1)"); + state(ac, 0, 1, 0); +}); + +test("{ active: Element }", function() { + var ac = $("#list1").accordion({ + active: $("#list1 h3:last")[0] + }); + state(ac, 0, 0, 1); + ac.accordion('option', 'active', $("#list1 h3:eq(1)")[0]); + state(ac, 0, 1, 0); +}); + +test("{ active: jQuery Object }", function() { + var ac = $("#list1").accordion({ + active: $("#list1 h3:last") + }); + state(ac, 0, 0, 1); + ac.accordion('option', 'active', $("#list1 h3:eq(1)")); + state(ac, 0, 1, 0); +}); + + + + + + +module("accordion (deprecated) - height options"); + +test("{ autoHeight: true }, default", function() { + equalHeights($('#navigation').accordion({ autoHeight: true }), 95, 130); +}); + +test("{ autoHeight: false }", function() { + var accordion = $('#navigation').accordion({ autoHeight: false }); + var sizes = []; + accordion.find(".ui-accordion-content").each(function() { + sizes.push($(this).height()); + }); + ok( sizes[0] >= 70 && sizes[0] <= 90, "was " + sizes[0] ); + ok( sizes[1] >= 98 && sizes[1] <= 126, "was " + sizes[1] ); + ok( sizes[2] >= 42 && sizes[2] <= 54, "was " + sizes[2] ); +}); + +// fillSpace: false == autoHeight: true, covered above +test("{ fillSpace: true }", function() { + $("#navigationWrapper").height(500); + equalHeights($('#navigation').accordion({ fillSpace: true }), 446, 458); +}); + +test("{ fillSpace: true } with sibling", function() { + $("#navigationWrapper").height(500); + var sibling = $("

Lorem Ipsum

"); + $("#navigationWrapper").prepend( sibling.height(100) ); + //sibling.outerHeight(true) == 126 + equalHeights($('#navigation').accordion({ fillSpace: true}), 320, 332); +}); + +test("{ fillSpace: true } with multiple siblings", function() { + $("#navigationWrapper").height(500); + var sibling = $("

Lorem Ipsum

"); + $("#navigationWrapper") + .prepend( sibling.clone().height(100) ) + .prepend( sibling.clone().height(100).css( "position", "absolute" ) ) + .prepend( sibling.clone().height(50) ); + //sibling.outerHeight(true) == 126 + equalHeights($('#navigation').accordion({ fillSpace: true}), 244, 256); +}); + + + + +module("accordion (deprecated) - icons"); + +test("change headerSelected option after creation", function() { + var list = $("#list1"); + list.accordion( { icons: { "activeHeader": "test" } } ); + equals( $( "#list1 span.test" ).length, 1); + list.accordion( "option", "icons", { "headerSelected": "deprecated" } ); + equals( $( "#list1 span.deprecated" ).length, 1); +}); + +})(jQuery); diff --git a/tests/unit/accordion/deprecated/accordion.html b/tests/unit/accordion/deprecated/accordion.html deleted file mode 100644 index d5e55f2e4..000000000 --- a/tests/unit/accordion/deprecated/accordion.html +++ /dev/null @@ -1,139 +0,0 @@ - - - - - jQuery UI Accordion Test Suite - - - - - - - - - - - - - - - - - - - - - - - - - - - -

jQuery UI Accordion Test Suite

-

-

-
    -
- -
- -
-
-

There is one obvious advantage:

-
-

- You've seen it coming! -
- Buy now and get nothing for free! -
- Well, at least no free beer. Perhaps a bear, if you can afford it. -

-
-

Now that you've got...

-
-

- your bear, you have to admit it! -
- No, we aren't selling bears. -

-

- We could talk about renting one. -

-
-

Rent one bear, ...

-
-

- get two for three beer. -

-

- And now, for something completely different. -

-
-
-
- - - -
- - - diff --git a/tests/unit/accordion/deprecated/accordion_defaults_deprecated.js b/tests/unit/accordion/deprecated/accordion_defaults_deprecated.js deleted file mode 100644 index 386354e83..000000000 --- a/tests/unit/accordion/deprecated/accordion_defaults_deprecated.js +++ /dev/null @@ -1,22 +0,0 @@ - -var accordion_defaults = { - active: 0, - animated: false, - autoHeight: true, - clearStyle: false, - collapsible: false, - disabled: false, - event: "click", - fillSpace: false, - header: "> li > :first-child,> :not(li):even", - heightStyle: null, - icons: { - "activeHeader": null, - "header": "ui-icon-triangle-1-e", - "headerSelected": "ui-icon-triangle-1-s" - }, - navigation: false, - navigationFilter: function() {} -}; - -commonWidgetTests( "accordion", { defaults: accordion_defaults } ); diff --git a/tests/unit/accordion/deprecated/accordion_deprecated.js b/tests/unit/accordion/deprecated/accordion_deprecated.js deleted file mode 100644 index b219cf8c3..000000000 --- a/tests/unit/accordion/deprecated/accordion_deprecated.js +++ /dev/null @@ -1,154 +0,0 @@ -/* - * accordion_core.js - */ - - -(function($) { - -module("accordion (deprecated): expanded active option, activate method"); - -test("activate", function() { - var expected = $('#list1').accordion(), - actual = expected.accordion('activate', 2); - equals(actual, expected, 'activate is chainable'); -}); - -test("activate, numeric", function() { - var ac = $('#list1').accordion({ active: 1 }); - state(ac, 0, 1, 0); - ac.accordion("activate", 2); - state(ac, 0, 0, 1); - ac.accordion("activate", 0); - state(ac, 1, 0, 0); - ac.accordion("activate", 1); - state(ac, 0, 1, 0); - ac.accordion("activate", 2); - state(ac, 0, 0, 1); -}); - -test("activate, boolean and numeric, collapsible:true", function() { - var ac = $('#list1').accordion({collapsible: true}).accordion("activate", 2); - state(ac, 0, 0, 1); - ok("x", "----"); - ac.accordion("activate", 0); - state(ac, 1, 0, 0); - ok("x", "----"); - ac.accordion("activate", -1); - state(ac, 0, 0, 0); -}); - -test("activate, boolean, collapsible: false", function() { - var ac = $('#list1').accordion().accordion("activate", 2); - state(ac, 0, 0, 1); - ac.accordion("activate", false); - state(ac, 0, 0, 1); -}); - -test("activate, string expression", function() { - var ac = $('#list1').accordion({ active: "h3:last" }); - state(ac, 0, 0, 1); - ac.accordion("activate", ":first"); - state(ac, 1, 0, 0); - ac.accordion("activate", ":eq(1)"); - state(ac, 0, 1, 0); - ac.accordion("activate", ":last"); - state(ac, 0, 0, 1); -}); - -test("activate, jQuery or DOM element", function() { - var ac = $('#list1').accordion({ active: $("#list1 h3:last") }); - state(ac, 0, 0, 1); - ac.accordion("activate", $("#list1 h3:first")); - state(ac, 1, 0, 0); - ac.accordion("activate", $("#list1 h3")[1]); - state(ac, 0, 1, 0); -}); - -test("{ active: Selector }", function() { - var ac = $("#list1").accordion({ - active: "h3:last" - }); - state(ac, 0, 0, 1); - ac.accordion('option', 'active', "h3:eq(1)"); - state(ac, 0, 1, 0); -}); - -test("{ active: Element }", function() { - var ac = $("#list1").accordion({ - active: $("#list1 h3:last")[0] - }); - state(ac, 0, 0, 1); - ac.accordion('option', 'active', $("#list1 h3:eq(1)")[0]); - state(ac, 0, 1, 0); -}); - -test("{ active: jQuery Object }", function() { - var ac = $("#list1").accordion({ - active: $("#list1 h3:last") - }); - state(ac, 0, 0, 1); - ac.accordion('option', 'active', $("#list1 h3:eq(1)")); - state(ac, 0, 1, 0); -}); - - - - - - -module("accordion (deprecated) - height options"); - -test("{ autoHeight: true }, default", function() { - equalHeights($('#navigation').accordion({ autoHeight: true }), 95, 130); -}); - -test("{ autoHeight: false }", function() { - var accordion = $('#navigation').accordion({ autoHeight: false }); - var sizes = []; - accordion.find(".ui-accordion-content").each(function() { - sizes.push($(this).height()); - }); - ok( sizes[0] >= 70 && sizes[0] <= 90, "was " + sizes[0] ); - ok( sizes[1] >= 98 && sizes[1] <= 126, "was " + sizes[1] ); - ok( sizes[2] >= 42 && sizes[2] <= 54, "was " + sizes[2] ); -}); - -// fillSpace: false == autoHeight: true, covered above -test("{ fillSpace: true }", function() { - $("#navigationWrapper").height(500); - equalHeights($('#navigation').accordion({ fillSpace: true }), 446, 458); -}); - -test("{ fillSpace: true } with sibling", function() { - $("#navigationWrapper").height(500); - var sibling = $("

Lorem Ipsum

"); - $("#navigationWrapper").prepend( sibling.height(100) ); - //sibling.outerHeight(true) == 126 - equalHeights($('#navigation').accordion({ fillSpace: true}), 320, 332); -}); - -test("{ fillSpace: true } with multiple siblings", function() { - $("#navigationWrapper").height(500); - var sibling = $("

Lorem Ipsum

"); - $("#navigationWrapper") - .prepend( sibling.clone().height(100) ) - .prepend( sibling.clone().height(100).css( "position", "absolute" ) ) - .prepend( sibling.clone().height(50) ); - //sibling.outerHeight(true) == 126 - equalHeights($('#navigation').accordion({ fillSpace: true}), 244, 256); -}); - - - - -module("accordion (deprecated) - icons"); - -test("change headerSelected option after creation", function() { - var list = $("#list1"); - list.accordion( { icons: { "activeHeader": "test" } } ); - equals( $( "#list1 span.test" ).length, 1); - list.accordion( "option", "icons", { "headerSelected": "deprecated" } ); - equals( $( "#list1 span.deprecated" ).length, 1); -}); - -})(jQuery); -- cgit v1.2.3