diff options
author | Richard Worth <rdworth@gmail.com> | 2010-01-20 14:00:14 +0000 |
---|---|---|
committer | Richard Worth <rdworth@gmail.com> | 2010-01-20 14:00:14 +0000 |
commit | eecbde22a6b338785ac8e1991858ba7dab976eae (patch) | |
tree | 11c5e0835757497110151e803bb1e1fb39820dcc /tests/unit/button | |
parent | a1e069759ddcd3e56deff0d9334559b156df734c (diff) | |
download | jquery-ui-eecbde22a6b338785ac8e1991858ba7dab976eae.tar.gz jquery-ui-eecbde22a6b338785ac8e1991858ba7dab976eae.zip |
eol-style and mime-type
Diffstat (limited to 'tests/unit/button')
-rw-r--r-- | tests/unit/button/button.html | 112 | ||||
-rw-r--r-- | tests/unit/button/button_core.js | 140 | ||||
-rw-r--r-- | tests/unit/button/button_defaults.js | 30 | ||||
-rw-r--r-- | tests/unit/button/button_events.js | 34 | ||||
-rw-r--r-- | tests/unit/button/button_methods.js | 30 | ||||
-rw-r--r-- | tests/unit/button/button_options.js | 138 | ||||
-rw-r--r-- | tests/unit/button/button_tickets.js | 20 |
7 files changed, 252 insertions, 252 deletions
diff --git a/tests/unit/button/button.html b/tests/unit/button/button.html index 8101eb586..4681c062f 100644 --- a/tests/unit/button/button.html +++ b/tests/unit/button/button.html @@ -1,56 +1,56 @@ -<!doctype html>
-<html lang="en">
-<head>
- <title>jQuery UI Button Test Suite</title>
-
- <script type="text/javascript" src="../../../jquery-1.4.js"></script>
- <script type="text/javascript" src="../../../ui/jquery.ui.core.js"></script>
- <script type="text/javascript" src="../../../ui/jquery.ui.widget.js"></script>
- <script type="text/javascript" src="../../../ui/jquery.ui.button.js"></script>
-
- <link type="text/css" href="../testsuite.css" rel="stylesheet" />
- <script type="text/javascript" src="../../../external/testrunner-r6588.js"></script>
- <script type="text/javascript" src="../../jquery.simulate.js"></script>
- <script type="text/javascript" src="../testsuite.js"></script>
-
- <script type="text/javascript" src="button_core.js"></script>
- <script type="text/javascript" src="button_defaults.js"></script>
- <script type="text/javascript" src="button_events.js"></script>
- <script type="text/javascript" src="button_methods.js"></script>
- <script type="text/javascript" src="button_options.js"></script>
- <script type="text/javascript" src="button_tickets.js"></script>
-
-</head>
-<body>
-
-<div id="main">
-
- <div><button id="button" class="foo">Label</button></div>
-
- <div id="radio0" style="margin-top: 2em;">
- <input type="radio" id="radio01" name="radio" checked="checked" /><label for="radio01">Choice 1</label>
- <input type="radio" id="radio02" name="radio" /><label for="radio02">Choice 2</label>
- <input type="radio" id="radio03" name="radio" /><label for="radio03">Choice 3</label>
- </div>
- <form>
- <div id="radio1" style="margin-top: 2em;">
- <input type="radio" id="radio11" name="radio" /><label for="radio11">Choice 1</label>
- <input type="radio" id="radio12" name="radio" checked="checked" /><label for="radio12">Choice 2</label>
- <input type="radio" id="radio13" name="radio" /><label for="radio13">Choice 3</label>
- </div>
- </form>
- <form>
- <div id="radio2" style="margin-top: 2em;">
- <input type="radio" id="radio21" name="radio" /><label for="radio21">Choice 1</label>
- <input type="radio" id="radio22" name="radio" /><label for="radio22">Choice 2</label>
- <input type="radio" id="radio23" name="radio" checked="checked" /><label for="radio23">Choice 3</label>
- </div>
- </form>
-
- <input type="checkbox" id="check" /><label for="check">Toggle</label>
-
- <div><input id="submit" type="submit" value="Label" /></div>
-</div>
-
-</body>
-</html>
+<!doctype html> +<html lang="en"> +<head> + <title>jQuery UI Button Test Suite</title> + + <script type="text/javascript" src="../../../jquery-1.4.js"></script> + <script type="text/javascript" src="../../../ui/jquery.ui.core.js"></script> + <script type="text/javascript" src="../../../ui/jquery.ui.widget.js"></script> + <script type="text/javascript" src="../../../ui/jquery.ui.button.js"></script> + + <link type="text/css" href="../testsuite.css" rel="stylesheet" /> + <script type="text/javascript" src="../../../external/testrunner-r6588.js"></script> + <script type="text/javascript" src="../../jquery.simulate.js"></script> + <script type="text/javascript" src="../testsuite.js"></script> + + <script type="text/javascript" src="button_core.js"></script> + <script type="text/javascript" src="button_defaults.js"></script> + <script type="text/javascript" src="button_events.js"></script> + <script type="text/javascript" src="button_methods.js"></script> + <script type="text/javascript" src="button_options.js"></script> + <script type="text/javascript" src="button_tickets.js"></script> + +</head> +<body> + +<div id="main"> + + <div><button id="button" class="foo">Label</button></div> + + <div id="radio0" style="margin-top: 2em;"> + <input type="radio" id="radio01" name="radio" checked="checked" /><label for="radio01">Choice 1</label> + <input type="radio" id="radio02" name="radio" /><label for="radio02">Choice 2</label> + <input type="radio" id="radio03" name="radio" /><label for="radio03">Choice 3</label> + </div> + <form> + <div id="radio1" style="margin-top: 2em;"> + <input type="radio" id="radio11" name="radio" /><label for="radio11">Choice 1</label> + <input type="radio" id="radio12" name="radio" checked="checked" /><label for="radio12">Choice 2</label> + <input type="radio" id="radio13" name="radio" /><label for="radio13">Choice 3</label> + </div> + </form> + <form> + <div id="radio2" style="margin-top: 2em;"> + <input type="radio" id="radio21" name="radio" /><label for="radio21">Choice 1</label> + <input type="radio" id="radio22" name="radio" /><label for="radio22">Choice 2</label> + <input type="radio" id="radio23" name="radio" checked="checked" /><label for="radio23">Choice 3</label> + </div> + </form> + + <input type="checkbox" id="check" /><label for="check">Toggle</label> + + <div><input id="submit" type="submit" value="Label" /></div> +</div> + +</body> +</html> diff --git a/tests/unit/button/button_core.js b/tests/unit/button/button_core.js index 1a40d5ee0..255abeaec 100644 --- a/tests/unit/button/button_core.js +++ b/tests/unit/button/button_core.js @@ -1,70 +1,70 @@ -/*
- * button_core.js
- */
-
-
-(function($) {
-
-module("button: core");
-
-test("checkbox", function() {
- var input = $("#check");
- label = $("label[for=check]");
- ok( input.is(":visible") );
- ok( label.is(":not(.ui-button)") );
- input.button();
- ok( input.is(":hidden") );
- ok( label.is(".ui-button") );
-});
-
-test("radios", function() {
- var inputs = $("#radio0 input");
- labels = $("#radio0 label");
- ok( inputs.is(":visible") );
- ok( labels.is(":not(.ui-button)") );
- inputs.button();
- ok( inputs.is(":hidden") );
- ok( labels.is(".ui-button") );
-});
-
-function assert(noForm, form1, form2) {
- ok( $("#radio0 .ui-button" + noForm).is(".ui-state-active") );
- ok( $("#radio1 .ui-button" + form1).is(".ui-state-active") );
- ok( $("#radio2 .ui-button" + form2).is(".ui-state-active") );
-}
-
-test("radio groups", function() {
- $(":radio").button();
- assert(":eq(0)", ":eq(1)", ":eq(2)");
-
- // click outside of forms
- $("#radio0 .ui-button:eq(1)").click();
- assert(":eq(1)", ":eq(1)", ":eq(2)");
-
- // click in first form
- $("#radio1 .ui-button:eq(0)").click();
- assert(":eq(1)", ":eq(0)", ":eq(2)");
-
- // click in second form
- $("#radio2 .ui-button:eq(0)").click();
- assert(":eq(1)", ":eq(0)", ":eq(0)");
-});
-
-test("input type submit, don't create child elements", function() {
- var input = $("#submit")
- same( input.children().length, 0 );
- input.button();
- same( input.children().length, 0 );
-});
-
-test("buttonset", function() {
- var set = $("#radio1").buttonset();
- ok( set.is(".ui-button-set") );
- same( set.children(".ui-button").length, 3 );
- same( set.children("input:radio:hidden").length, 3 );
- ok( set.children("label:eq(0)").is(".ui-button.ui-corner-left:not(.ui-corner-all)") );
- ok( set.children("label:eq(1)").is(".ui-button:not(.ui-corner-all)") );
- ok( set.children("label:eq(2)").is(".ui-button.ui-corner-right:not(.ui-corner-all)") );
-});
-
-})(jQuery);
+/* + * button_core.js + */ + + +(function($) { + +module("button: core"); + +test("checkbox", function() { + var input = $("#check"); + label = $("label[for=check]"); + ok( input.is(":visible") ); + ok( label.is(":not(.ui-button)") ); + input.button(); + ok( input.is(":hidden") ); + ok( label.is(".ui-button") ); +}); + +test("radios", function() { + var inputs = $("#radio0 input"); + labels = $("#radio0 label"); + ok( inputs.is(":visible") ); + ok( labels.is(":not(.ui-button)") ); + inputs.button(); + ok( inputs.is(":hidden") ); + ok( labels.is(".ui-button") ); +}); + +function assert(noForm, form1, form2) { + ok( $("#radio0 .ui-button" + noForm).is(".ui-state-active") ); + ok( $("#radio1 .ui-button" + form1).is(".ui-state-active") ); + ok( $("#radio2 .ui-button" + form2).is(".ui-state-active") ); +} + +test("radio groups", function() { + $(":radio").button(); + assert(":eq(0)", ":eq(1)", ":eq(2)"); + + // click outside of forms + $("#radio0 .ui-button:eq(1)").click(); + assert(":eq(1)", ":eq(1)", ":eq(2)"); + + // click in first form + $("#radio1 .ui-button:eq(0)").click(); + assert(":eq(1)", ":eq(0)", ":eq(2)"); + + // click in second form + $("#radio2 .ui-button:eq(0)").click(); + assert(":eq(1)", ":eq(0)", ":eq(0)"); +}); + +test("input type submit, don't create child elements", function() { + var input = $("#submit") + same( input.children().length, 0 ); + input.button(); + same( input.children().length, 0 ); +}); + +test("buttonset", function() { + var set = $("#radio1").buttonset(); + ok( set.is(".ui-button-set") ); + same( set.children(".ui-button").length, 3 ); + same( set.children("input:radio:hidden").length, 3 ); + ok( set.children("label:eq(0)").is(".ui-button.ui-corner-left:not(.ui-corner-all)") ); + ok( set.children("label:eq(1)").is(".ui-button:not(.ui-corner-all)") ); + ok( set.children("label:eq(2)").is(".ui-button.ui-corner-right:not(.ui-corner-all)") ); +}); + +})(jQuery); diff --git a/tests/unit/button/button_defaults.js b/tests/unit/button/button_defaults.js index f0152e3c2..e1657854a 100644 --- a/tests/unit/button/button_defaults.js +++ b/tests/unit/button/button_defaults.js @@ -1,15 +1,15 @@ -/*
- * button_defaults.js
- */
-
-var button_defaults = {
- disabled: false,
- text: true,
- label: null,
- icons: {
- primary: null,
- secondary: null
- }
-};
-
-commonWidgetTests('button', { defaults: button_defaults });
+/* + * button_defaults.js + */ + +var button_defaults = { + disabled: false, + text: true, + label: null, + icons: { + primary: null, + secondary: null + } +}; + +commonWidgetTests('button', { defaults: button_defaults }); diff --git a/tests/unit/button/button_events.js b/tests/unit/button/button_events.js index 17f505458..4d563ff58 100644 --- a/tests/unit/button/button_events.js +++ b/tests/unit/button/button_events.js @@ -1,17 +1,17 @@ -/*
- * button_events.js
- */
-(function($) {
-
-module("button: events");
-
-test("click-through", function() {
- expect(2);
- var set = $("#radio1").buttonset();
- set.find("input:first").click(function() {
- ok( true );
- });
- ok( set.find("label:first").click().is(".ui-button") );
-});
-
-})(jQuery);
+/* + * button_events.js + */ +(function($) { + +module("button: events"); + +test("click-through", function() { + expect(2); + var set = $("#radio1").buttonset(); + set.find("input:first").click(function() { + ok( true ); + }); + ok( set.find("label:first").click().is(".ui-button") ); +}); + +})(jQuery); diff --git a/tests/unit/button/button_methods.js b/tests/unit/button/button_methods.js index a162a8930..1fcd836b8 100644 --- a/tests/unit/button/button_methods.js +++ b/tests/unit/button/button_methods.js @@ -1,15 +1,15 @@ -/*
- * button_methods.js
- */
-(function($) {
-
-
-module("button: methods");
-
-test("destroy", function() {
- var beforeHtml = $("#button").parent().html();
- var afterHtml = $("#button").button().button("destroy").parent().html();
- same( beforeHtml, afterHtml );
-});
-
-})(jQuery);
+/* + * button_methods.js + */ +(function($) { + + +module("button: methods"); + +test("destroy", function() { + var beforeHtml = $("#button").parent().html(); + var afterHtml = $("#button").button().button("destroy").parent().html(); + same( beforeHtml, afterHtml ); +}); + +})(jQuery); diff --git a/tests/unit/button/button_options.js b/tests/unit/button/button_options.js index f44679a34..6ee8ab541 100644 --- a/tests/unit/button/button_options.js +++ b/tests/unit/button/button_options.js @@ -1,69 +1,69 @@ -/*
- * button_options.js
- */
-(function($) {
-
-module("button: options");
-
-test("text false without icon", function() {
- $("#button").button({
- text: false
- });
- ok( $("#button").is(".ui-button-text-only:not(.ui-button-icon-only)") );
-
- $("#button").button("destroy");
-});
-
-test("text false with icon", function() {
- $("#button").button({
- text: false,
- icons: {
- primary: "iconclass"
- }
- });
- ok( $("#button").is(".ui-button-icon-only:not(.ui-button-text):has(span.ui-icon.iconclass)") );
-
- $("#button").button("destroy");
-});
-
-test("label, default", function() {
- $("#button").button();
- same( $("#button").text(), "Label" );
-
- $("#button").button("destroy");
-});
-
-test("label", function() {
- $("#button").button({
- label: "xxx"
- });
- same( $("#button").text(), "xxx" );
-
- $("#button").button("destroy");
-});
-
-test("label default with input type submit", function() {
- same( $("#submit").button().val(), "Label" );
-});
-
-test("label with input type submit", function() {
- var label = $("#submit").button({
- label: "xxx"
- }).val();
- same( label, "xxx" );
-});
-
-test("icons", function() {
- $("#button").button({
- text: false,
- icons: {
- primary: "iconclass",
- secondary: "iconclass2"
- }
- });
- ok( $("#button").is(":has(span.ui-icon.ui-button-icon-primary.iconclass):has(span.ui-icon.ui-button-icon-secondary.iconclass2)") );
-
- $("#button").button("destroy");
-});
-
-})(jQuery);
+/* + * button_options.js + */ +(function($) { + +module("button: options"); + +test("text false without icon", function() { + $("#button").button({ + text: false + }); + ok( $("#button").is(".ui-button-text-only:not(.ui-button-icon-only)") ); + + $("#button").button("destroy"); +}); + +test("text false with icon", function() { + $("#button").button({ + text: false, + icons: { + primary: "iconclass" + } + }); + ok( $("#button").is(".ui-button-icon-only:not(.ui-button-text):has(span.ui-icon.iconclass)") ); + + $("#button").button("destroy"); +}); + +test("label, default", function() { + $("#button").button(); + same( $("#button").text(), "Label" ); + + $("#button").button("destroy"); +}); + +test("label", function() { + $("#button").button({ + label: "xxx" + }); + same( $("#button").text(), "xxx" ); + + $("#button").button("destroy"); +}); + +test("label default with input type submit", function() { + same( $("#submit").button().val(), "Label" ); +}); + +test("label with input type submit", function() { + var label = $("#submit").button({ + label: "xxx" + }).val(); + same( label, "xxx" ); +}); + +test("icons", function() { + $("#button").button({ + text: false, + icons: { + primary: "iconclass", + secondary: "iconclass2" + } + }); + ok( $("#button").is(":has(span.ui-icon.ui-button-icon-primary.iconclass):has(span.ui-icon.ui-button-icon-secondary.iconclass2)") ); + + $("#button").button("destroy"); +}); + +})(jQuery); diff --git a/tests/unit/button/button_tickets.js b/tests/unit/button/button_tickets.js index d3b981e21..7f972513d 100644 --- a/tests/unit/button/button_tickets.js +++ b/tests/unit/button/button_tickets.js @@ -1,10 +1,10 @@ -/*
- * button_tickets.js
- */
-(function($) {
-
-module("button: tickets");
-
-
-
-})(jQuery);
+/* + * button_tickets.js + */ +(function($) { + +module("button: tickets"); + + + +})(jQuery); |