From 8f71accb75770f56b5983c0e29515e7182c23604 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=CC=88rn=20Zaefferer?= Date: Thu, 23 Feb 2012 14:26:47 +0100 Subject: [PATCH 01/18] Position: Fix initial positioning of cycler demo. --- demos/position/cycler.html | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/demos/position/cycler.html b/demos/position/cycler.html index 689a1191f99..2fb36167f18 100644 --- a/demos/position/cycler.html +++ b/demos/position/cycler.html @@ -17,6 +17,7 @@ + + + + + + + +

WHAT: The following set of nested accordions alternate between icons and no icons.

+

EXPECTED: The padding on the headers should correctly account for the icon settings.

+ +
+
Icons
+
+
+
No Icons
+
+
+
Icons
+
+
+
No Icons
+
+
+
Icons
+
+
+
No Icons
+
+
+
+
+
+
+
+
+
+
+
+
+ +
+
No Icons
+
+
+
Icons
+
+
+
No Icons
+
+
+
Icons
+
+
+
No Icons
+
+
+
Icons
+
+
+
+
+
+
+
+
+
+
+
+
+ + + From 1e291c92cd1a90f2a2ad5796f1ccace615538098 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Scott=20Gonz=C3=A1lez?= Date: Sun, 26 Feb 2012 22:04:21 -0500 Subject: [PATCH 08/18] Accordion: Reset height prior to calculations on refresh. --- ui/jquery.ui.accordion.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ui/jquery.ui.accordion.js b/ui/jquery.ui.accordion.js index 00acf2d1028..01600ba4e98 100644 --- a/ui/jquery.ui.accordion.js +++ b/ui/jquery.ui.accordion.js @@ -236,6 +236,8 @@ $.widget( "ui.accordion", { maxHeight, overflow; + this.element.css( "height", this.originalHeight ); + if ( heightStyle === "fill" ) { // IE 6 treats height like minHeight, so we need to turn off overflow // in order to get a reliable height From 4da7ec37ac7e5b4dd34593ba850200ccf4f4bf8c Mon Sep 17 00:00:00 2001 From: kborchers Date: Sun, 26 Feb 2012 22:52:38 -0600 Subject: [PATCH 09/18] Menu: Add default null callbacks and update unit tests --- tests/unit/menu/menu_defaults.js | 5 ++++- ui/jquery.ui.menu.js | 7 ++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/tests/unit/menu/menu_defaults.js b/tests/unit/menu/menu_defaults.js index bf41fb999f2..018ac8ccfa6 100644 --- a/tests/unit/menu/menu_defaults.js +++ b/tests/unit/menu/menu_defaults.js @@ -8,6 +8,9 @@ commonWidgetTests( "menu", { }, // callbacks - create: null + blur: null, + create: null, + focus: null, + select: null } }); diff --git a/ui/jquery.ui.menu.js b/ui/jquery.ui.menu.js index 42829c2a14c..05ecd3feb70 100644 --- a/ui/jquery.ui.menu.js +++ b/ui/jquery.ui.menu.js @@ -24,7 +24,12 @@ $.widget( "ui.menu", { position: { my: "left top", at: "right top" - } + }, + + // callbacks + blur: null, + focus: null, + select: null }, _create: function() { this.activeMenu = this.element; From 02855292f2746d2c6f64a729730727df6684c6c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Scott=20Gonz=C3=A1lez?= Date: Sun, 26 Feb 2012 21:37:44 -0500 Subject: [PATCH 10/18] Accordion: Removed requirement for headers contain a child (and removed associated ui-accordion-heading class). --- demos/accordion/collapsible.html | 8 ++++---- demos/accordion/custom-icons.html | 8 ++++---- demos/accordion/default.html | 8 ++++---- demos/accordion/fillspace.html | 8 ++++---- demos/accordion/hoverintent.html | 8 ++++---- demos/accordion/mouseover.html | 8 ++++---- demos/accordion/no-auto-height.html | 7 +++---- demos/accordion/sortable.html | 8 ++++---- tests/unit/accordion/accordion.html | 12 ++++++------ tests/unit/accordion/accordion_core.js | 7 ------- tests/unit/accordion/accordion_deprecated.html | 12 ++++++------ themes/base/jquery.ui.accordion.css | 9 ++++----- ui/jquery.ui.accordion.js | 9 --------- 13 files changed, 47 insertions(+), 65 deletions(-) diff --git a/demos/accordion/collapsible.html b/demos/accordion/collapsible.html index 310e550a93e..922df00cb6f 100644 --- a/demos/accordion/collapsible.html +++ b/demos/accordion/collapsible.html @@ -22,15 +22,15 @@
-

Section 1

+

Section 1

Mauris mauris ante, blandit et, ultrices a, suscipit eget, quam. Integer ut neque. Vivamus nisi metus, molestie vel, gravida in, condimentum sit amet, nunc. Nam a nibh. Donec suscipit eros. Nam mi. Proin viverra leo ut odio. Curabitur malesuada. Vestibulum a velit eu ante scelerisque vulputate.

-

Section 2

+

Section 2

Sed non urna. Donec et ante. Phasellus eu ligula. Vestibulum sit amet purus. Vivamus hendrerit, dolor at aliquet laoreet, mauris turpis porttitor velit, faucibus interdum tellus libero ac justo. Vivamus non quam. In suscipit faucibus urna.

-

Section 3

+

Section 3

Nam enim risus, molestie et, porta ac, aliquam ac, risus. Quisque lobortis. Phasellus pellentesque purus in massa. Aenean in pede. Phasellus ac libero ac tellus pellentesque semper. Sed ac felis. Sed commodo, magna quis lacinia ornare, quam ante aliquam nisi, eu iaculis leo purus venenatis dui.

    @@ -39,7 +39,7 @@

    Section 3

  • List item three
-

Section 4

+

Section 4

Cras dictum. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Aenean lacinia mauris vel est.

Suspendisse eu nisl. Nullam ut libero. Integer dignissim consequat lectus. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos.

diff --git a/demos/accordion/custom-icons.html b/demos/accordion/custom-icons.html index e2fc9bdb140..c41af1120b2 100644 --- a/demos/accordion/custom-icons.html +++ b/demos/accordion/custom-icons.html @@ -32,15 +32,15 @@
-

Section 1

+

Section 1

Mauris mauris ante, blandit et, ultrices a, suscipit eget, quam. Integer ut neque. Vivamus nisi metus, molestie vel, gravida in, condimentum sit amet, nunc. Nam a nibh. Donec suscipit eros. Nam mi. Proin viverra leo ut odio. Curabitur malesuada. Vestibulum a velit eu ante scelerisque vulputate.

-

Section 2

+

Section 2

Sed non urna. Donec et ante. Phasellus eu ligula. Vestibulum sit amet purus. Vivamus hendrerit, dolor at aliquet laoreet, mauris turpis porttitor velit, faucibus interdum tellus libero ac justo. Vivamus non quam. In suscipit faucibus urna.

-

Section 3

+

Section 3

Nam enim risus, molestie et, porta ac, aliquam ac, risus. Quisque lobortis. Phasellus pellentesque purus in massa. Aenean in pede. Phasellus ac libero ac tellus pellentesque semper. Sed ac felis. Sed commodo, magna quis lacinia ornare, quam ante aliquam nisi, eu iaculis leo purus venenatis dui.

    @@ -49,7 +49,7 @@

    Section 3

  • List item three
-

Section 4

+

Section 4

Cras dictum. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Aenean lacinia mauris vel est.

Suspendisse eu nisl. Nullam ut libero. Integer dignissim consequat lectus. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos.

diff --git a/demos/accordion/default.html b/demos/accordion/default.html index 4afc2b129c0..67197aa2068 100644 --- a/demos/accordion/default.html +++ b/demos/accordion/default.html @@ -20,7 +20,7 @@
-

Section 1

+

Section 1

Mauris mauris ante, blandit et, ultrices a, suscipit eget, quam. Integer @@ -29,7 +29,7 @@

Section 1

odio. Curabitur malesuada. Vestibulum a velit eu ante scelerisque vulputate.

-

Section 2

+

Section 2

Sed non urna. Donec et ante. Phasellus eu ligula. Vestibulum sit amet @@ -38,7 +38,7 @@

Section 2

suscipit faucibus urna.

-

Section 3

+

Section 3

Nam enim risus, molestie et, porta ac, aliquam ac, risus. Quisque lobortis. @@ -52,7 +52,7 @@

Section 3

  • List item three
  • -

    Section 4

    +

    Section 4

    Cras dictum. Pellentesque habitant morbi tristique senectus et netus diff --git a/demos/accordion/fillspace.html b/demos/accordion/fillspace.html index 3a7d81edc9c..6095fa33ff9 100644 --- a/demos/accordion/fillspace.html +++ b/demos/accordion/fillspace.html @@ -37,15 +37,15 @@

    Resize the outer container:

    -

    Section 1

    +

    Section 1

    Mauris mauris ante, blandit et, ultrices a, suscipit eget, quam. Integer ut neque. Vivamus nisi metus, molestie vel, gravida in, condimentum sit amet, nunc. Nam a nibh. Donec suscipit eros. Nam mi. Proin viverra leo ut odio. Curabitur malesuada. Vestibulum a velit eu ante scelerisque vulputate.

    -

    Section 2

    +

    Section 2

    Sed non urna. Donec et ante. Phasellus eu ligula. Vestibulum sit amet purus. Vivamus hendrerit, dolor at aliquet laoreet, mauris turpis porttitor velit, faucibus interdum tellus libero ac justo. Vivamus non quam. In suscipit faucibus urna.

    -

    Section 3

    +

    Section 3

    Nam enim risus, molestie et, porta ac, aliquam ac, risus. Quisque lobortis. Phasellus pellentesque purus in massa. Aenean in pede. Phasellus ac libero ac tellus pellentesque semper. Sed ac felis. Sed commodo, magna quis lacinia ornare, quam ante aliquam nisi, eu iaculis leo purus venenatis dui.

      @@ -54,7 +54,7 @@

      Section 3

    • List item three
    -

    Section 4

    +

    Section 4

    Cras dictum. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Aenean lacinia mauris vel est.

    Suspendisse eu nisl. Nullam ut libero. Integer dignissim consequat lectus. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos.

    diff --git a/demos/accordion/hoverintent.html b/demos/accordion/hoverintent.html index 8f628bda8be..d08c64be696 100644 --- a/demos/accordion/hoverintent.html +++ b/demos/accordion/hoverintent.html @@ -73,7 +73,7 @@
    -

    Section 1

    +

    Section 1

    Mauris mauris ante, blandit et, ultrices a, suscipit eget, quam. Integer @@ -82,7 +82,7 @@

    Section 1

    odio. Curabitur malesuada. Vestibulum a velit eu ante scelerisque vulputate.

    -

    Section 2

    +

    Section 2

    Sed non urna. Donec et ante. Phasellus eu ligula. Vestibulum sit amet @@ -91,7 +91,7 @@

    Section 2

    suscipit faucibus urna.

    -

    Section 3

    +

    Section 3

    Nam enim risus, molestie et, porta ac, aliquam ac, risus. Quisque lobortis. @@ -105,7 +105,7 @@

    Section 3

  • List item three
  • -

    Section 4

    +

    Section 4

    Cras dictum. Pellentesque habitant morbi tristique senectus et netus diff --git a/demos/accordion/mouseover.html b/demos/accordion/mouseover.html index 6f4bc2e6949..cbf6a78ac9e 100644 --- a/demos/accordion/mouseover.html +++ b/demos/accordion/mouseover.html @@ -22,15 +22,15 @@

    -

    Section 1

    +

    Section 1

    Mauris mauris ante, blandit et, ultrices a, suscipit eget, quam. Integer ut neque. Vivamus nisi metus, molestie vel, gravida in, condimentum sit amet, nunc. Nam a nibh. Donec suscipit eros. Nam mi. Proin viverra leo ut odio. Curabitur malesuada. Vestibulum a velit eu ante scelerisque vulputate.

    -

    Section 2

    +

    Section 2

    Sed non urna. Donec et ante. Phasellus eu ligula. Vestibulum sit amet purus. Vivamus hendrerit, dolor at aliquet laoreet, mauris turpis porttitor velit, faucibus interdum tellus libero ac justo. Vivamus non quam. In suscipit faucibus urna.

    -

    Section 3

    +

    Section 3

    Nam enim risus, molestie et, porta ac, aliquam ac, risus. Quisque lobortis. Phasellus pellentesque purus in massa. Aenean in pede. Phasellus ac libero ac tellus pellentesque semper. Sed ac felis. Sed commodo, magna quis lacinia ornare, quam ante aliquam nisi, eu iaculis leo purus venenatis dui.

      @@ -39,7 +39,7 @@

      Section 3

    • List item three
    -

    Section 4

    +

    Section 4

    Cras dictum. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Aenean lacinia mauris vel est.

    Suspendisse eu nisl. Nullam ut libero. Integer dignissim consequat lectus. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos.

    diff --git a/demos/accordion/no-auto-height.html b/demos/accordion/no-auto-height.html index c51880b7138..de07d625b1b 100644 --- a/demos/accordion/no-auto-height.html +++ b/demos/accordion/no-auto-height.html @@ -22,15 +22,15 @@
    -

    Section 1

    +

    Section 1

    Mauris mauris ante, blandit et, ultrices a, susceros. Nam mi. Proin viverra leo ut odio. Curabitur malesuada. Vestibulum a velit eu ante scelerisque vulputate.

    -

    Section 2

    +

    Section 2

    Sed non urna. Donec et ante. Phasellus eu ligula. Vestibulum sit amet purus. Vivamus hendrerit, dolor at aliquet laoreet, mauris turpis porttitor velit, faucibus interdum tellus libero ac justo. Vivamus non quam. In suscipit faucibus urna.

    -

    Section 3

    +

    Section 3

    Nam enim risus, molestie et, porta ac, aliquam ac, risus. Quisque lobortis. Phasellus pellentesque purus in massa. Aenean in pede. Phasellus ac libero ac tellus pellentesque semper. Sed ac felis. Sed commodo, magna quis lacinia ornare, quam ante aliquam nisi, eu iaculis leo purus venenatis dui.

      @@ -42,7 +42,6 @@

      Section 3

    • List item
    • List item
    - Link to other content
    diff --git a/demos/accordion/sortable.html b/demos/accordion/sortable.html index 60b5d3c70e1..cf9e8c86bc8 100644 --- a/demos/accordion/sortable.html +++ b/demos/accordion/sortable.html @@ -39,19 +39,19 @@
    -

    Section 1

    +

    Section 1

    Mauris mauris ante, blandit et, ultrices a, suscipit eget, quam. Integer ut neque. Vivamus nisi metus, molestie vel, gravida in, condimentum sit amet, nunc. Nam a nibh. Donec suscipit eros. Nam mi. Proin viverra leo ut odio. Curabitur malesuada. Vestibulum a velit eu ante scelerisque vulputate.

    -

    Section 2

    +

    Section 2

    Sed non urna. Donec et ante. Phasellus eu ligula. Vestibulum sit amet purus. Vivamus hendrerit, dolor at aliquet laoreet, mauris turpis porttitor velit, faucibus interdum tellus libero ac justo. Vivamus non quam. In suscipit faucibus urna.

    -

    Section 3

    +

    Section 3

    Nam enim risus, molestie et, porta ac, aliquam ac, risus. Quisque lobortis. Phasellus pellentesque purus in massa. Aenean in pede. Phasellus ac libero ac tellus pellentesque semper. Sed ac felis. Sed commodo, magna quis lacinia ornare, quam ante aliquam nisi, eu iaculis leo purus venenatis dui.

    -

    Section 4

    +

    Section 4

    Cras dictum. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Aenean lacinia mauris vel est.

    Suspendisse eu nisl. Nullam ut libero. Integer dignissim consequat lectus. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos.

    diff --git a/tests/unit/accordion/accordion.html b/tests/unit/accordion/accordion.html index ed9b1aa1d3a..109b3094e37 100644 --- a/tests/unit/accordion/accordion.html +++ b/tests/unit/accordion/accordion.html @@ -51,7 +51,7 @@

    -

    There is one obvious advantage:

    +

    There is one obvious advantage:

    You've seen it coming! @@ -61,7 +61,7 @@

    There is one obvious advantage:

    Well, at least no free beer. Perhaps a bear, if you can afford it.

    -

    Now that you've got...

    +

    Now that you've got...

    your bear, you have to admit it! @@ -72,7 +72,7 @@

    Now that you've got...

    We could talk about renting one.

    -

    Rent one bear, ...

    +

    Rent one bear, ...

    get two for three beer. @@ -120,19 +120,19 @@

    Drums

    - Accordion Header 1 + Accordion Header 1
    Accordion Content 1
    - Accordion Header 2 + Accordion Header 2
    Accordion Content 2
    - Accordion Header 3 + Accordion Header 3
    Accordion Content 3 diff --git a/tests/unit/accordion/accordion_core.js b/tests/unit/accordion/accordion_core.js index 3442cad62ec..de1b6604654 100644 --- a/tests/unit/accordion/accordion_core.js +++ b/tests/unit/accordion/accordion_core.js @@ -24,13 +24,6 @@ test( "handle click on header-descendant", function() { accordion_state( element, 0, 1, 0 ); }); -test( "ui-accordion-heading class added to headers anchor", function() { - expect( 1 ); - var element = $( "#list1" ).accordion(); - var anchors = element.find( ".ui-accordion-heading" ); - equal( anchors.length, 3 ); -}); - test( "accessibility", function () { expect( 13 ); var element = $( "#list1" ).accordion().accordion( "option", "active", 1 ); diff --git a/tests/unit/accordion/accordion_deprecated.html b/tests/unit/accordion/accordion_deprecated.html index f730d8029f0..583c1adcd86 100644 --- a/tests/unit/accordion/accordion_deprecated.html +++ b/tests/unit/accordion/accordion_deprecated.html @@ -49,7 +49,7 @@

    -

    There is one obvious advantage:

    +

    There is one obvious advantage:

    You've seen it coming! @@ -59,7 +59,7 @@

    There is one obvious advantage:

    Well, at least no free beer. Perhaps a bear, if you can afford it.

    -

    Now that you've got...

    +

    Now that you've got...

    your bear, you have to admit it! @@ -70,7 +70,7 @@

    Now that you've got...

    We could talk about renting one.

    -

    Rent one bear, ...

    +

    Rent one bear, ...

    get two for three beer. @@ -118,19 +118,19 @@

    Drums

    - Accordion Header 1 + Accordion Header 1
    Accordion Content 1
    - Accordion Header 2 + Accordion Header 2
    Accordion Content 2
    - Accordion Header 3 + Accordion Header 3
    Accordion Content 3 diff --git a/themes/base/jquery.ui.accordion.css b/themes/base/jquery.ui.accordion.css index 721ef336e69..2a423949cb7 100644 --- a/themes/base/jquery.ui.accordion.css +++ b/themes/base/jquery.ui.accordion.css @@ -9,11 +9,10 @@ */ /* IE/Win - Fix animation bug - #4615 */ .ui-accordion { width: 100%; } -.ui-accordion .ui-accordion-header { cursor: pointer; position: relative; margin-top: 2px; zoom: 1; } -.ui-accordion .ui-accordion-heading { display: block; font-size: 1em; padding: .5em .5em .5em .7em; } -.ui-accordion-icons a.ui-accordion-heading { padding-left: 2.2em; } -.ui-accordion-noicons a.ui-accordion-heading { padding-left: .7em; } -.ui-accordion-icons .ui-accordion-icons a.ui-accordion-heading { padding-left: 2.2em; } +.ui-accordion .ui-accordion-header { display: block; cursor: pointer; position: relative; margin-top: 2px; padding: .5em .5em .5em .7em; zoom: 1; } +.ui-accordion .ui-accordion-icons { padding-left: 2.2em; } +.ui-accordion .ui-accordion-noicons { padding-left: .7em; } +.ui-accordion .ui-accordion-icons .ui-accordion-icons { padding-left: 2.2em; } .ui-accordion .ui-accordion-header .ui-accordion-header-icon { position: absolute; left: .5em; top: 50%; margin-top: -8px; } .ui-accordion .ui-accordion-content { padding: 1em 2.2em; border-top: 0; overflow: auto; display: none; zoom: 1; } .ui-accordion .ui-accordion-content-active { display: block; } diff --git a/ui/jquery.ui.accordion.js b/ui/jquery.ui.accordion.js index 01600ba4e98..48e964a9447 100644 --- a/ui/jquery.ui.accordion.js +++ b/ui/jquery.ui.accordion.js @@ -42,7 +42,6 @@ $.widget( "ui.accordion", { .addClass( "ui-accordion-header ui-helper-reset ui-state-default ui-corner-all" ); this._hoverable( this.headers ); this._focusable( this.headers ); - this.headers.find( ":first-child" ).addClass( "ui-accordion-heading" ); this.headers.next() .addClass( "ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom" ); @@ -95,11 +94,6 @@ $.widget( "ui.accordion", { }); } - // only need links in tab order for Safari - if ( !$.browser.safari ) { - this.headers.find( "a" ).attr( "tabIndex", -1 ); - } - this._setupEvents( options.event ); }, @@ -146,9 +140,6 @@ $.widget( "ui.accordion", { .removeAttr( "tabIndex" ) .find( "a" ) .removeAttr( "tabIndex" ) - .end() - .find( ".ui-accordion-heading" ) - .removeClass( "ui-accordion-heading" ); this._destroyIcons(); // clean up content panels From 1d2fcaddadbb1ad313e3d7c5018f2fd9f31ce1e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Scott=20Gonz=C3=A1lez?= Date: Mon, 27 Feb 2012 09:34:00 -0500 Subject: [PATCH 11/18] Accordion: Removed width: 100% on accordion wrapper which was used to fix an animation bug that no longer exists with the new animation code. Fixes #8140 - nested accordion is oversized. --- themes/base/jquery.ui.accordion.css | 2 -- 1 file changed, 2 deletions(-) diff --git a/themes/base/jquery.ui.accordion.css b/themes/base/jquery.ui.accordion.css index 2a423949cb7..18e087e8f39 100644 --- a/themes/base/jquery.ui.accordion.css +++ b/themes/base/jquery.ui.accordion.css @@ -7,8 +7,6 @@ * * http://docs.jquery.com/UI/Accordion#theming */ -/* IE/Win - Fix animation bug - #4615 */ -.ui-accordion { width: 100%; } .ui-accordion .ui-accordion-header { display: block; cursor: pointer; position: relative; margin-top: 2px; padding: .5em .5em .5em .7em; zoom: 1; } .ui-accordion .ui-accordion-icons { padding-left: 2.2em; } .ui-accordion .ui-accordion-noicons { padding-left: .7em; } From 9d6e94faf4030fd287120098d7395463d8acb698 Mon Sep 17 00:00:00 2001 From: Trey Hunner Date: Mon, 27 Feb 2012 08:48:17 -0800 Subject: [PATCH 12/18] Use hard tabs for indentation consistently --- ui/i18n/jquery.ui.datepicker-bg.js | 30 ++++++++-------- ui/i18n/jquery.ui.datepicker-cs.js | 2 +- ui/i18n/jquery.ui.datepicker-da.js | 16 ++++----- ui/i18n/jquery.ui.datepicker-fi.js | 14 ++++---- ui/i18n/jquery.ui.datepicker-fr.js | 4 +-- ui/i18n/jquery.ui.datepicker-no.js | 36 +++++++++---------- ui/i18n/jquery.ui.datepicker-sv.js | 16 ++++----- ui/jquery.effects.blind.js | 2 +- ui/jquery.ui.datepicker.js | 16 ++++----- ui/jquery.ui.draggable.js | 26 +++++++------- ui/jquery.ui.mouse.js | 4 +-- ui/jquery.ui.resizable.js | 56 +++++++++++++++--------------- ui/jquery.ui.tabs.js | 2 +- 13 files changed, 112 insertions(+), 112 deletions(-) diff --git a/ui/i18n/jquery.ui.datepicker-bg.js b/ui/i18n/jquery.ui.datepicker-bg.js index 4e0ee2f509f..86ab885828b 100644 --- a/ui/i18n/jquery.ui.datepicker-bg.js +++ b/ui/i18n/jquery.ui.datepicker-bg.js @@ -1,24 +1,24 @@ /* Bulgarian initialisation for the jQuery UI date picker plugin. */ /* Written by Stoyan Kyosev (http://svest.org). */ jQuery(function($){ - $.datepicker.regional['bg'] = { - closeText: 'затвори', - prevText: '<назад', - nextText: 'напред>', + $.datepicker.regional['bg'] = { + closeText: 'затвори', + prevText: '<назад', + nextText: 'напред>', nextBigText: '>>', - currentText: 'днес', - monthNames: ['Януари','Февруари','Март','Април','Май','Юни', - 'Юли','Август','Септември','Октомври','Ноември','Декември'], - monthNamesShort: ['Яну','Фев','Мар','Апр','Май','Юни', - 'Юли','Авг','Сеп','Окт','Нов','Дек'], - dayNames: ['Неделя','Понеделник','Вторник','Сряда','Четвъртък','Петък','Събота'], - dayNamesShort: ['Нед','Пон','Вто','Сря','Чет','Пет','Съб'], - dayNamesMin: ['Не','По','Вт','Ср','Че','Пе','Съ'], + currentText: 'днес', + monthNames: ['Януари','Февруари','Март','Април','Май','Юни', + 'Юли','Август','Септември','Октомври','Ноември','Декември'], + monthNamesShort: ['Яну','Фев','Мар','Апр','Май','Юни', + 'Юли','Авг','Сеп','Окт','Нов','Дек'], + dayNames: ['Неделя','Понеделник','Вторник','Сряда','Четвъртък','Петък','Събота'], + dayNamesShort: ['Нед','Пон','Вто','Сря','Чет','Пет','Съб'], + dayNamesMin: ['Не','По','Вт','Ср','Че','Пе','Съ'], weekHeader: 'Wk', - dateFormat: 'dd.mm.yy', + dateFormat: 'dd.mm.yy', firstDay: 1, - isRTL: false, + isRTL: false, showMonthAfterYear: false, yearSuffix: ''}; - $.datepicker.setDefaults($.datepicker.regional['bg']); + $.datepicker.setDefaults($.datepicker.regional['bg']); }); diff --git a/ui/i18n/jquery.ui.datepicker-cs.js b/ui/i18n/jquery.ui.datepicker-cs.js index bf56baf01ef..b96b1a51c2d 100644 --- a/ui/i18n/jquery.ui.datepicker-cs.js +++ b/ui/i18n/jquery.ui.datepicker-cs.js @@ -7,7 +7,7 @@ jQuery(function($){ nextText: 'Později>', currentText: 'Nyní', monthNames: ['leden','únor','březen','duben','květen','červen', - 'červenec','srpen','září','říjen','listopad','prosinec'], + 'červenec','srpen','září','říjen','listopad','prosinec'], monthNamesShort: ['led','úno','bře','dub','kvě','čer', 'čvc','srp','zář','říj','lis','pro'], dayNames: ['neděle', 'pondělí', 'úterý', 'středa', 'čtvrtek', 'pátek', 'sobota'], diff --git a/ui/i18n/jquery.ui.datepicker-da.js b/ui/i18n/jquery.ui.datepicker-da.js index fb2d3356d78..7e42948b344 100644 --- a/ui/i18n/jquery.ui.datepicker-da.js +++ b/ui/i18n/jquery.ui.datepicker-da.js @@ -1,23 +1,23 @@ /* Danish initialisation for the jQuery UI date picker plugin. */ /* Written by Jan Christensen ( deletestuff@gmail.com). */ jQuery(function($){ - $.datepicker.regional['da'] = { + $.datepicker.regional['da'] = { closeText: 'Luk', - prevText: '<Forrige', + prevText: '<Forrige', nextText: 'Næste>', currentText: 'Idag', - monthNames: ['Januar','Februar','Marts','April','Maj','Juni', - 'Juli','August','September','Oktober','November','December'], - monthNamesShort: ['Jan','Feb','Mar','Apr','Maj','Jun', - 'Jul','Aug','Sep','Okt','Nov','Dec'], + monthNames: ['Januar','Februar','Marts','April','Maj','Juni', + 'Juli','August','September','Oktober','November','December'], + monthNamesShort: ['Jan','Feb','Mar','Apr','Maj','Jun', + 'Jul','Aug','Sep','Okt','Nov','Dec'], dayNames: ['Søndag','Mandag','Tirsdag','Onsdag','Torsdag','Fredag','Lørdag'], dayNamesShort: ['Søn','Man','Tir','Ons','Tor','Fre','Lør'], dayNamesMin: ['Sø','Ma','Ti','On','To','Fr','Lø'], weekHeader: 'Uge', - dateFormat: 'dd-mm-yy', + dateFormat: 'dd-mm-yy', firstDay: 1, isRTL: false, showMonthAfterYear: false, yearSuffix: ''}; - $.datepicker.setDefaults($.datepicker.regional['da']); + $.datepicker.setDefaults($.datepicker.regional['da']); }); diff --git a/ui/i18n/jquery.ui.datepicker-fi.js b/ui/i18n/jquery.ui.datepicker-fi.js index ece04e3b254..1eae6c23ba2 100644 --- a/ui/i18n/jquery.ui.datepicker-fi.js +++ b/ui/i18n/jquery.ui.datepicker-fi.js @@ -1,23 +1,23 @@ /* Finnish initialisation for the jQuery UI date picker plugin. */ /* Written by Harri Kilpi� (harrikilpio@gmail.com). */ jQuery(function($){ - $.datepicker.regional['fi'] = { + $.datepicker.regional['fi'] = { closeText: 'Sulje', prevText: '«Edellinen', nextText: 'Seuraava»', currentText: 'Tänään', - monthNames: ['Tammikuu','Helmikuu','Maaliskuu','Huhtikuu','Toukokuu','Kesäkuu', - 'Heinäkuu','Elokuu','Syyskuu','Lokakuu','Marraskuu','Joulukuu'], - monthNamesShort: ['Tammi','Helmi','Maalis','Huhti','Touko','Kesä', - 'Heinä','Elo','Syys','Loka','Marras','Joulu'], + monthNames: ['Tammikuu','Helmikuu','Maaliskuu','Huhtikuu','Toukokuu','Kesäkuu', + 'Heinäkuu','Elokuu','Syyskuu','Lokakuu','Marraskuu','Joulukuu'], + monthNamesShort: ['Tammi','Helmi','Maalis','Huhti','Touko','Kesä', + 'Heinä','Elo','Syys','Loka','Marras','Joulu'], dayNamesShort: ['Su','Ma','Ti','Ke','To','Pe','Su'], dayNames: ['Sunnuntai','Maanantai','Tiistai','Keskiviikko','Torstai','Perjantai','Lauantai'], dayNamesMin: ['Su','Ma','Ti','Ke','To','Pe','La'], weekHeader: 'Vk', - dateFormat: 'dd.mm.yy', + dateFormat: 'dd.mm.yy', firstDay: 1, isRTL: false, showMonthAfterYear: false, yearSuffix: ''}; - $.datepicker.setDefaults($.datepicker.regional['fi']); + $.datepicker.setDefaults($.datepicker.regional['fi']); }); diff --git a/ui/i18n/jquery.ui.datepicker-fr.js b/ui/i18n/jquery.ui.datepicker-fr.js index 7e793639f5f..934afd1d023 100644 --- a/ui/i18n/jquery.ui.datepicker-fr.js +++ b/ui/i18n/jquery.ui.datepicker-fr.js @@ -1,7 +1,7 @@ /* French initialisation for the jQuery UI date picker plugin. */ /* Written by Keith Wood (kbwood{at}iinet.com.au), - Stéphane Nahmani (sholby@sholby.net), - Stéphane Raimbault */ + Stéphane Nahmani (sholby@sholby.net), + Stéphane Raimbault */ jQuery(function($){ $.datepicker.regional['fr'] = { closeText: 'Fermer', diff --git a/ui/i18n/jquery.ui.datepicker-no.js b/ui/i18n/jquery.ui.datepicker-no.js index 9590592f8e8..d36e430be6d 100644 --- a/ui/i18n/jquery.ui.datepicker-no.js +++ b/ui/i18n/jquery.ui.datepicker-no.js @@ -2,22 +2,22 @@ /* Written by Naimdjon Takhirov (naimdjon@gmail.com). */ jQuery(function($){ - $.datepicker.regional['no'] = { - closeText: 'Lukk', - prevText: '«Forrige', - nextText: 'Neste»', - currentText: 'I dag', - monthNames: ['januar','februar','mars','april','mai','juni','juli','august','september','oktober','november','desember'], - monthNamesShort: ['jan','feb','mar','apr','mai','jun','jul','aug','sep','okt','nov','des'], - dayNamesShort: ['søn','man','tir','ons','tor','fre','lør'], - dayNames: ['søndag','mandag','tirsdag','onsdag','torsdag','fredag','lørdag'], - dayNamesMin: ['sø','ma','ti','on','to','fr','lø'], - weekHeader: 'Uke', - dateFormat: 'dd.mm.yy', - firstDay: 1, - isRTL: false, - showMonthAfterYear: false, - yearSuffix: '' - }; - $.datepicker.setDefaults($.datepicker.regional['no']); + $.datepicker.regional['no'] = { + closeText: 'Lukk', + prevText: '«Forrige', + nextText: 'Neste»', + currentText: 'I dag', + monthNames: ['januar','februar','mars','april','mai','juni','juli','august','september','oktober','november','desember'], + monthNamesShort: ['jan','feb','mar','apr','mai','jun','jul','aug','sep','okt','nov','des'], + dayNamesShort: ['søn','man','tir','ons','tor','fre','lør'], + dayNames: ['søndag','mandag','tirsdag','onsdag','torsdag','fredag','lørdag'], + dayNamesMin: ['sø','ma','ti','on','to','fr','lø'], + weekHeader: 'Uke', + dateFormat: 'dd.mm.yy', + firstDay: 1, + isRTL: false, + showMonthAfterYear: false, + yearSuffix: '' + }; + $.datepicker.setDefaults($.datepicker.regional['no']); }); diff --git a/ui/i18n/jquery.ui.datepicker-sv.js b/ui/i18n/jquery.ui.datepicker-sv.js index 173689b2a96..cbb5ad135c5 100644 --- a/ui/i18n/jquery.ui.datepicker-sv.js +++ b/ui/i18n/jquery.ui.datepicker-sv.js @@ -1,23 +1,23 @@ /* Swedish initialisation for the jQuery UI date picker plugin. */ /* Written by Anders Ekdahl ( anders@nomadiz.se). */ jQuery(function($){ - $.datepicker.regional['sv'] = { + $.datepicker.regional['sv'] = { closeText: 'Stäng', - prevText: '«Förra', + prevText: '«Förra', nextText: 'Nästa»', currentText: 'Idag', - monthNames: ['Januari','Februari','Mars','April','Maj','Juni', - 'Juli','Augusti','September','Oktober','November','December'], - monthNamesShort: ['Jan','Feb','Mar','Apr','Maj','Jun', - 'Jul','Aug','Sep','Okt','Nov','Dec'], + monthNames: ['Januari','Februari','Mars','April','Maj','Juni', + 'Juli','Augusti','September','Oktober','November','December'], + monthNamesShort: ['Jan','Feb','Mar','Apr','Maj','Jun', + 'Jul','Aug','Sep','Okt','Nov','Dec'], dayNamesShort: ['Sön','Mån','Tis','Ons','Tor','Fre','Lör'], dayNames: ['Söndag','Måndag','Tisdag','Onsdag','Torsdag','Fredag','Lördag'], dayNamesMin: ['Sö','Må','Ti','On','To','Fr','Lö'], weekHeader: 'Ve', - dateFormat: 'yy-mm-dd', + dateFormat: 'yy-mm-dd', firstDay: 1, isRTL: false, showMonthAfterYear: false, yearSuffix: ''}; - $.datepicker.setDefaults($.datepicker.regional['sv']); + $.datepicker.setDefaults($.datepicker.regional['sv']); }); diff --git a/ui/jquery.effects.blind.js b/ui/jquery.effects.blind.js index 0380b262add..0e3f25db71a 100644 --- a/ui/jquery.effects.blind.js +++ b/ui/jquery.effects.blind.js @@ -50,7 +50,7 @@ $.effects.effect.blind = function( o, done ) { .css( vertical ? "top" : "left", "auto" ) .css({ position: "absolute" }); - animation[ ref2 ] = show ? margin : distance + margin; + animation[ ref2 ] = show ? margin : distance + margin; } // start at 0 if we are showing diff --git a/ui/jquery.ui.datepicker.js b/ui/jquery.ui.datepicker.js index 2a1699bd10d..529032a9988 100644 --- a/ui/jquery.ui.datepicker.js +++ b/ui/jquery.ui.datepicker.js @@ -628,7 +628,7 @@ $.extend(Datepicker.prototype, { }, /* Pop-up the date picker for a given input field. - If false returned from beforeShow event handler do not show. + If false returned from beforeShow event handler do not show. @param input element - the input field attached to the date picker or event - if triggered by focus */ _showDatepicker: function(input) { @@ -647,7 +647,7 @@ $.extend(Datepicker.prototype, { var beforeShow = $.datepicker._get(inst, 'beforeShow'); var beforeShowSettings = beforeShow ? beforeShow.apply(input, [input, inst]) : {}; if(beforeShowSettings === false){ - //false + //false return; } extendRemove(inst.settings, beforeShowSettings); @@ -785,11 +785,11 @@ $.extend(Datepicker.prototype, { _findPos: function(obj) { var inst = this._getInst(obj); var isRTL = this._get(inst, 'isRTL'); - while (obj && (obj.type == 'hidden' || obj.nodeType != 1 || $.expr.filters.hidden(obj))) { - obj = obj[isRTL ? 'previousSibling' : 'nextSibling']; - } - var position = $(obj).offset(); - return [position.left, position.top]; + while (obj && (obj.type == 'hidden' || obj.nodeType != 1 || $.expr.filters.hidden(obj))) { + obj = obj[isRTL ? 'previousSibling' : 'nextSibling']; + } + var position = $(obj).offset(); + return [position.left, position.top]; }, /* Hide the date picker from view. @@ -1784,7 +1784,7 @@ function isArray(a) { /* Invoke the datepicker functionality. @param options string - a command, optionally followed by additional parameters or - Object - settings for attaching new datepicker functionality + Object - settings for attaching new datepicker functionality @return jQuery object */ $.fn.datepicker = function(options){ diff --git a/ui/jquery.ui.draggable.js b/ui/jquery.ui.draggable.js index ccc1fe81bbd..62864454d50 100644 --- a/ui/jquery.ui.draggable.js +++ b/ui/jquery.ui.draggable.js @@ -370,7 +370,7 @@ $.widget("ui.draggable", $.ui.mouse, { ]; if(!(/^(document|window|parent)$/).test(o.containment) && o.containment.constructor != Array) { - var c = $(o.containment); + var c = $(o.containment); var ce = c[0]; if(!ce) return; var co = c.offset(); var over = ($(ce).css("overflow") != 'hidden'); @@ -424,18 +424,18 @@ $.widget("ui.draggable", $.ui.mouse, { */ if(this.originalPosition) { //If we are not dragging yet, we won't check for options - var containment; - if(this.containment) { - if (this.relative_container){ - var co = this.relative_container.offset(); - containment = [ this.containment[0] + co.left, - this.containment[1] + co.top, - this.containment[2] + co.left, - this.containment[3] + co.top ]; - } - else { - containment = this.containment; - } + var containment; + if(this.containment) { + if (this.relative_container){ + var co = this.relative_container.offset(); + containment = [ this.containment[0] + co.left, + this.containment[1] + co.top, + this.containment[2] + co.left, + this.containment[3] + co.top ]; + } + else { + containment = this.containment; + } if(event.pageX - this.offset.click.left < containment[0]) pageX = containment[0] + this.offset.click.left; if(event.pageY - this.offset.click.top < containment[1]) pageY = containment[1] + this.offset.click.top; diff --git a/ui/jquery.ui.mouse.js b/ui/jquery.ui.mouse.js index b1826aa233c..4ff18ff4f3c 100644 --- a/ui/jquery.ui.mouse.js +++ b/ui/jquery.ui.mouse.js @@ -33,7 +33,7 @@ $.widget("ui.mouse", { }) .bind('click.'+this.widgetName, function(event) { if (true === $.data(event.target, that.widgetName + '.preventClickEvent')) { - $.removeData(event.target, that.widgetName + '.preventClickEvent'); + $.removeData(event.target, that.widgetName + '.preventClickEvent'); event.stopImmediatePropagation(); return false; } @@ -132,7 +132,7 @@ $.widget("ui.mouse", { this._mouseStarted = false; if (event.target == this._mouseDownEvent.target) { - $.data(event.target, this.widgetName + '.preventClickEvent', true); + $.data(event.target, this.widgetName + '.preventClickEvent', true); } this._mouseStop(event); diff --git a/ui/jquery.ui.resizable.js b/ui/jquery.ui.resizable.js index d1745a0c7d8..34efe834a35 100644 --- a/ui/jquery.ui.resizable.js +++ b/ui/jquery.ui.resizable.js @@ -265,8 +265,8 @@ $.widget("ui.resizable", $.ui.mouse, { //Aspect Ratio this.aspectRatio = (typeof o.aspectRatio == 'number') ? o.aspectRatio : ((this.originalSize.width / this.originalSize.height) || 1); - var cursor = $('.ui-resizable-' + this.axis).css('cursor'); - $('body').css('cursor', cursor == 'auto' ? this.axis + '-resize' : cursor); + var cursor = $('.ui-resizable-' + this.axis).css('cursor'); + $('body').css('cursor', cursor == 'auto' ? this.axis + '-resize' : cursor); el.addClass("ui-resizable-resizing"); this._propagate("start", event); @@ -346,31 +346,31 @@ $.widget("ui.resizable", $.ui.mouse, { }, - _updateVirtualBoundaries: function(forceAspectRatio) { - var o = this.options, pMinWidth, pMaxWidth, pMinHeight, pMaxHeight, b; - - b = { - minWidth: isNumber(o.minWidth) ? o.minWidth : 0, - maxWidth: isNumber(o.maxWidth) ? o.maxWidth : Infinity, - minHeight: isNumber(o.minHeight) ? o.minHeight : 0, - maxHeight: isNumber(o.maxHeight) ? o.maxHeight : Infinity - }; - - if(this._aspectRatio || forceAspectRatio) { - // We want to create an enclosing box whose aspect ration is the requested one - // First, compute the "projected" size for each dimension based on the aspect ratio and other dimension - pMinWidth = b.minHeight * this.aspectRatio; - pMinHeight = b.minWidth / this.aspectRatio; - pMaxWidth = b.maxHeight * this.aspectRatio; - pMaxHeight = b.maxWidth / this.aspectRatio; - - if(pMinWidth > b.minWidth) b.minWidth = pMinWidth; - if(pMinHeight > b.minHeight) b.minHeight = pMinHeight; - if(pMaxWidth < b.maxWidth) b.maxWidth = pMaxWidth; - if(pMaxHeight < b.maxHeight) b.maxHeight = pMaxHeight; - } - this._vBoundaries = b; - }, + _updateVirtualBoundaries: function(forceAspectRatio) { + var o = this.options, pMinWidth, pMaxWidth, pMinHeight, pMaxHeight, b; + + b = { + minWidth: isNumber(o.minWidth) ? o.minWidth : 0, + maxWidth: isNumber(o.maxWidth) ? o.maxWidth : Infinity, + minHeight: isNumber(o.minHeight) ? o.minHeight : 0, + maxHeight: isNumber(o.maxHeight) ? o.maxHeight : Infinity + }; + + if(this._aspectRatio || forceAspectRatio) { + // We want to create an enclosing box whose aspect ration is the requested one + // First, compute the "projected" size for each dimension based on the aspect ratio and other dimension + pMinWidth = b.minHeight * this.aspectRatio; + pMinHeight = b.minWidth / this.aspectRatio; + pMaxWidth = b.maxHeight * this.aspectRatio; + pMaxHeight = b.maxWidth / this.aspectRatio; + + if(pMinWidth > b.minWidth) b.minWidth = pMinWidth; + if(pMinHeight > b.minHeight) b.minHeight = pMinHeight; + if(pMaxWidth < b.maxWidth) b.maxWidth = pMaxWidth; + if(pMaxHeight < b.maxHeight) b.maxHeight = pMaxHeight; + } + this._vBoundaries = b; + }, _updateCache: function(data) { var o = this.options; @@ -705,7 +705,7 @@ $.ui.plugin.add("resizable", "containment", { hoset = Math.abs( (self._helper ? self.offset.top - cop.top : (self.offset.top - co.top)) + self.sizeDiff.height ); var isParent = self.containerElement.get(0) == self.element.parent().get(0), - isOffsetRelative = /relative|absolute/.test(self.containerElement.css('position')); + isOffsetRelative = /relative|absolute/.test(self.containerElement.css('position')); if(isParent && isOffsetRelative) woset -= self.parentData.left; diff --git a/ui/jquery.ui.tabs.js b/ui/jquery.ui.tabs.js index 6e5cde07e03..90f021a6957 100644 --- a/ui/jquery.ui.tabs.js +++ b/ui/jquery.ui.tabs.js @@ -430,7 +430,7 @@ $.widget( "ui.tabs", { typeof selector === "string" ? this.anchors.filter( "[href$='" + selector + "']" ) : $(); }, - _getIndex: function( index ) { + _getIndex: function( index ) { // meta-function to give users option to provide a href string instead of a numerical index. // also sanitizes numerical indexes to valid values. if ( typeof index == "string" ) { From 70de33ae6d32416b0167c34c1a9951acfaaaf992 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Scott=20Gonz=C3=A1lez?= Date: Mon, 27 Feb 2012 16:22:42 -0500 Subject: [PATCH 13/18] Core: Fixed typo. Thanks jsgoupil --- ui/jquery.ui.core.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/jquery.ui.core.js b/ui/jquery.ui.core.js index 5f0414ec8cc..6345ef69cd2 100644 --- a/ui/jquery.ui.core.js +++ b/ui/jquery.ui.core.js @@ -214,7 +214,7 @@ $(function() { div = body.appendChild( div = document.createElement( "div" ) ); // access offsetHeight before setting the style to prevent a layout bug - // in IE 9 which causes the elemnt to continue to take up space even + // in IE 9 which causes the element to continue to take up space even // after it is removed from the DOM (#8026) div.offsetHeight; From 6ba18b597afc9a346b71ea699e7b6cd5b695dd83 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Scott=20Gonz=C3=A1lez?= Date: Wed, 29 Feb 2012 10:42:20 -0500 Subject: [PATCH 14/18] Accordion: Removed mouseover demo. We shouldn't demo bad UX choices. --- demos/accordion/index.html | 1 - demos/accordion/mouseover.html | 57 ---------------------------------- 2 files changed, 58 deletions(-) delete mode 100644 demos/accordion/mouseover.html diff --git a/demos/accordion/index.html b/demos/accordion/index.html index d107dd881d4..81ed971d824 100644 --- a/demos/accordion/index.html +++ b/demos/accordion/index.html @@ -14,7 +14,6 @@

    Examples

  • Fill space
  • No auto height
  • Collapse content
  • -
  • Open on mouseover
  • Open on hoverintent
  • Customize icons
  • Sortable
  • diff --git a/demos/accordion/mouseover.html b/demos/accordion/mouseover.html deleted file mode 100644 index cbf6a78ac9e..00000000000 --- a/demos/accordion/mouseover.html +++ /dev/null @@ -1,57 +0,0 @@ - - - - - jQuery UI Accordion - Open on mouseover - - - - - - - - - - -
    - -
    -

    Section 1

    -
    -

    Mauris mauris ante, blandit et, ultrices a, suscipit eget, quam. Integer ut neque. Vivamus nisi metus, molestie vel, gravida in, condimentum sit amet, nunc. Nam a nibh. Donec suscipit eros. Nam mi. Proin viverra leo ut odio. Curabitur malesuada. Vestibulum a velit eu ante scelerisque vulputate.

    -
    -

    Section 2

    -
    -

    Sed non urna. Donec et ante. Phasellus eu ligula. Vestibulum sit amet purus. Vivamus hendrerit, dolor at aliquet laoreet, mauris turpis porttitor velit, faucibus interdum tellus libero ac justo. Vivamus non quam. In suscipit faucibus urna.

    -
    -

    Section 3

    -
    -

    Nam enim risus, molestie et, porta ac, aliquam ac, risus. Quisque lobortis. Phasellus pellentesque purus in massa. Aenean in pede. Phasellus ac libero ac tellus pellentesque semper. Sed ac felis. Sed commodo, magna quis lacinia ornare, quam ante aliquam nisi, eu iaculis leo purus venenatis dui.

    -
      -
    • List item one
    • -
    • List item two
    • -
    • List item three
    • -
    -
    -

    Section 4

    -
    -

    Cras dictum. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Aenean lacinia mauris vel est.

    Suspendisse eu nisl. Nullam ut libero. Integer dignissim consequat lectus. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos.

    -
    -
    - -
    - - - -
    -

    Toggle sections open/closed on mouseover with the event option. The default value for event is "click."

    -
    - - - From e6b7486abf2e0f98837e76027084fad6fe908cff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=CC=88rn=20Zaefferer?= Date: Tue, 28 Feb 2012 15:45:24 +0100 Subject: [PATCH 15/18] Datepicker: Fix a bad assertion - actual result is valid. --- tests/unit/datepicker/datepicker_options.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/unit/datepicker/datepicker_options.js b/tests/unit/datepicker/datepicker_options.js index 272af9dac23..120a18c7333 100644 --- a/tests/unit/datepicker/datepicker_options.js +++ b/tests/unit/datepicker/datepicker_options.js @@ -265,7 +265,7 @@ test('miscellaneous', function() { var curYear = new Date().getFullYear(); inp.val('02/04/2008').datepicker('show'); equals(dp.find('.ui-datepicker-year').text(), '2008', 'Year range - read-only default'); - inp.datepicker('hide').datepicker('option', {changeYear: true}).datepicker('show'); + inp.datepicker('hide').datepicker('option', {changeYear: true}).datepicker('show'); equals(dp.find('.ui-datepicker-year').text(), genRange(2008 - 10, 21), 'Year range - changeable default'); inp.datepicker('hide').datepicker('option', {yearRange: 'c-6:c+2', changeYear: true}).datepicker('show'); equals(dp.find('.ui-datepicker-year').text(), genRange(2008 - 6, 9), 'Year range - c-6:c+2'); @@ -507,11 +507,11 @@ test('altField', function() { inp.simulate('keydown', {ctrlKey: true, keyCode: $.simulate.VK_END}); equals(inp.val(), '', 'Alt field - dp - ctrl+end'); equals(alt.val(), '', 'Alt field - alt - ctrl+end'); - + return // TODO manual entry impl works (see altField demo) but this test doesn't // probably something the rewrite won't cover anymore anyway - + // Verify alt field is updated on keyup alt.val(''); inp.val('06/04/200').datepicker('show'); @@ -559,7 +559,7 @@ test('autoSize', function() { inp.datepicker('option', 'dateFormat', 'm/d/yy'); equals(inp.prop('size'), 10, 'Auto size - he - m/d/yy'); inp.datepicker('option', 'dateFormat', 'D M d yy'); - equals(inp.prop('size'), 14, 'Auto size - he - D M d yy'); + equals(inp.prop('size'), 16, 'Auto size - he - D M d yy'); inp.datepicker('option', 'dateFormat', 'DD, MM dd, yy'); equals(inp.prop('size'), 23, 'Auto size - he - DD, MM dd, yy'); }); From 72023dd045a7fead5a3136ec2400ad4743a190d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=CC=88rn=20Zaefferer?= Date: Tue, 28 Feb 2012 15:56:32 +0100 Subject: [PATCH 16/18] Update to QUnit 1.3. Replace usage of same with deepEqual and equals with equal. --- external/qunit.css | 11 +- external/qunit.js | 760 +++++++++++------- tests/unit/accordion/accordion_events.js | 12 +- tests/unit/button/button_core.js | 24 +- tests/unit/button/button_options.js | 38 +- tests/unit/core/core.js | 70 +- tests/unit/datepicker/datepicker_core.js | 70 +- tests/unit/datepicker/datepicker_events.js | 50 +- tests/unit/datepicker/datepicker_options.js | 304 +++---- tests/unit/datepicker/datepicker_tickets.js | 16 +- tests/unit/dialog/dialog_core.js | 18 +- tests/unit/dialog/dialog_events.js | 84 +- tests/unit/dialog/dialog_methods.js | 30 +- tests/unit/dialog/dialog_options.js | 154 ++-- tests/unit/dialog/dialog_tickets.js | 16 +- tests/unit/draggable/draggable_core.js | 2 +- tests/unit/draggable/draggable_events.js | 18 +- tests/unit/draggable/draggable_methods.js | 18 +- tests/unit/draggable/draggable_options.js | 148 ++-- tests/unit/droppable/droppable_methods.js | 20 +- tests/unit/droppable/droppable_options.js | 4 +- tests/unit/menu/menu_core.js | 12 +- tests/unit/menu/menu_events.js | 116 +-- tests/unit/menu/menu_methods.js | 8 +- tests/unit/menu/menu_options.js | 4 +- tests/unit/position/position_core.js | 70 +- tests/unit/position/position_core_within.js | 56 +- tests/unit/position/position_deprecated.js | 6 +- tests/unit/progressbar/progressbar_core.js | 14 +- tests/unit/progressbar/progressbar_events.js | 10 +- tests/unit/progressbar/progressbar_methods.js | 10 +- tests/unit/progressbar/progressbar_options.js | 10 +- tests/unit/resizable/resizable_core.js | 50 +- tests/unit/resizable/resizable_methods.js | 6 +- tests/unit/resizable/resizable_options.js | 104 +-- tests/unit/selectable/selectable_events.js | 4 +- tests/unit/selectable/selectable_methods.js | 18 +- tests/unit/selectable/selectable_options.js | 8 +- tests/unit/slider/slider_core.js | 68 +- tests/unit/slider/slider_events.js | 22 +- tests/unit/slider/slider_methods.js | 28 +- tests/unit/slider/slider_options.js | 26 +- tests/unit/sortable/sortable_methods.js | 18 +- tests/unit/sortable/sortable_tickets.js | 4 +- tests/unit/spinner/spinner_methods.js | 58 +- tests/unit/spinner/spinner_options.js | 36 +- tests/unit/tabs/tabs.html | 6 +- tests/unit/tabs/tabs_core.js | 8 +- tests/unit/tabs/tabs_deprecated.html | 6 +- tests/unit/tabs/tabs_deprecated.js | 126 +-- tests/unit/tabs/tabs_events.js | 118 +-- tests/unit/tabs/tabs_methods.js | 28 +- tests/unit/tabs/tabs_options.js | 22 +- tests/unit/testsuite.js | 8 +- tests/unit/tooltip/tooltip_events.js | 12 +- tests/unit/tooltip/tooltip_methods.js | 4 +- tests/unit/tooltip/tooltip_options.js | 14 +- tests/unit/widget/widget_core.js | 204 ++--- 58 files changed, 1688 insertions(+), 1501 deletions(-) diff --git a/external/qunit.css b/external/qunit.css index b3c6db5237a..3334e21de9e 100644 --- a/external/qunit.css +++ b/external/qunit.css @@ -1,9 +1,9 @@ /** - * QUnit - A JavaScript Unit Testing Framework + * QUnit v1.3.0 - A JavaScript Unit Testing Framework * * http://docs.jquery.com/QUnit * - * Copyright (c) 2011 John Resig, Jörn Zaefferer + * Copyright (c) 2012 John Resig, Jörn Zaefferer * Dual licensed under the MIT (MIT-LICENSE.txt) * or GPL (GPL-LICENSE.txt) licenses. */ @@ -54,6 +54,10 @@ color: #fff; } +#qunit-header label { + display: inline-block; +} + #qunit-banner { height: 5px; } @@ -186,6 +190,7 @@ color: #710909; background-color: #fff; border-left: 26px solid #EE5757; + white-space: pre; } #qunit-tests > li:last-child { @@ -222,4 +227,6 @@ position: absolute; top: -10000px; left: -10000px; + width: 1000px; + height: 1000px; } diff --git a/external/qunit.js b/external/qunit.js index a1b3fa5e9d4..cd5631d86ab 100644 --- a/external/qunit.js +++ b/external/qunit.js @@ -1,9 +1,9 @@ /** - * QUnit - A JavaScript Unit Testing Framework + * QUnit v1.3.0 - A JavaScript Unit Testing Framework * * http://docs.jquery.com/QUnit * - * Copyright (c) 2011 John Resig, Jörn Zaefferer + * Copyright (c) 2012 John Resig, Jörn Zaefferer * Dual licensed under the MIT (MIT-LICENSE.txt) * or GPL (GPL-LICENSE.txt) licenses. */ @@ -13,21 +13,25 @@ var defined = { setTimeout: typeof window.setTimeout !== "undefined", sessionStorage: (function() { + var x = "qunit-test-string"; try { - return !!sessionStorage.getItem; - } catch(e){ + sessionStorage.setItem(x, x); + sessionStorage.removeItem(x); + return true; + } catch(e) { return false; } - })() + })() }; -var testId = 0; +var testId = 0, + toString = Object.prototype.toString, + hasOwn = Object.prototype.hasOwnProperty; -var Test = function(name, testName, expected, testEnvironmentArg, async, callback) { +var Test = function(name, testName, expected, async, callback) { this.name = name; this.testName = testName; this.expected = expected; - this.testEnvironmentArg = testEnvironmentArg; this.async = async; this.callback = callback; this.assertions = []; @@ -48,7 +52,7 @@ Test.prototype = { setup: function() { if (this.module != config.previousModule) { if ( config.previousModule ) { - QUnit.moduleDone( { + runLoggingCallbacks('moduleDone', QUnit, { name: config.previousModule, failed: config.moduleStats.bad, passed: config.moduleStats.all - config.moduleStats.bad, @@ -57,7 +61,11 @@ Test.prototype = { } config.previousModule = this.module; config.moduleStats = { all: 0, bad: 0 }; - QUnit.moduleStart( { + runLoggingCallbacks( 'moduleStart', QUnit, { + name: this.module + } ); + } else if (config.autorun) { + runLoggingCallbacks( 'moduleStart', QUnit, { name: this.module } ); } @@ -67,13 +75,11 @@ Test.prototype = { setup: function() {}, teardown: function() {} }, this.moduleTestEnvironment); - if (this.testEnvironmentArg) { - extend(this.testEnvironment, this.testEnvironmentArg); - } - QUnit.testStart( { - name: this.testName - } ); + runLoggingCallbacks( 'testStart', QUnit, { + name: this.testName, + module: this.module + }); // allow utility functions to access the current test environment // TODO why?? @@ -90,6 +96,7 @@ Test.prototype = { } }, run: function() { + config.current = this; if ( this.async ) { QUnit.stop(); } @@ -108,11 +115,12 @@ Test.prototype = { // Restart the tests if they're blocking if ( config.blocking ) { - start(); + QUnit.start(); } } }, teardown: function() { + config.current = this; try { this.testEnvironment.teardown.call(this.testEnvironment); checkPollution(); @@ -121,7 +129,8 @@ Test.prototype = { } }, finish: function() { - if ( this.expected && this.expected != this.assertions.length ) { + config.current = this; + if ( this.expected != null && this.expected != this.assertions.length ) { QUnit.ok( false, "Expected " + this.expected + " assertions, but " + this.assertions.length + " were run" ); } @@ -132,7 +141,7 @@ Test.prototype = { config.moduleStats.all += this.assertions.length; if ( tests ) { - var ol = document.createElement("ol"); + var ol = document.createElement("ol"); for ( var i = 0; i < this.assertions.length; i++ ) { var assertion = this.assertions[i]; @@ -210,8 +219,9 @@ Test.prototype = { fail("reset() failed, following Test " + this.testName + ", exception and reset fn follows", e, QUnit.reset); } - QUnit.testDone( { + runLoggingCallbacks( 'testDone', QUnit, { name: this.testName, + module: this.module, failed: bad, passed: this.assertions.length - bad, total: this.assertions.length @@ -243,7 +253,7 @@ Test.prototype = { if (bad) { run(); } else { - synchronize(run); + synchronize(run, true); }; } @@ -260,24 +270,19 @@ var QUnit = { asyncTest: function(testName, expected, callback) { if ( arguments.length === 2 ) { callback = expected; - expected = 0; + expected = null; } QUnit.test(testName, expected, callback, true); }, test: function(testName, expected, callback, async) { - var name = '' + testName + '', testEnvironmentArg; + var name = '' + escapeInnerText(testName) + ''; if ( arguments.length === 2 ) { callback = expected; expected = null; } - // is 2nd argument a testEnvironment? - if ( expected && typeof expected === 'object') { - testEnvironmentArg = expected; - expected = null; - } if ( config.currentModule ) { name = '' + config.currentModule + ": " + name; @@ -287,7 +292,7 @@ var QUnit = { return; } - var test = new Test(name, testName, expected, testEnvironmentArg, async, callback); + var test = new Test(name, testName, expected, async, callback); test.module = config.currentModule; test.moduleTestEnvironment = config.currentModuleTestEnviroment; test.queue(); @@ -305,13 +310,16 @@ var QUnit = { * @example ok( "asdfasdf".length > 5, "There must be at least 5 chars" ); */ ok: function(a, msg) { + if (!config.current) { + throw new Error("ok() assertion outside test context, was " + sourceFromStacktrace(2)); + } a = !!a; var details = { result: a, message: msg }; - msg = escapeHtml(msg); - QUnit.log(details); + msg = escapeInnerText(msg); + runLoggingCallbacks( 'log', QUnit, details ); config.current.assertions.push({ result: a, message: msg @@ -387,8 +395,8 @@ var QUnit = { QUnit.ok(ok, message); }, - start: function() { - config.semaphore--; + start: function(count) { + config.semaphore -= count || 1; if (config.semaphore > 0) { // don't start until equal number of stop-calls return; @@ -400,36 +408,54 @@ var QUnit = { // A slight delay, to avoid any current callbacks if ( defined.setTimeout ) { window.setTimeout(function() { + if (config.semaphore > 0) { + return; + } if ( config.timeout ) { clearTimeout(config.timeout); } config.blocking = false; - process(); + process(true); }, 13); } else { config.blocking = false; - process(); + process(true); } }, - stop: function(timeout) { - config.semaphore++; + stop: function(count) { + config.semaphore += count || 1; config.blocking = true; - if ( timeout && defined.setTimeout ) { + if ( config.testTimeout && defined.setTimeout ) { clearTimeout(config.timeout); config.timeout = window.setTimeout(function() { QUnit.ok( false, "Test timed out" ); + config.semaphore = 1; QUnit.start(); - }, timeout); + }, config.testTimeout); } } }; -// Backwards compatibility, deprecated -QUnit.equals = QUnit.equal; -QUnit.same = QUnit.deepEqual; +//We want access to the constructor's prototype +(function() { + function F(){}; + F.prototype = QUnit; + QUnit = new F(); + //Make F QUnit's constructor so that we can add to the prototype later + QUnit.constructor = F; +})(); + +// deprecated; still export them to window to provide clear error messages +// next step: remove entirely +QUnit.equals = function() { + throw new Error("QUnit.equals has been deprecated since 2009 (e88049a0), use QUnit.equal instead"); +}; +QUnit.same = function() { + throw new Error("QUnit.same has been deprecated since 2009 (e88049a0), use QUnit.deepEqual instead"); +}; // Maintain internal state var config = { @@ -439,12 +465,27 @@ var config = { // block until document ready blocking: true, + // when enabled, show only failing tests + // gets persisted through sessionStorage and can be changed in UI via checkbox + hidepassed: false, + // by default, run previously failed tests first // very useful in combination with "Hide passed tests" checked reorder: true, - noglobals: false, - notrycatch: false + // by default, modify document.title when suite is done + altertitle: true, + + urlConfig: ['noglobals', 'notrycatch'], + + //logging callback queues + begin: [], + done: [], + log: [], + testStart: [], + testDone: [], + moduleStart: [], + moduleDone: [] }; // Load paramaters @@ -462,9 +503,6 @@ var config = { // allow just a key to turn on a flag, e.g., test.html?noglobals current[ 1 ] = current[ 1 ] ? decodeURIComponent( current[ 1 ] ) : true; urlParams[ current[ 0 ] ] = current[ 1 ]; - if ( current[ 0 ] in config ) { - config[ current[ 0 ] ] = current[ 1 ]; - } } } @@ -481,8 +519,7 @@ if ( typeof exports === "undefined" || typeof require === "undefined" ) { extend(window, QUnit); window.QUnit = QUnit; } else { - extend(exports, QUnit); - exports.QUnit = QUnit; + module.exports = QUnit; } // define these after exposing globals to keep them in these QUnit namespace only @@ -504,6 +541,16 @@ extend(QUnit, { semaphore: 0 }); + var qunit = id( "qunit" ); + if ( qunit ) { + qunit.innerHTML = + '

    ' + escapeInnerText( document.title ) + '

    ' + + '

    ' + + '
    ' + + '

    ' + + '
      '; + } + var tests = id( "qunit-tests" ), banner = id( "qunit-banner" ), result = id( "qunit-testresult" ); @@ -532,15 +579,15 @@ extend(QUnit, { /** * Resets the test setup. Useful for tests that modify the DOM. * - * If jQuery is available, uses jQuery's html(), otherwise just innerHTML. + * If jQuery is available, uses jQuery's replaceWith(), otherwise use replaceChild */ reset: function() { - if ( window.jQuery ) { - jQuery( "#qunit-fixture" ).html( config.fixture ); - } else { - var main = id( 'qunit-fixture' ); - if ( main ) { - main.innerHTML = config.fixture; + var main = id( 'qunit-fixture' ); + if ( main ) { + if ( window.jQuery ) { + jQuery( main ).replaceWith( config.fixture.cloneNode(true) ); + } else { + main.parentNode.replaceChild(config.fixture.cloneNode(true), main); } } }, @@ -580,8 +627,7 @@ extend(QUnit, { return "null"; } - var type = Object.prototype.toString.call( obj ) - .match(/^\[object\s(.*)\]$/)[1] || ''; + var type = toString.call( obj ).match(/^\[object\s(.*)\]$/)[1] || ''; switch (type) { case 'Number': @@ -605,6 +651,9 @@ extend(QUnit, { }, push: function(result, actual, expected, message) { + if (!config.current) { + throw new Error("assertion outside test context, was " + sourceFromStacktrace()); + } var details = { result: result, message: message, @@ -612,25 +661,26 @@ extend(QUnit, { expected: expected }; - message = escapeHtml(message) || (result ? "okay" : "failed"); + message = escapeInnerText(message) || (result ? "okay" : "failed"); message = '' + message + ""; - expected = escapeHtml(QUnit.jsDump.parse(expected)); - actual = escapeHtml(QUnit.jsDump.parse(actual)); - var output = message + ''; - if (actual != expected) { - output += ''; - output += ''; - } + var output = message; if (!result) { + expected = escapeInnerText(QUnit.jsDump.parse(expected)); + actual = escapeInnerText(QUnit.jsDump.parse(actual)); + output += '
      Expected:
      ' + expected + '
      Result:
      ' + actual + '
      Diff:
      ' + QUnit.diff(expected, actual) +'
      '; + if (actual != expected) { + output += ''; + output += ''; + } var source = sourceFromStacktrace(); if (source) { details.source = source; - output += ''; + output += ''; } + output += "
      Expected:
      ' + expected + '
      Result:
      ' + actual + '
      Diff:
      ' + QUnit.diff(expected, actual) +'
      Source:
      ' + escapeHtml(source) + '
      Source:
      ' + escapeInnerText(source) + '
      "; } - output += ""; - QUnit.log(details); + runLoggingCallbacks( 'log', QUnit, details ); config.current.assertions.push({ result: !!result, @@ -643,6 +693,9 @@ extend(QUnit, { var querystring = "?", key; for ( key in params ) { + if ( !hasOwn.call( params, key ) ) { + continue; + } querystring += encodeURIComponent( key ) + "=" + encodeURIComponent( params[ key ] ) + "&"; } @@ -651,31 +704,36 @@ extend(QUnit, { extend: extend, id: id, - addEvent: addEvent, + addEvent: addEvent +}); +//QUnit.constructor is set to the empty F() above so that we can add to it's prototype later +//Doing this allows us to tell if the following methods have been overwritten on the actual +//QUnit object, which is a deprecated way of using the callbacks. +extend(QUnit.constructor.prototype, { // Logging callbacks; all receive a single argument with the listed properties // run test/logs.html for any related changes - begin: function() {}, + begin: registerLoggingCallback('begin'), // done: { failed, passed, total, runtime } - done: function() {}, + done: registerLoggingCallback('done'), // log: { result, actual, expected, message } - log: function() {}, + log: registerLoggingCallback('log'), // testStart: { name } - testStart: function() {}, + testStart: registerLoggingCallback('testStart'), // testDone: { name, failed, passed, total } - testDone: function() {}, + testDone: registerLoggingCallback('testDone'), // moduleStart: { name } - moduleStart: function() {}, + moduleStart: registerLoggingCallback('moduleStart'), // moduleDone: { name, failed, passed, total } - moduleDone: function() {} + moduleDone: registerLoggingCallback('moduleDone') }); if ( typeof document === "undefined" || document.readyState === "complete" ) { config.autorun = true; } -addEvent(window, "load", function() { - QUnit.begin({}); +QUnit.load = function() { + runLoggingCallbacks( 'begin', QUnit, {} ); // Initialize the config, saving the execution queue var oldconfig = extend({}, config); @@ -684,15 +742,19 @@ addEvent(window, "load", function() { config.blocking = false; + var urlConfigHtml = '', len = config.urlConfig.length; + for ( var i = 0, val; i < len, val = config.urlConfig[i]; i++ ) { + config[val] = QUnit.urlParams[val]; + urlConfigHtml += ''; + } + var userAgent = id("qunit-userAgent"); if ( userAgent ) { userAgent.innerHTML = navigator.userAgent; } var banner = id("qunit-header"); if ( banner ) { - banner.innerHTML = ' ' + banner.innerHTML + ' ' + - '' + - ''; + banner.innerHTML = ' ' + banner.innerHTML + ' ' + urlConfigHtml; addEvent( banner, "change", function( event ) { var params = {}; params[ event.target.name ] = event.target.checked ? true : undefined; @@ -715,13 +777,13 @@ addEvent(window, "load", function() { } if ( defined.sessionStorage ) { if (filter.checked) { - sessionStorage.setItem("qunit-filter-passed-tests", "true"); + sessionStorage.setItem("qunit-filter-passed-tests", "true"); } else { sessionStorage.removeItem("qunit-filter-passed-tests"); } } }); - if ( defined.sessionStorage && sessionStorage.getItem("qunit-filter-passed-tests") ) { + if ( config.hidepassed || defined.sessionStorage && sessionStorage.getItem("qunit-filter-passed-tests") ) { filter.checked = true; var ol = document.getElementById("qunit-tests"); ol.className = ol.className + " hidepass"; @@ -736,20 +798,33 @@ addEvent(window, "load", function() { var main = id('qunit-fixture'); if ( main ) { - config.fixture = main.innerHTML; + config.fixture = main.cloneNode(true); } if (config.autostart) { QUnit.start(); } -}); +}; + +addEvent(window, "load", QUnit.load); + +// addEvent(window, "error") gives us a useless event object +window.onerror = function( message, file, line ) { + if ( QUnit.config.current ) { + ok( false, message + ", " + file + ":" + line ); + } else { + test( "global failure", function() { + ok( false, message + ", " + file + ":" + line ); + }); + } +}; function done() { config.autorun = true; // Log the last module results if ( config.currentModule ) { - QUnit.moduleDone( { + runLoggingCallbacks( 'moduleDone', QUnit, { name: config.currentModule, failed: config.moduleStats.bad, passed: config.moduleStats.all - config.moduleStats.bad, @@ -782,13 +857,25 @@ function done() { id( "qunit-testresult" ).innerHTML = html; } - if ( typeof document !== "undefined" && document.title ) { - // show ✖ for bad, ✔ for good suite result in title + if ( config.altertitle && typeof document !== "undefined" && document.title ) { + // show ✖ for good, ✔ for bad suite result in title // use escape sequences in case file gets loaded with non-utf-8-charset - document.title = (config.stats.bad ? "\u2716" : "\u2714") + " " + document.title; + document.title = [ + (config.stats.bad ? "\u2716" : "\u2714"), + document.title.replace(/^[\u2714\u2716] /i, "") + ].join(" "); + } + + // clear own sessionStorage items if all tests passed + if ( config.reorder && defined.sessionStorage && config.stats.bad === 0 ) { + for (var key in sessionStorage) { + if (sessionStorage.hasOwnProperty(key) && key.indexOf("qunit-") === 0 ) { + sessionStorage.removeItem(key); + } + } } - QUnit.done( { + runLoggingCallbacks( 'done', QUnit, { failed: config.stats.bad, passed: passed, total: config.stats.all, @@ -822,30 +909,37 @@ function validTest( name ) { // so far supports only Firefox, Chrome and Opera (buggy) // could be extended in the future to use something like https://github.com/csnover/TraceKit -function sourceFromStacktrace() { +function sourceFromStacktrace(offset) { + offset = offset || 3; try { throw new Error(); } catch ( e ) { if (e.stacktrace) { // Opera - return e.stacktrace.split("\n")[6]; + return e.stacktrace.split("\n")[offset + 3]; } else if (e.stack) { // Firefox, Chrome - return e.stack.split("\n")[4]; + var stack = e.stack.split("\n"); + if (/^error$/i.test(stack[0])) { + stack.shift(); + } + return stack[offset]; + } else if (e.sourceURL) { + // Safari, PhantomJS + // TODO sourceURL points at the 'throw new Error' line above, useless + //return e.sourceURL + ":" + e.line; } } } -function escapeHtml(s) { +function escapeInnerText(s) { if (!s) { return ""; } s = s + ""; - return s.replace(/[\&"<>\\]/g, function(s) { + return s.replace(/[\&<>]/g, function(s) { switch(s) { case "&": return "&"; - case "\\": return "\\\\"; - case '"': return '\"'; case "<": return "<"; case ">": return ">"; default: return s; @@ -853,28 +947,32 @@ function escapeHtml(s) { }); } -function synchronize( callback ) { +function synchronize( callback, last ) { config.queue.push( callback ); if ( config.autorun && !config.blocking ) { - process(); + process(last); } } -function process() { - var start = (new Date()).getTime(); +function process( last ) { + var start = new Date().getTime(); + config.depth = config.depth ? config.depth + 1 : 1; while ( config.queue.length && !config.blocking ) { - if ( config.updateRate <= 0 || (((new Date()).getTime() - start) < config.updateRate) ) { + if ( !defined.setTimeout || config.updateRate <= 0 || ( ( new Date().getTime() - start ) < config.updateRate ) ) { config.queue.shift()(); } else { - window.setTimeout( process, 13 ); + window.setTimeout( function(){ + process( last ); + }, 13 ); break; } } - if (!config.blocking && !config.queue.length) { - done(); - } + config.depth--; + if ( last && !config.blocking && !config.queue.length && config.depth === 0 ) { + done(); + } } function saveGlobal() { @@ -882,6 +980,9 @@ function saveGlobal() { if ( config.noglobals ) { for ( var key in window ) { + if ( !hasOwn.call( window, key ) ) { + continue; + } config.pollution.push( key ); } } @@ -921,6 +1022,7 @@ function fail(message, exception, callback) { if ( typeof console !== "undefined" && console.error && console.warn ) { console.error(message); console.error(exception); + console.error(exception.stack); console.warn(callback.toString()); } else if ( window.opera && opera.postError ) { @@ -932,7 +1034,9 @@ function extend(a, b) { for ( var prop in b ) { if ( b[prop] === undefined ) { delete a[prop]; - } else { + + // Avoid "Member not found" error in IE8 caused by setting window.constructor + } else if ( prop !== "constructor" || a !== window ) { a[prop] = b[prop]; } } @@ -955,176 +1059,216 @@ function id(name) { document.getElementById( name ); } +function registerLoggingCallback(key){ + return function(callback){ + config[key].push( callback ); + }; +} + +// Supports deprecated method of completely overwriting logging callbacks +function runLoggingCallbacks(key, scope, args) { + //debugger; + var callbacks; + if ( QUnit.hasOwnProperty(key) ) { + QUnit[key].call(scope, args); + } else { + callbacks = config[key]; + for( var i = 0; i < callbacks.length; i++ ) { + callbacks[i].call( scope, args ); + } + } +} + // Test for equality any JavaScript type. -// Discussions and reference: http://philrathe.com/articles/equiv -// Test suites: http://philrathe.com/tests/equiv // Author: Philippe Rathé QUnit.equiv = function () { - var innerEquiv; // the real equiv function - var callers = []; // stack to decide between skip/abort functions - var parents = []; // stack to avoiding loops from circular referencing - - // Call the o related callback with the given arguments. - function bindCallbacks(o, callbacks, args) { - var prop = QUnit.objectType(o); - if (prop) { - if (QUnit.objectType(callbacks[prop]) === "function") { - return callbacks[prop].apply(callbacks, args); - } else { - return callbacks[prop]; // or undefined - } - } - } - - var callbacks = function () { - - // for string, boolean, number and null - function useStrictEquality(b, a) { - if (b instanceof a.constructor || a instanceof b.constructor) { - // to catch short annotaion VS 'new' annotation of a declaration - // e.g. var i = 1; - // var j = new Number(1); - return a == b; - } else { - return a === b; - } - } - - return { - "string": useStrictEquality, - "boolean": useStrictEquality, - "number": useStrictEquality, - "null": useStrictEquality, - "undefined": useStrictEquality, - - "nan": function (b) { - return isNaN(b); - }, - - "date": function (b, a) { - return QUnit.objectType(b) === "date" && a.valueOf() === b.valueOf(); - }, - - "regexp": function (b, a) { - return QUnit.objectType(b) === "regexp" && - a.source === b.source && // the regex itself - a.global === b.global && // and its modifers (gmi) ... - a.ignoreCase === b.ignoreCase && - a.multiline === b.multiline; - }, - - // - skip when the property is a method of an instance (OOP) - // - abort otherwise, - // initial === would have catch identical references anyway - "function": function () { - var caller = callers[callers.length - 1]; - return caller !== Object && - typeof caller !== "undefined"; - }, - - "array": function (b, a) { - var i, j, loop; - var len; - - // b could be an object literal here - if ( ! (QUnit.objectType(b) === "array")) { - return false; - } - - len = a.length; - if (len !== b.length) { // safe and faster - return false; - } - - //track reference to avoid circular references - parents.push(a); - for (i = 0; i < len; i++) { - loop = false; - for(j=0;j= 0) { + } else if ( + // native arrays + toString.call( obj ) === "[object Array]" || + // NodeList objects + ( typeof obj.length === "number" && typeof obj.item !== "undefined" && ( obj.length ? obj.item(0) === obj[0] : ( obj.item( 0 ) === null && typeof obj[0] === "undefined" ) ) ) + ) { type = "array"; } else { type = typeof obj; @@ -1239,11 +1398,13 @@ QUnit.jsDump = (function() { array: array, nodelist: array, arguments: array, - object:function( map ) { + object:function( map, stack ) { var ret = [ ]; QUnit.jsDump.up(); - for ( var key in map ) - ret.push( QUnit.jsDump.parse(key,'key') + ': ' + QUnit.jsDump.parse(map[key]) ); + for ( var key in map ) { + var val = map[key]; + ret.push( QUnit.jsDump.parse(key,'key') + ': ' + QUnit.jsDump.parse(val, undefined, stack)); + } QUnit.jsDump.down(); return join( '{', ret, '}' ); }, @@ -1312,6 +1473,21 @@ function getText( elems ) { return ret; }; +//from jquery.js +function inArray( elem, array ) { + if ( array.indexOf ) { + return array.indexOf( elem ); + } + + for ( var i = 0, length = array.length; i < length; i++ ) { + if ( array[ i ] === elem ) { + return i; + } + } + + return -1; +} + /* * Javascript Diff Algorithm * By John Resig (http://ejohn.org/) @@ -1327,14 +1503,14 @@ function getText( elems ) { * QUnit.diff("the quick brown fox jumped over", "the quick fox jumps over") == "the quick brown fox jumped jumps over" */ QUnit.diff = (function() { - function diff(o, n){ - var ns = new Object(); - var os = new Object(); + function diff(o, n) { + var ns = {}; + var os = {}; for (var i = 0; i < n.length; i++) { if (ns[n[i]] == null) ns[n[i]] = { - rows: new Array(), + rows: [], o: null }; ns[n[i]].rows.push(i); @@ -1343,13 +1519,16 @@ QUnit.diff = (function() { for (var i = 0; i < o.length; i++) { if (os[o[i]] == null) os[o[i]] = { - rows: new Array(), + rows: [], n: null }; os[o[i]].rows.push(i); } for (var i in ns) { + if ( !hasOwn.call( ns, i ) ) { + continue; + } if (ns[i].rows.length == 1 && typeof(os[i]) != "undefined" && os[i].rows.length == 1) { n[ns[i].rows[0]] = { text: n[ns[i].rows[0]], @@ -1396,7 +1575,7 @@ QUnit.diff = (function() { }; } - return function(o, n){ + return function(o, n) { o = o.replace(/\s+$/, ''); n = n.replace(/\s+$/, ''); var out = diff(o == "" ? [] : o.split(/\s+/), n == "" ? [] : n.split(/\s+/)); @@ -1449,4 +1628,5 @@ QUnit.diff = (function() { }; })(); -})(this); +// get at whatever the global object is, like window in browsers +})( (function() {return this}).call() ); diff --git a/tests/unit/accordion/accordion_events.js b/tests/unit/accordion/accordion_events.js index b5c3ea2282d..dbb3e37dfe7 100644 --- a/tests/unit/accordion/accordion_events.js +++ b/tests/unit/accordion/accordion_events.js @@ -11,9 +11,9 @@ test( "create", function() { element.accordion({ create: function( event, ui ) { - equals( ui.header.size(), 1, "header size" ); + equal( ui.header.size(), 1, "header size" ); strictEqual( ui.header[ 0 ], headers[ 0 ], "header" ); - equals( ui.content.size(), 1, "content size" ); + equal( ui.content.size(), 1, "content size" ); strictEqual( ui.content[ 0 ], contents[ 0 ], "content" ); } }); @@ -22,9 +22,9 @@ test( "create", function() { element.accordion({ active: 2, create: function( event, ui ) { - equals( ui.header.size(), 1, "header size" ); + equal( ui.header.size(), 1, "header size" ); strictEqual( ui.header[ 0 ], headers[ 2 ], "header" ); - equals( ui.content.size(), 1, "content size" ); + equal( ui.content.size(), 1, "content size" ); strictEqual( ui.content[ 0 ], contents[ 2 ], "content" ); } }); @@ -34,8 +34,8 @@ test( "create", function() { active: false, collapsible: true, create: function( event, ui ) { - equals( ui.header.size(), 0, "header size" ); - equals( ui.content.size(), 0, "content size" ); + equal( ui.header.size(), 0, "header size" ); + equal( ui.content.size(), 0, "content size" ); } }); element.accordion( "destroy" ); diff --git a/tests/unit/button/button_core.js b/tests/unit/button/button_core.js index 692c40320d8..c110b4311a3 100644 --- a/tests/unit/button/button_core.js +++ b/tests/unit/button/button_core.js @@ -10,7 +10,7 @@ module("button: core"); test("checkbox", function() { var input = $("#check"); label = $("label[for=check]"); - ok( input.is(":visible") ); + ok( input.is(":visible") ); ok( label.is(":not(.ui-button)") ); input.button(); ok( input.is(".ui-helper-hidden-accessible") ); @@ -20,7 +20,7 @@ test("checkbox", function() { test("radios", function() { var inputs = $("#radio0 input"); labels = $("#radio0 label"); - ok( inputs.is(":visible") ); + ok( inputs.is(":visible") ); ok( labels.is(":not(.ui-button)") ); inputs.button(); ok( inputs.is(".ui-helper-hidden-accessible") ); @@ -36,15 +36,15 @@ function assert(noForm, form1, form2) { 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)"); @@ -52,16 +52,16 @@ test("radio groups", function() { test("input type submit, don't create child elements", function() { var input = $("#submit") - same( input.children().length, 0 ); + deepEqual( input.children().length, 0 ); input.button(); - same( input.children().length, 0 ); + deepEqual( input.children().length, 0 ); }); test("buttonset", function() { var set = $("#radio1").buttonset(); ok( set.is(".ui-buttonset") ); - same( set.children(".ui-button").length, 3 ); - same( set.children("input:radio.ui-helper-hidden-accessible").length, 3 ); + deepEqual( set.children(".ui-button").length, 3 ); + deepEqual( set.children("input:radio.ui-helper-hidden-accessible").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)") ); @@ -71,11 +71,11 @@ test("buttonset (rtl)", function() { var parent = $("#radio1").parent(); // Set to rtl parent.attr("dir", "rtl"); - + var set = $("#radio1").buttonset(); ok( set.is(".ui-buttonset") ); - same( set.children(".ui-button").length, 3 ); - same( set.children("input:radio.ui-helper-hidden-accessible").length, 3 ); + deepEqual( set.children(".ui-button").length, 3 ); + deepEqual( set.children("input:radio.ui-helper-hidden-accessible").length, 3 ); ok( set.children("label:eq(0)").is(".ui-button.ui-corner-right: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-left:not(.ui-corner-all)") ); diff --git a/tests/unit/button/button_options.js b/tests/unit/button/button_options.js index a3ab5ae103c..9ef4a19db81 100644 --- a/tests/unit/button/button_options.js +++ b/tests/unit/button/button_options.js @@ -7,26 +7,26 @@ module("button: options"); test("disabled, explicit value", function() { $("#radio01").button({ disabled: false }); - same(false, $("#radio01").button("option", "disabled"), + deepEqual(false, $("#radio01").button("option", "disabled"), "disabled option set to false"); - same(false, $("#radio01").prop("disabled"), "element is disabled"); - + deepEqual(false, $("#radio01").prop("disabled"), "element is disabled"); + $("#radio02").button({ disabled: true }); - same(true, $("#radio02").button("option", "disabled"), + deepEqual(true, $("#radio02").button("option", "disabled"), "disabled option set to true"); - same(true, $("#radio02").prop("disabled"), "element is not disabled"); + deepEqual(true, $("#radio02").prop("disabled"), "element is not disabled"); }); test("disabled, null", function() { $("#radio01").button({ disabled: null }); - same(false, $("#radio01").button("option", "disabled"), + deepEqual(false, $("#radio01").button("option", "disabled"), "disabled option set to false"); - same(false, $("#radio01").prop("disabled"), "element is disabled"); - + deepEqual(false, $("#radio01").prop("disabled"), "element is disabled"); + $("#radio02").prop("disabled", true).button({ disabled: null }); - same(true, $("#radio02").button("option", "disabled"), + deepEqual(true, $("#radio02").button("option", "disabled"), "disabled option set to true"); - same(true, $("#radio02").prop("disabled"), "element is not disabled"); + deepEqual(true, $("#radio02").prop("disabled"), "element is not disabled"); }); test("text false without icon", function() { @@ -34,7 +34,7 @@ test("text false without icon", function() { text: false }); ok( $("#button").is(".ui-button-text-only:not(.ui-button-icon-only)") ); - + $("#button").button("destroy"); }); @@ -46,14 +46,14 @@ test("text false with icon", function() { } }); 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" ); - + deepEqual( $("#button").text(), "Label" ); + $("#button").button("destroy"); }); @@ -61,20 +61,20 @@ test("label", function() { $("#button").button({ label: "xxx" }); - same( $("#button").text(), "xxx" ); - + deepEqual( $("#button").text(), "xxx" ); + $("#button").button("destroy"); }); test("label default with input type submit", function() { - same( $("#submit").button().val(), "Label" ); + deepEqual( $("#submit").button().val(), "Label" ); }); test("label with input type submit", function() { var label = $("#submit").button({ label: "xxx" }).val(); - same( label, "xxx" ); + deepEqual( label, "xxx" ); }); test("icons", function() { @@ -86,7 +86,7 @@ test("icons", function() { } }); ok( $("#button").is(":has(span.ui-icon.ui-button-icon-primary.iconclass):has(span.ui-icon.ui-button-icon-secondary.iconclass2)") ); - + $("#button").button("destroy"); }); diff --git a/tests/unit/core/core.js b/tests/unit/core/core.js index 03a7ab81021..53415584f8d 100644 --- a/tests/unit/core/core.js +++ b/tests/unit/core/core.js @@ -7,7 +7,7 @@ module('core - jQuery extensions'); test('focus - original functionality', function() { expect(1); - + $('#inputTabindex0') .focus(function() { ok(true, 'event triggered'); @@ -31,127 +31,127 @@ asyncTest('focus', function() { test('zIndex', function() { var el = $('#zIndexAutoWithParent'), parent = el.parent(); - equals(el.zIndex(), 100, 'zIndex traverses up to find value'); - equals(parent.zIndex(200), parent, 'zIndex setter is chainable'); - equals(el.zIndex(), 200, 'zIndex setter changed zIndex'); - + equal(el.zIndex(), 100, 'zIndex traverses up to find value'); + equal(parent.zIndex(200), parent, 'zIndex setter is chainable'); + equal(el.zIndex(), 200, 'zIndex setter changed zIndex'); + el = $('#zIndexAutoWithParentViaCSS'); - equals(el.zIndex(), 0, 'zIndex traverses up to find CSS value, not found because not positioned'); - + equal(el.zIndex(), 0, 'zIndex traverses up to find CSS value, not found because not positioned'); + el = $('#zIndexAutoWithParentViaCSSPositioned'); - equals(el.zIndex(), 100, 'zIndex traverses up to find CSS value'); + equal(el.zIndex(), 100, 'zIndex traverses up to find CSS value'); el.parent().zIndex(200); - equals(el.zIndex(), 200, 'zIndex setter changed zIndex, overriding CSS'); - - equals($('#zIndexAutoNoParent').zIndex(), 0, 'zIndex never explicitly set in hierarchy'); + equal(el.zIndex(), 200, 'zIndex setter changed zIndex, overriding CSS'); + + equal($('#zIndexAutoNoParent').zIndex(), 0, 'zIndex never explicitly set in hierarchy'); }); test( "innerWidth - getter", function() { var el = $( "#dimensions" ); - equals( el.innerWidth(), 122, "getter passthru" ); + equal( el.innerWidth(), 122, "getter passthru" ); el.hide(); - equals( el.innerWidth(), 122, "getter passthru when hidden" ); + equal( el.innerWidth(), 122, "getter passthru when hidden" ); }); test( "innerWidth - setter", function() { var el = $( "#dimensions" ); el.innerWidth( 120 ); - equals( el.width(), 98, "width set properly" ); + equal( el.width(), 98, "width set properly" ); el.hide(); el.innerWidth( 100 ); - equals( el.width(), 78, "width set properly when hidden" ); + equal( el.width(), 78, "width set properly when hidden" ); }); test( "innerHeight - getter", function() { var el = $( "#dimensions" ); - equals( el.innerHeight(), 70, "getter passthru" ); + equal( el.innerHeight(), 70, "getter passthru" ); el.hide(); - equals( el.innerHeight(), 70, "getter passthru when hidden" ); + equal( el.innerHeight(), 70, "getter passthru when hidden" ); }); test( "innerHeight - setter", function() { var el = $( "#dimensions" ); el.innerHeight( 60 ); - equals( el.height(), 40, "height set properly" ); + equal( el.height(), 40, "height set properly" ); el.hide(); el.innerHeight( 50 ); - equals( el.height(), 30, "height set properly when hidden" ); + equal( el.height(), 30, "height set properly when hidden" ); }); test( "outerWidth - getter", function() { var el = $( "#dimensions" ); - equals( el.outerWidth(), 140, "getter passthru" ); + equal( el.outerWidth(), 140, "getter passthru" ); el.hide(); - equals( el.outerWidth(), 140, "getter passthru when hidden" ); + equal( el.outerWidth(), 140, "getter passthru when hidden" ); }); test( "outerWidth - setter", function() { var el = $( "#dimensions" ); el.outerWidth( 130 ); - equals( el.width(), 90, "width set properly" ); + equal( el.width(), 90, "width set properly" ); el.hide(); el.outerWidth( 120 ); - equals( el.width(), 80, "width set properly when hidden" ); + equal( el.width(), 80, "width set properly when hidden" ); }); test( "outerWidth(true) - getter", function() { var el = $( "#dimensions" ); - equals( el.outerWidth(true), 154, "getter passthru w/ margin" ); + equal( el.outerWidth(true), 154, "getter passthru w/ margin" ); el.hide(); - equals( el.outerWidth(true), 154, "getter passthru w/ margin when hidden" ); + equal( el.outerWidth(true), 154, "getter passthru w/ margin when hidden" ); }); test( "outerWidth(true) - setter", function() { var el = $( "#dimensions" ); el.outerWidth( 130, true ); - equals( el.width(), 76, "width set properly" ); + equal( el.width(), 76, "width set properly" ); el.hide(); el.outerWidth( 120, true ); - equals( el.width(), 66, "width set properly when hidden" ); + equal( el.width(), 66, "width set properly when hidden" ); }); test( "outerHeight - getter", function() { var el = $( "#dimensions" ); - equals( el.outerHeight(), 86, "getter passthru" ); + equal( el.outerHeight(), 86, "getter passthru" ); el.hide(); - equals( el.outerHeight(), 86, "getter passthru when hidden" ); + equal( el.outerHeight(), 86, "getter passthru when hidden" ); }); test( "outerHeight - setter", function() { var el = $( "#dimensions" ); el.outerHeight( 80 ); - equals( el.height(), 44, "height set properly" ); + equal( el.height(), 44, "height set properly" ); el.hide(); el.outerHeight( 70 ); - equals( el.height(), 34, "height set properly when hidden" ); + equal( el.height(), 34, "height set properly when hidden" ); }); test( "outerHeight(true) - getter", function() { var el = $( "#dimensions" ); - equals( el.outerHeight(true), 98, "getter passthru w/ margin" ); + equal( el.outerHeight(true), 98, "getter passthru w/ margin" ); el.hide(); - equals( el.outerHeight(true), 98, "getter passthru w/ margin when hidden" ); + equal( el.outerHeight(true), 98, "getter passthru w/ margin when hidden" ); }); test( "outerHeight(true) - setter", function() { var el = $( "#dimensions" ); el.outerHeight( 90, true ); - equals( el.height(), 42, "height set properly" ); + equal( el.height(), 42, "height set properly" ); el.hide(); el.outerHeight( 80, true ); - equals( el.height(), 32, "height set properly when hidden" ); + equal( el.height(), 32, "height set properly when hidden" ); }); })(jQuery); diff --git a/tests/unit/datepicker/datepicker_core.js b/tests/unit/datepicker/datepicker_core.js index badb837ed8b..b674c708aa8 100644 --- a/tests/unit/datepicker/datepicker_core.js +++ b/tests/unit/datepicker/datepicker_core.js @@ -9,7 +9,7 @@ function equalsDate(d1, d2, message) { } d1 = new Date(d1.getFullYear(), d1.getMonth(), d1.getDate()); d2 = new Date(d2.getFullYear(), d2.getMonth(), d2.getDate()); - equals(d1.toString(), d2.toString(), message); + equal(d1.toString(), d2.toString(), message); } function equalsDateArray(a1, a2, message) { @@ -21,7 +21,7 @@ function equalsDateArray(a1, a2, message) { a1[1] = (a1[1] ? new Date(a1[1].getFullYear(), a1[1].getMonth(), a1[1].getDate()) : ''); a2[0] = (a2[0] ? new Date(a2[0].getFullYear(), a2[0].getMonth(), a2[0].getDate()) : ''); a2[1] = (a2[1] ? new Date(a2[1].getFullYear(), a2[1].getMonth(), a2[1].getDate()) : ''); - same(a1, a2, message); + deepEqual(a1, a2, message); } function addMonths(date, offset) { @@ -49,7 +49,7 @@ test( "widget method - empty collection", function() { test("widget method", function() { var actual = $("#inp").datepicker().datepicker("widget")[0]; - same($("body > #ui-datepicker-div:last-child")[0], actual); + deepEqual($("body > #ui-datepicker-div:last-child")[0], actual); }); test('baseStructure', function() { @@ -60,36 +60,36 @@ test('baseStructure', function() { ok(dp.is(':visible'), 'Structure - datepicker visible'); ok(!dp.is('.ui-datepicker-rtl'), 'Structure - not right-to-left'); ok(!dp.is('.ui-datepicker-multi'), 'Structure - not multi-month'); - equals(dp.children().length, 2 + (iframe ? 1 : 0), 'Structure - child count'); - + equal(dp.children().length, 2 + (iframe ? 1 : 0), 'Structure - child count'); + var header = dp.children(':first'); ok(header.is('div.ui-datepicker-header'), 'Structure - header division'); - equals(header.children().length, 3, 'Structure - header child count'); + equal(header.children().length, 3, 'Structure - header child count'); ok(header.children(':first').is('a.ui-datepicker-prev') && header.children(':first').html() != '', 'Structure - prev link'); ok(header.children(':eq(1)').is('a.ui-datepicker-next') && header.children(':eq(1)').html() != '', 'Structure - next link'); - + var title = header.children(':last'); ok(title.is('div.ui-datepicker-title') && title.html() != '','Structure - title division'); - equals(title.children().length, 2, 'Structure - title child count'); + equal(title.children().length, 2, 'Structure - title child count'); ok(title.children(':first').is('span.ui-datepicker-month') && title.children(':first').text() != '', 'Structure - month text') ok(title.children(':last').is('span.ui-datepicker-year') && title.children(':last').text() != '', 'Structure - year text') - + var table = dp.children(':eq(1)'); ok(table.is('table.ui-datepicker-calendar'), 'Structure - month table'); ok(table.children(':first').is('thead'), 'Structure - month table thead'); var thead = table.children(':first').children(':first'); ok(thead.is('tr'), 'Structure - month table title row'); - equals(thead.find('th').length, 7, 'Structure - month table title cells'); + equal(thead.find('th').length, 7, 'Structure - month table title cells'); ok(table.children(':eq(1)').is('tbody'), 'Structure - month table body'); ok(table.children(':eq(1)').children('tr').length >= 4, 'Structure - month table week count'); var week = table.children(':eq(1)').children(':first'); ok(week.is('tr'), 'Structure - month table week row'); - equals(week.children().length, 7, 'Structure - week child count'); + equal(week.children().length, 7, 'Structure - week child count'); ok(week.children(':first').is('td.ui-datepicker-week-end'), 'Structure - month table first day cell'); ok(week.children(':last').is('td.ui-datepicker-week-end'), 'Structure - month table second day cell'); ok(dp.children('iframe').length == (iframe ? 1 : 0), 'Structure - iframe'); inp.datepicker('hide').datepicker('destroy'); - + // Editable month/year and button panel inp = init('#inp', {changeMonth: true, changeYear: true, showButtonPanel: true}); inp.focus(); @@ -97,19 +97,19 @@ test('baseStructure', function() { var title = dp.find('div.ui-datepicker-title'); ok(title.children(':first').is('select.ui-datepicker-month'), 'Structure - month selector'); ok(title.children(':last').is('select.ui-datepicker-year'), 'Structure - year selector'); - + var panel = dp.children(':last'); ok(panel.is('div.ui-datepicker-buttonpane'), 'Structure - button panel division'); - equals(panel.children().length, 2, 'Structure - button panel child count'); + equal(panel.children().length, 2, 'Structure - button panel child count'); ok(panel.children(':first').is('button.ui-datepicker-current'), 'Structure - today button'); ok(panel.children(':last').is('button.ui-datepicker-close'), 'Structure - close button'); inp.datepicker('hide').datepicker('destroy'); - + // Multi-month 2 inp = init('#inp', {numberOfMonths: 2}); inp.focus(); ok(dp.is('.ui-datepicker-multi'), 'Structure multi [2] - multi-month'); - equals(dp.children().length, 3 + (iframe ? 1 : 0), 'Structure multi [2] - child count'); + equal(dp.children().length, 3 + (iframe ? 1 : 0), 'Structure multi [2] - child count'); var child = dp.children(':first'); ok(child.is('div.ui-datepicker-group') && child.is('div.ui-datepicker-group-first'), 'Structure multi [2] - first month division'); child = dp.children(':eq(1)'); @@ -118,7 +118,7 @@ test('baseStructure', function() { ok(child.is('div.ui-datepicker-row-break'), 'Structure multi [2] - row break'); ok(dp.is('.ui-datepicker-multi-2'), 'Structure multi [2] - multi-2'); inp.datepicker('hide').datepicker('destroy'); - + // Multi-month 3 inp = init('#inp', {numberOfMonths: 3}); inp.focus(); @@ -130,7 +130,7 @@ test('baseStructure', function() { inp = init('#inp', {numberOfMonths: [2, 2]}); inp.focus(); ok(dp.is('.ui-datepicker-multi'), 'Structure multi - multi-month'); - equals(dp.children().length, 6 + (iframe ? 1 : 0), 'Structure multi [2,2] - child count'); + equal(dp.children().length, 6 + (iframe ? 1 : 0), 'Structure multi [2,2] - child count'); child = dp.children(':first'); ok(child.is('div.ui-datepicker-group') && child.is('div.ui-datepicker-group-first'), 'Structure multi [2,2] - first month division'); child = dp.children(':eq(1)'); @@ -144,28 +144,28 @@ test('baseStructure', function() { child = dp.children(':eq(5)'); ok(child.is('div.ui-datepicker-row-break'), 'Structure multi [2,2] - row break'); inp.datepicker('hide').datepicker('destroy'); - + // Inline var inl = init('#inl'); dp = inl.children(); ok(dp.is('.ui-datepicker-inline'), 'Structure inline - main div'); ok(!dp.is('.ui-datepicker-rtl'), 'Structure inline - not right-to-left'); ok(!dp.is('.ui-datepicker-multi'), 'Structure inline - not multi-month'); - equals(dp.children().length, 2, 'Structure inline - child count'); + equal(dp.children().length, 2, 'Structure inline - child count'); var header = dp.children(':first'); ok(header.is('div.ui-datepicker-header'), 'Structure inline - header division'); - equals(header.children().length, 3, 'Structure inline - header child count'); + equal(header.children().length, 3, 'Structure inline - header child count'); var table = dp.children(':eq(1)'); ok(table.is('table.ui-datepicker-calendar'), 'Structure inline - month table'); ok(table.children(':first').is('thead'), 'Structure inline - month table thead'); ok(table.children(':eq(1)').is('tbody'), 'Structure inline - month table body'); inl.datepicker('destroy'); - + // Inline multi-month inl = init('#inl', {numberOfMonths: 2}); dp = inl.children(); - ok(dp.is('.ui-datepicker-inline') && dp.is('.ui-datepicker-multi'), 'Structure inline multi - main div'); - equals(dp.children().length, 3 + (iframe ? 1 : 0), 'Structure inline multi - child count'); + ok(dp.is('.ui-datepicker-inline') && dp.is('.ui-datepicker-multi'), 'Structure inline multi - main div'); + equal(dp.children().length, 3 + (iframe ? 1 : 0), 'Structure inline multi - child count'); child = dp.children(':first'); ok(child.is('div.ui-datepicker-group') && child.is('div.ui-datepicker-group-first'), 'Structure inline multi - first month division'); child = dp.children(':eq(1)'); @@ -185,12 +185,12 @@ test('customStructure', function() { ok(dp.is('.ui-datepicker-rtl'), 'Structure RTL - right-to-left'); var header = dp.children(':first'); ok(header.is('div.ui-datepicker-header'), 'Structure RTL - header division'); - equals(header.children().length, 3, 'Structure RTL - header child count'); + equal(header.children().length, 3, 'Structure RTL - header child count'); ok(header.children(':first').is('a.ui-datepicker-next'), 'Structure RTL - prev link'); - ok(header.children(':eq(1)').is('a.ui-datepicker-prev'), 'Structure RTL - next link'); + ok(header.children(':eq(1)').is('a.ui-datepicker-prev'), 'Structure RTL - next link'); var panel = dp.children(':last'); ok(panel.is('div.ui-datepicker-buttonpane'), 'Structure RTL - button division'); - equals(panel.children().length, 2, 'Structure RTL - button panel child count'); + equal(panel.children().length, 2, 'Structure RTL - button panel child count'); ok(panel.children(':first').is('button.ui-datepicker-close'), 'Structure RTL - close button'); ok(panel.children(':last').is('button.ui-datepicker-current'), 'Structure RTL - today button'); inp.datepicker('hide').datepicker('destroy'); @@ -200,24 +200,24 @@ test('customStructure', function() { inp.val('02/10/2008').focus(); var header = dp.children(':first'); ok(header.is('div.ui-datepicker-header'), 'Structure hide prev/next - header division'); - equals(header.children().length, 1, 'Structure hide prev/next - links child count'); + equal(header.children().length, 1, 'Structure hide prev/next - links child count'); ok(header.children(':first').is('div.ui-datepicker-title'), 'Structure hide prev/next - title division'); inp.datepicker('hide').datepicker('destroy'); - + // Changeable Month with read-only year inp = init('#inp', {changeMonth: true}); inp.focus(); var title = dp.children(':first').children(':last'); - equals(title.children().length, 2, 'Structure changeable month - title child count'); + equal(title.children().length, 2, 'Structure changeable month - title child count'); ok(title.children(':first').is('select.ui-datepicker-month'), 'Structure changeable month - month selector'); ok(title.children(':last').is('span.ui-datepicker-year'), 'Structure changeable month - read-only year'); inp.datepicker('hide').datepicker('destroy'); - + // Changeable year with read-only month inp = init('#inp', {changeYear: true}); inp.focus(); var title = dp.children(':first').children(':last'); - equals(title.children().length, 2, 'Structure changeable year - title child count'); + equal(title.children().length, 2, 'Structure changeable year - title child count'); ok(title.children(':first').is('span.ui-datepicker-month'), 'Structure changeable year - read-only month'); ok(title.children(':last').is('select.ui-datepicker-year'), 'Structure changeable year - year selector'); inp.datepicker('hide').datepicker('destroy'); @@ -226,8 +226,8 @@ test('customStructure', function() { inp = init('#inp', {changeFirstDay: false}); inp.focus(); var thead = dp.find('.ui-datepicker-calendar thead tr'); - equals(thead.children().length, 7, 'Structure read-only first day - thead child count'); - equals(thead.find('a').length, 0, 'Structure read-only first day - thead links count'); + equal(thead.children().length, 7, 'Structure read-only first day - thead child count'); + equal(thead.find('a').length, 0, 'Structure read-only first day - thead links count'); inp.datepicker('hide').datepicker('destroy'); }); @@ -331,7 +331,7 @@ test('keystrokes', function() { inp.val('01/30/2008').datepicker('show'). simulate('keydown', {keyCode: $.simulate.VK_PGDN}). simulate('keydown', {keyCode: $.simulate.VK_ENTER}); - equalsDate(inp.datepicker('getDate'), new Date(2008, 2 - 1, 29), + equalsDate(inp.datepicker('getDate'), new Date(2008, 2 - 1, 29), 'Keystroke pgdn - Feb'); inp.val('02/29/2008').datepicker('show'). simulate('keydown', {ctrlKey: true, keyCode: $.simulate.VK_PGUP}). diff --git a/tests/unit/datepicker/datepicker_events.js b/tests/unit/datepicker/datepicker_events.js index c7c16b61076..fc312216f11 100644 --- a/tests/unit/datepicker/datepicker_events.js +++ b/tests/unit/datepicker/datepicker_events.js @@ -27,24 +27,24 @@ test('events', function() { // onSelect inp.val('').datepicker('show'). simulate('keydown', {keyCode: $.simulate.VK_ENTER}); - equals(selectedThis, inp[0], 'Callback selected this'); - equals(selectedInst, $.data(inp[0], PROP_NAME), 'Callback selected inst'); - equals(selectedDate, $.datepicker.formatDate('mm/dd/yy', date), + equal(selectedThis, inp[0], 'Callback selected this'); + equal(selectedInst, $.data(inp[0], PROP_NAME), 'Callback selected inst'); + equal(selectedDate, $.datepicker.formatDate('mm/dd/yy', date), 'Callback selected date'); inp.val('').datepicker('show'). simulate('keydown', {ctrlKey: true, keyCode: $.simulate.VK_DOWN}). simulate('keydown', {keyCode: $.simulate.VK_ENTER}); date.setDate(date.getDate() + 7); - equals(selectedDate, $.datepicker.formatDate('mm/dd/yy', date), + equal(selectedDate, $.datepicker.formatDate('mm/dd/yy', date), 'Callback selected date - ctrl+down'); inp.val('').datepicker('show'). simulate('keydown', {keyCode: $.simulate.VK_ESC}); - equals(selectedDate, $.datepicker.formatDate('mm/dd/yy', date), + equal(selectedDate, $.datepicker.formatDate('mm/dd/yy', date), 'Callback selected date - esc'); var dateStr = '02/04/2008'; inp.val(dateStr).datepicker('show'). simulate('keydown', {keyCode: $.simulate.VK_ENTER}); - equals(dateStr, selectedDate, + equal(dateStr, selectedDate, 'onSelect is called after enter keydown'); // onChangeMonthYear inp.datepicker('option', {onChangeMonthYear: callback2, onSelect: null}). @@ -56,28 +56,28 @@ test('events', function() { date.setDate(1); inp.simulate('keydown', {keyCode: $.simulate.VK_PGUP}); date.setMonth(date.getMonth() - 1); - equals(selectedThis, inp[0], 'Callback change month/year this'); - equals(selectedInst, $.data(inp[0], PROP_NAME), 'Callback change month/year inst'); - equals(selectedDate, newMonthYear(date), + equal(selectedThis, inp[0], 'Callback change month/year this'); + equal(selectedInst, $.data(inp[0], PROP_NAME), 'Callback change month/year inst'); + equal(selectedDate, newMonthYear(date), 'Callback change month/year date - pgup'); inp.simulate('keydown', {keyCode: $.simulate.VK_PGDN}); date.setMonth(date.getMonth() + 1); - equals(selectedDate, newMonthYear(date), + equal(selectedDate, newMonthYear(date), 'Callback change month/year date - pgdn'); inp.simulate('keydown', {ctrlKey: true, keyCode: $.simulate.VK_PGUP}); date.setFullYear(date.getFullYear() - 1); - equals(selectedDate, newMonthYear(date), + equal(selectedDate, newMonthYear(date), 'Callback change month/year date - ctrl+pgup'); inp.simulate('keydown', {ctrlKey: true, keyCode: $.simulate.VK_HOME}); date.setFullYear(date.getFullYear() + 1); - equals(selectedDate, newMonthYear(date), + equal(selectedDate, newMonthYear(date), 'Callback change month/year date - ctrl+home'); inp.simulate('keydown', {ctrlKey: true, keyCode: $.simulate.VK_PGDN}); date.setFullYear(date.getFullYear() + 1); - equals(selectedDate, newMonthYear(date), + equal(selectedDate, newMonthYear(date), 'Callback change month/year date - ctrl+pgdn'); inp.datepicker('setDate', new Date(2007, 1 - 1, 26)); - equals(selectedDate, '2007/1', 'Callback change month/year date - setDate'); + equal(selectedDate, '2007/1', 'Callback change month/year date - setDate'); selectedDate = null; inp.datepicker('setDate', new Date(2007, 1 - 1, 12)); ok(selectedDate == null, 'Callback change month/year date - setDate no change'); @@ -86,42 +86,42 @@ test('events', function() { datepicker('hide').val('').datepicker('show'). simulate('keydown', {keyCode: $.simulate.VK_PGUP}); date.setMonth(date.getMonth() - 14); - equals(selectedDate, newMonthYear(date), + equal(selectedDate, newMonthYear(date), 'Callback change month/year by 2 date - pgup'); inp.simulate('keydown', {ctrlKey: true, keyCode: $.simulate.VK_PGUP}); date.setMonth(date.getMonth() - 12); - equals(selectedDate, newMonthYear(date), + equal(selectedDate, newMonthYear(date), 'Callback change month/year by 2 date - ctrl+pgup'); inp.simulate('keydown', {keyCode: $.simulate.VK_PGDN}); date.setMonth(date.getMonth() + 2); - equals(selectedDate, newMonthYear(date), + equal(selectedDate, newMonthYear(date), 'Callback change month/year by 2 date - pgdn'); inp.simulate('keydown', {ctrlKey: true, keyCode: $.simulate.VK_PGDN}); date.setMonth(date.getMonth() + 12); - equals(selectedDate, newMonthYear(date), + equal(selectedDate, newMonthYear(date), 'Callback change month/year by 2 date - ctrl+pgdn'); // onClose inp.datepicker('option', {onClose: callback, onChangeMonthYear: null, stepMonths: 1}). val('').datepicker('show'). simulate('keydown', {keyCode: $.simulate.VK_ESC}); - equals(selectedThis, inp[0], 'Callback close this'); - equals(selectedInst, $.data(inp[0], PROP_NAME), 'Callback close inst'); - equals(selectedDate, '', 'Callback close date - esc'); + equal(selectedThis, inp[0], 'Callback close this'); + equal(selectedInst, $.data(inp[0], PROP_NAME), 'Callback close inst'); + equal(selectedDate, '', 'Callback close date - esc'); inp.val('').datepicker('show'). simulate('keydown', {keyCode: $.simulate.VK_ENTER}); - equals(selectedDate, $.datepicker.formatDate('mm/dd/yy', new Date()), + equal(selectedDate, $.datepicker.formatDate('mm/dd/yy', new Date()), 'Callback close date - enter'); inp.val('02/04/2008').datepicker('show'). simulate('keydown', {keyCode: $.simulate.VK_ESC}); - equals(selectedDate, '02/04/2008', 'Callback close date - preset'); + equal(selectedDate, '02/04/2008', 'Callback close date - preset'); inp.val('02/04/2008').datepicker('show'). simulate('keydown', {ctrlKey: true, keyCode: $.simulate.VK_END}); - equals(selectedDate, '', 'Callback close date - ctrl+end'); + equal(selectedDate, '', 'Callback close date - ctrl+end'); var inp2 = init('#inp2'); inp2.datepicker().datepicker('option', {onClose: callback}).datepicker('show'); inp.datepicker('show'); - equals(selectedThis, inp2[0], 'Callback close this'); + equal(selectedThis, inp2[0], 'Callback close this'); }); })(jQuery); diff --git a/tests/unit/datepicker/datepicker_options.js b/tests/unit/datepicker/datepicker_options.js index 120a18c7333..bab6ed45ae8 100644 --- a/tests/unit/datepicker/datepicker_options.js +++ b/tests/unit/datepicker/datepicker_options.js @@ -8,62 +8,62 @@ module("datepicker: options"); test('setDefaults', function() { var inp = init('#inp'); - equals($.datepicker._defaults.showOn, 'focus', 'Initial showOn'); + equal($.datepicker._defaults.showOn, 'focus', 'Initial showOn'); $.datepicker.setDefaults({showOn: 'button'}); - equals($.datepicker._defaults.showOn, 'button', 'Change default showOn'); + equal($.datepicker._defaults.showOn, 'button', 'Change default showOn'); $.datepicker.setDefaults({showOn: 'focus'}); - equals($.datepicker._defaults.showOn, 'focus', 'Restore showOn'); + equal($.datepicker._defaults.showOn, 'focus', 'Restore showOn'); }); test('option', function() { var inp = init('#inp'); var inst = $.data(inp[0], PROP_NAME); // Set option - equals(inst.settings.showOn, null, 'Initial setting showOn'); - equals($.datepicker._get(inst, 'showOn'), 'focus', 'Initial instance showOn'); - equals($.datepicker._defaults.showOn, 'focus', 'Initial default showOn'); + equal(inst.settings.showOn, null, 'Initial setting showOn'); + equal($.datepicker._get(inst, 'showOn'), 'focus', 'Initial instance showOn'); + equal($.datepicker._defaults.showOn, 'focus', 'Initial default showOn'); inp.datepicker('option', 'showOn', 'button'); - equals(inst.settings.showOn, 'button', 'Change setting showOn'); - equals($.datepicker._get(inst, 'showOn'), 'button', 'Change instance showOn'); - equals($.datepicker._defaults.showOn, 'focus', 'Retain default showOn'); + equal(inst.settings.showOn, 'button', 'Change setting showOn'); + equal($.datepicker._get(inst, 'showOn'), 'button', 'Change instance showOn'); + equal($.datepicker._defaults.showOn, 'focus', 'Retain default showOn'); inp.datepicker('option', {showOn: 'both'}); - equals(inst.settings.showOn, 'both', 'Change setting showOn'); - equals($.datepicker._get(inst, 'showOn'), 'both', 'Change instance showOn'); - equals($.datepicker._defaults.showOn, 'focus', 'Retain default showOn'); + equal(inst.settings.showOn, 'both', 'Change setting showOn'); + equal($.datepicker._get(inst, 'showOn'), 'both', 'Change instance showOn'); + equal($.datepicker._defaults.showOn, 'focus', 'Retain default showOn'); inp.datepicker('option', 'showOn', undefined); - equals(inst.settings.showOn, null, 'Clear setting showOn'); - equals($.datepicker._get(inst, 'showOn'), 'focus', 'Restore instance showOn'); - equals($.datepicker._defaults.showOn, 'focus', 'Retain default showOn'); + equal(inst.settings.showOn, null, 'Clear setting showOn'); + equal($.datepicker._get(inst, 'showOn'), 'focus', 'Restore instance showOn'); + equal($.datepicker._defaults.showOn, 'focus', 'Retain default showOn'); // Get option inp = init('#inp'); - equals(inp.datepicker('option', 'showOn'), 'focus', 'Initial setting showOn'); + equal(inp.datepicker('option', 'showOn'), 'focus', 'Initial setting showOn'); inp.datepicker('option', 'showOn', 'button'); - equals(inp.datepicker('option', 'showOn'), 'button', 'Change instance showOn'); + equal(inp.datepicker('option', 'showOn'), 'button', 'Change instance showOn'); inp.datepicker('option', 'showOn', undefined); - equals(inp.datepicker('option', 'showOn'), 'focus', 'Reset instance showOn'); - same(inp.datepicker('option', 'all'), {showAnim: ''}, 'Get instance settings'); - same(inp.datepicker('option', 'defaults'), $.datepicker._defaults, + equal(inp.datepicker('option', 'showOn'), 'focus', 'Reset instance showOn'); + deepEqual(inp.datepicker('option', 'all'), {showAnim: ''}, 'Get instance settings'); + deepEqual(inp.datepicker('option', 'defaults'), $.datepicker._defaults, 'Get default settings'); }); test('change', function() { var inp = init('#inp'); var inst = $.data(inp[0], PROP_NAME); - equals(inst.settings.showOn, null, 'Initial setting showOn'); - equals($.datepicker._get(inst, 'showOn'), 'focus', 'Initial instance showOn'); - equals($.datepicker._defaults.showOn, 'focus', 'Initial default showOn'); + equal(inst.settings.showOn, null, 'Initial setting showOn'); + equal($.datepicker._get(inst, 'showOn'), 'focus', 'Initial instance showOn'); + equal($.datepicker._defaults.showOn, 'focus', 'Initial default showOn'); inp.datepicker('change', 'showOn', 'button'); - equals(inst.settings.showOn, 'button', 'Change setting showOn'); - equals($.datepicker._get(inst, 'showOn'), 'button', 'Change instance showOn'); - equals($.datepicker._defaults.showOn, 'focus', 'Retain default showOn'); + equal(inst.settings.showOn, 'button', 'Change setting showOn'); + equal($.datepicker._get(inst, 'showOn'), 'button', 'Change instance showOn'); + equal($.datepicker._defaults.showOn, 'focus', 'Retain default showOn'); inp.datepicker('change', {showOn: 'both'}); - equals(inst.settings.showOn, 'both', 'Change setting showOn'); - equals($.datepicker._get(inst, 'showOn'), 'both', 'Change instance showOn'); - equals($.datepicker._defaults.showOn, 'focus', 'Retain default showOn'); + equal(inst.settings.showOn, 'both', 'Change setting showOn'); + equal($.datepicker._get(inst, 'showOn'), 'both', 'Change instance showOn'); + equal($.datepicker._defaults.showOn, 'focus', 'Retain default showOn'); inp.datepicker('change', 'showOn', undefined); - equals(inst.settings.showOn, null, 'Clear setting showOn'); - equals($.datepicker._get(inst, 'showOn'), 'focus', 'Restore instance showOn'); - equals($.datepicker._defaults.showOn, 'focus', 'Retain default showOn'); + equal(inst.settings.showOn, null, 'Clear setting showOn'); + equal($.datepicker._get(inst, 'showOn'), 'focus', 'Restore instance showOn'); + equal($.datepicker._defaults.showOn, 'focus', 'Retain default showOn'); }); test('invocation', function() { @@ -91,7 +91,7 @@ test('invocation', function() { image = inp.siblings('img'); ok(button.length == 1, 'Button - button present'); ok(image.length == 0, 'Button - image absent'); - equals(button.text(), 'Popup', 'Button - button text'); + equal(button.text(), 'Popup', 'Button - button text'); inp.focus(); ok(!dp.is(':visible'), 'Button - not rendered on focus'); button.click(); @@ -107,8 +107,8 @@ test('invocation', function() { ok(button.length == 0, 'Image button - button absent'); image = inp.siblings('img'); ok(image.length == 1, 'Image button - image present'); - equals(image.attr('src'), 'img/calendar.gif', 'Image button - image source'); - equals(image.attr('title'), 'Cal', 'Image button - image text'); + equal(image.attr('src'), 'img/calendar.gif', 'Image button - image source'); + equal(image.attr('title'), 'Cal', 'Image button - image text'); inp.focus(); ok(!dp.is(':visible'), 'Image button - not rendered on focus'); image.click(); @@ -140,19 +140,19 @@ test('otherMonths', function() { var inp = init('#inp'); var pop = $('#ui-datepicker-div'); inp.val('06/01/2009').datepicker('show'); - equals(pop.find('tbody').text(), '\u00a0123456789101112131415161718192021222324252627282930\u00a0\u00a0\u00a0\u00a0', + equal(pop.find('tbody').text(), '\u00a0123456789101112131415161718192021222324252627282930\u00a0\u00a0\u00a0\u00a0', 'Other months - none'); ok(pop.find('td:last *').length == 0, 'Other months - no content'); inp.datepicker('hide').datepicker('option', 'showOtherMonths', true).datepicker('show'); - equals(pop.find('tbody').text(), '311234567891011121314151617181920212223242526272829301234', + equal(pop.find('tbody').text(), '311234567891011121314151617181920212223242526272829301234', 'Other months - show'); ok(pop.find('td:last span').length == 1, 'Other months - span content'); inp.datepicker('hide').datepicker('option', 'selectOtherMonths', true).datepicker('show'); - equals(pop.find('tbody').text(), '311234567891011121314151617181920212223242526272829301234', + equal(pop.find('tbody').text(), '311234567891011121314151617181920212223242526272829301234', 'Other months - select'); ok(pop.find('td:last a').length == 1, 'Other months - link content'); inp.datepicker('hide').datepicker('option', 'showOtherMonths', false).datepicker('show'); - equals(pop.find('tbody').text(), '\u00a0123456789101112131415161718192021222324252627282930\u00a0\u00a0\u00a0\u00a0', + equal(pop.find('tbody').text(), '\u00a0123456789101112131415161718192021222324252627282930\u00a0\u00a0\u00a0\u00a0', 'Other months - none'); ok(pop.find('td:last *').length == 0, 'Other months - no content'); }); @@ -264,49 +264,49 @@ test('miscellaneous', function() { }; var curYear = new Date().getFullYear(); inp.val('02/04/2008').datepicker('show'); - equals(dp.find('.ui-datepicker-year').text(), '2008', 'Year range - read-only default'); + equal(dp.find('.ui-datepicker-year').text(), '2008', 'Year range - read-only default'); inp.datepicker('hide').datepicker('option', {changeYear: true}).datepicker('show'); - equals(dp.find('.ui-datepicker-year').text(), genRange(2008 - 10, 21), 'Year range - changeable default'); + equal(dp.find('.ui-datepicker-year').text(), genRange(2008 - 10, 21), 'Year range - changeable default'); inp.datepicker('hide').datepicker('option', {yearRange: 'c-6:c+2', changeYear: true}).datepicker('show'); - equals(dp.find('.ui-datepicker-year').text(), genRange(2008 - 6, 9), 'Year range - c-6:c+2'); + equal(dp.find('.ui-datepicker-year').text(), genRange(2008 - 6, 9), 'Year range - c-6:c+2'); inp.datepicker('hide').datepicker('option', {yearRange: '2000:2010', changeYear: true}).datepicker('show'); - equals(dp.find('.ui-datepicker-year').text(), genRange(2000, 11), 'Year range - 2000:2010'); + equal(dp.find('.ui-datepicker-year').text(), genRange(2000, 11), 'Year range - 2000:2010'); inp.datepicker('hide').datepicker('option', {yearRange: '-5:+3', changeYear: true}).datepicker('show'); - equals(dp.find('.ui-datepicker-year').text(), genRange(curYear - 5, 9), 'Year range - -5:+3'); + equal(dp.find('.ui-datepicker-year').text(), genRange(curYear - 5, 9), 'Year range - -5:+3'); inp.datepicker('hide').datepicker('option', {yearRange: '2000:-5', changeYear: true}).datepicker('show'); - equals(dp.find('.ui-datepicker-year').text(), genRange(2000, curYear - 2004), 'Year range - 2000:-5'); + equal(dp.find('.ui-datepicker-year').text(), genRange(2000, curYear - 2004), 'Year range - 2000:-5'); inp.datepicker('hide').datepicker('option', {yearRange: '', changeYear: true}).datepicker('show'); - equals(dp.find('.ui-datepicker-year').text(), genRange(curYear, 1), 'Year range - -6:+2'); + equal(dp.find('.ui-datepicker-year').text(), genRange(curYear, 1), 'Year range - -6:+2'); // Navigation as date format inp.datepicker('option', {showButtonPanel: true}); - equals(dp.find('.ui-datepicker-prev').text(), 'Prev', 'Navigation prev - default'); - equals(dp.find('.ui-datepicker-current').text(), 'Today', 'Navigation current - default'); - equals(dp.find('.ui-datepicker-next').text(), 'Next', 'Navigation next - default'); + equal(dp.find('.ui-datepicker-prev').text(), 'Prev', 'Navigation prev - default'); + equal(dp.find('.ui-datepicker-current').text(), 'Today', 'Navigation current - default'); + equal(dp.find('.ui-datepicker-next').text(), 'Next', 'Navigation next - default'); inp.datepicker('hide').datepicker('option', {navigationAsDateFormat: true, prevText: '< M', currentText: 'MM', nextText: 'M >'}). val('02/04/2008').datepicker('show'); var longNames = $.datepicker.regional[''].monthNames; var shortNames = $.datepicker.regional[''].monthNamesShort; var date = new Date(); - equals(dp.find('.ui-datepicker-prev').text(), '< ' + shortNames[0], 'Navigation prev - as date format'); - equals(dp.find('.ui-datepicker-current').text(), + equal(dp.find('.ui-datepicker-prev').text(), '< ' + shortNames[0], 'Navigation prev - as date format'); + equal(dp.find('.ui-datepicker-current').text(), longNames[date.getMonth()], 'Navigation current - as date format'); - equals(dp.find('.ui-datepicker-next').text(), + equal(dp.find('.ui-datepicker-next').text(), shortNames[2] + ' >', 'Navigation next - as date format'); inp.simulate('keydown', {keyCode: $.simulate.VK_PGDN}); - equals(dp.find('.ui-datepicker-prev').text(), + equal(dp.find('.ui-datepicker-prev').text(), '< ' + shortNames[1], 'Navigation prev - as date format + pgdn'); - equals(dp.find('.ui-datepicker-current').text(), + equal(dp.find('.ui-datepicker-current').text(), longNames[date.getMonth()], 'Navigation current - as date format + pgdn'); - equals(dp.find('.ui-datepicker-next').text(), + equal(dp.find('.ui-datepicker-next').text(), shortNames[3] + ' >', 'Navigation next - as date format + pgdn'); inp.datepicker('hide').datepicker('option', {gotoCurrent: true}). val('02/04/2008').datepicker('show'); - equals(dp.find('.ui-datepicker-prev').text(), + equal(dp.find('.ui-datepicker-prev').text(), '< ' + shortNames[0], 'Navigation prev - as date format + goto current'); - equals(dp.find('.ui-datepicker-current').text(), + equal(dp.find('.ui-datepicker-current').text(), longNames[1], 'Navigation current - as date format + goto current'); - equals(dp.find('.ui-datepicker-next').text(), + equal(dp.find('.ui-datepicker-next').text(), shortNames[2] + ' >', 'Navigation next - as date format + goto current'); }); @@ -445,8 +445,8 @@ test('setDate', function() { inp.datepicker('option', {altField: '#alt', altFormat: 'yy-mm-dd'}); date1 = new Date(2008, 6 - 1, 4); inp.datepicker('setDate', date1); - equals(inp.val(), '06/04/2008', 'Set date alternate - 06/04/2008'); - equals(alt.val(), '2008-06-04', 'Set date alternate - 2008-06-04'); + equal(inp.val(), '06/04/2008', 'Set date alternate - 06/04/2008'); + equal(alt.val(), '2008-06-04', 'Set date alternate - 2008-06-04'); // With minimum/maximum inp = init('#inp'); date1 = new Date(2008, 1 - 1, 4); @@ -468,7 +468,7 @@ test('setDate', function() { var dateAndTimeToSet = new Date(2008, 3 - 1, 28, 1, 11, 0); var dateAndTimeClone = new Date(2008, 3 - 1, 28, 1, 11, 0); inp.datepicker('setDate', dateAndTimeToSet); - equals(dateAndTimeToSet.getTime(), dateAndTimeClone.getTime(), 'Date object passed should not be changed by setDate'); + equal(dateAndTimeToSet.getTime(), dateAndTimeClone.getTime(), 'Date object passed should not be changed by setDate'); }); test('altField', function() { @@ -478,35 +478,35 @@ test('altField', function() { alt.val(''); inp.val('06/04/2008').datepicker('show'); inp.simulate('keydown', {keyCode: $.simulate.VK_ENTER}); - equals(inp.val(), '06/04/2008', 'Alt field - dp - enter'); - equals(alt.val(), '', 'Alt field - alt not set'); + equal(inp.val(), '06/04/2008', 'Alt field - dp - enter'); + equal(alt.val(), '', 'Alt field - alt not set'); // Alternate field set alt.val(''); inp.datepicker('option', {altField: '#alt', altFormat: 'yy-mm-dd'}). val('06/04/2008').datepicker('show'); inp.simulate('keydown', {keyCode: $.simulate.VK_ENTER}); - equals(inp.val(), '06/04/2008', 'Alt field - dp - enter'); - equals(alt.val(), '2008-06-04', 'Alt field - alt - enter'); + equal(inp.val(), '06/04/2008', 'Alt field - dp - enter'); + equal(alt.val(), '2008-06-04', 'Alt field - alt - enter'); // Move from initial date alt.val(''); inp.val('06/04/2008').datepicker('show'); inp.simulate('keydown', {keyCode: $.simulate.VK_PGDN}). simulate('keydown', {keyCode: $.simulate.VK_ENTER}); - equals(inp.val(), '07/04/2008', 'Alt field - dp - pgdn'); - equals(alt.val(), '2008-07-04', 'Alt field - alt - pgdn'); + equal(inp.val(), '07/04/2008', 'Alt field - dp - pgdn'); + equal(alt.val(), '2008-07-04', 'Alt field - alt - pgdn'); // Alternate field set - closed alt.val(''); inp.val('06/04/2008').datepicker('show'); inp.simulate('keydown', {keyCode: $.simulate.VK_PGDN}). simulate('keydown', {keyCode: $.simulate.VK_ESC}); - equals(inp.val(), '06/04/2008', 'Alt field - dp - pgdn/esc'); - equals(alt.val(), '', 'Alt field - alt - pgdn/esc'); + equal(inp.val(), '06/04/2008', 'Alt field - dp - pgdn/esc'); + equal(alt.val(), '', 'Alt field - alt - pgdn/esc'); // Clear date and alternate alt.val(''); inp.val('06/04/2008').datepicker('show'); inp.simulate('keydown', {ctrlKey: true, keyCode: $.simulate.VK_END}); - equals(inp.val(), '', 'Alt field - dp - ctrl+end'); - equals(alt.val(), '', 'Alt field - alt - ctrl+end'); + equal(inp.val(), '', 'Alt field - dp - ctrl+end'); + equal(alt.val(), '', 'Alt field - alt - ctrl+end'); return // TODO manual entry impl works (see altField demo) but this test doesn't @@ -518,50 +518,50 @@ test('altField', function() { inp.simulate('keydown', {charCode: '8'.charCodeAt(0)}); inp.simulate('keypress', {charCode: '8'.charCodeAt(0)}); inp.simulate('keyup', {charCode: '8'.charCodeAt(0)}); - equals(inp.val(), '06/04/2008', 'Alt field - dp - manual entry'); - equals(alt.val(), '2008-06-04', 'Alt field - manual entry'); + equal(inp.val(), '06/04/2008', 'Alt field - dp - manual entry'); + equal(alt.val(), '2008-06-04', 'Alt field - manual entry'); // Verify alt field is not updated on keyup if date is invalid inp.val('12/04'); inp.simulate('keydown', {charCode: '/'.charCodeAt(0)}); inp.simulate('keypress', {charCode: '/'.charCodeAt(0)}); inp.simulate('keyup', {charCode: '/'.charCodeAt(0)}); - equals(inp.val(), '12/04/', 'Alt field - dp - manual entry incomplete'); - equals(alt.val(), '2008-06-04', 'Alt field - manual entry - not updated'); + equal(inp.val(), '12/04/', 'Alt field - dp - manual entry incomplete'); + equal(alt.val(), '2008-06-04', 'Alt field - manual entry - not updated'); }); test('autoSize', function() { var inp = init('#inp'); - equals(inp.prop('size'), 20, 'Auto size - default'); + equal(inp.prop('size'), 20, 'Auto size - default'); inp.datepicker('option', 'autoSize', true); - equals(inp.prop('size'), 10, 'Auto size - mm/dd/yy'); + equal(inp.prop('size'), 10, 'Auto size - mm/dd/yy'); inp.datepicker('option', 'dateFormat', 'm/d/yy'); - equals(inp.prop('size'), 10, 'Auto size - m/d/yy'); + equal(inp.prop('size'), 10, 'Auto size - m/d/yy'); inp.datepicker('option', 'dateFormat', 'D M d yy'); - equals(inp.prop('size'), 15, 'Auto size - D M d yy'); + equal(inp.prop('size'), 15, 'Auto size - D M d yy'); inp.datepicker('option', 'dateFormat', 'DD, MM dd, yy'); - equals(inp.prop('size'), 29, 'Auto size - DD, MM dd, yy'); + equal(inp.prop('size'), 29, 'Auto size - DD, MM dd, yy'); // French inp.datepicker('option', $.extend({autoSize: false}, $.datepicker.regional['fr'])); - equals(inp.prop('size'), 29, 'Auto size - fr - default'); + equal(inp.prop('size'), 29, 'Auto size - fr - default'); inp.datepicker('option', 'autoSize', true); - equals(inp.prop('size'), 10, 'Auto size - fr - dd/mm/yy'); + equal(inp.prop('size'), 10, 'Auto size - fr - dd/mm/yy'); inp.datepicker('option', 'dateFormat', 'm/d/yy'); - equals(inp.prop('size'), 10, 'Auto size - fr - m/d/yy'); + equal(inp.prop('size'), 10, 'Auto size - fr - m/d/yy'); inp.datepicker('option', 'dateFormat', 'D M d yy'); - equals(inp.prop('size'), 18, 'Auto size - fr - D M d yy'); + equal(inp.prop('size'), 18, 'Auto size - fr - D M d yy'); inp.datepicker('option', 'dateFormat', 'DD, MM dd, yy'); - equals(inp.prop('size'), 28, 'Auto size - fr - DD, MM dd, yy'); + equal(inp.prop('size'), 28, 'Auto size - fr - DD, MM dd, yy'); // Hebrew inp.datepicker('option', $.extend({autoSize: false}, $.datepicker.regional['he'])); - equals(inp.prop('size'), 28, 'Auto size - he - default'); + equal(inp.prop('size'), 28, 'Auto size - he - default'); inp.datepicker('option', 'autoSize', true); - equals(inp.prop('size'), 10, 'Auto size - he - dd/mm/yy'); + equal(inp.prop('size'), 10, 'Auto size - he - dd/mm/yy'); inp.datepicker('option', 'dateFormat', 'm/d/yy'); - equals(inp.prop('size'), 10, 'Auto size - he - m/d/yy'); + equal(inp.prop('size'), 10, 'Auto size - he - m/d/yy'); inp.datepicker('option', 'dateFormat', 'D M d yy'); - equals(inp.prop('size'), 16, 'Auto size - he - D M d yy'); + equal(inp.prop('size'), 16, 'Auto size - he - D M d yy'); inp.datepicker('option', 'dateFormat', 'DD, MM dd, yy'); - equals(inp.prop('size'), 23, 'Auto size - he - DD, MM dd, yy'); + equal(inp.prop('size'), 23, 'Auto size - he - DD, MM dd, yy'); }); test('daylightSaving', function() { @@ -571,79 +571,79 @@ test('daylightSaving', function() { // Australia, Sydney - AM change, southern hemisphere inp.val('04/01/2008').datepicker('show'); $('.ui-datepicker-calendar td:eq(6) a', dp).simulate('click'); - equals(inp.val(), '04/05/2008', 'Daylight saving - Australia 04/05/2008'); + equal(inp.val(), '04/05/2008', 'Daylight saving - Australia 04/05/2008'); inp.val('04/01/2008').datepicker('show'); $('.ui-datepicker-calendar td:eq(7) a', dp).simulate('click'); - equals(inp.val(), '04/06/2008', 'Daylight saving - Australia 04/06/2008'); + equal(inp.val(), '04/06/2008', 'Daylight saving - Australia 04/06/2008'); inp.val('04/01/2008').datepicker('show'); $('.ui-datepicker-calendar td:eq(8) a', dp).simulate('click'); - equals(inp.val(), '04/07/2008', 'Daylight saving - Australia 04/07/2008'); + equal(inp.val(), '04/07/2008', 'Daylight saving - Australia 04/07/2008'); inp.val('10/01/2008').datepicker('show'); $('.ui-datepicker-calendar td:eq(6) a', dp).simulate('click'); - equals(inp.val(), '10/04/2008', 'Daylight saving - Australia 10/04/2008'); + equal(inp.val(), '10/04/2008', 'Daylight saving - Australia 10/04/2008'); inp.val('10/01/2008').datepicker('show'); $('.ui-datepicker-calendar td:eq(7) a', dp).simulate('click'); - equals(inp.val(), '10/05/2008', 'Daylight saving - Australia 10/05/2008'); + equal(inp.val(), '10/05/2008', 'Daylight saving - Australia 10/05/2008'); inp.val('10/01/2008').datepicker('show'); $('.ui-datepicker-calendar td:eq(8) a', dp).simulate('click'); - equals(inp.val(), '10/06/2008', 'Daylight saving - Australia 10/06/2008'); + equal(inp.val(), '10/06/2008', 'Daylight saving - Australia 10/06/2008'); // Brasil, Brasilia - midnight change, southern hemisphere inp.val('02/01/2008').datepicker('show'); $('.ui-datepicker-calendar td:eq(20) a', dp).simulate('click'); - equals(inp.val(), '02/16/2008', 'Daylight saving - Brasil 02/16/2008'); + equal(inp.val(), '02/16/2008', 'Daylight saving - Brasil 02/16/2008'); inp.val('02/01/2008').datepicker('show'); $('.ui-datepicker-calendar td:eq(21) a', dp).simulate('click'); - equals(inp.val(), '02/17/2008', 'Daylight saving - Brasil 02/17/2008'); + equal(inp.val(), '02/17/2008', 'Daylight saving - Brasil 02/17/2008'); inp.val('02/01/2008').datepicker('show'); $('.ui-datepicker-calendar td:eq(22) a', dp).simulate('click'); - equals(inp.val(), '02/18/2008', 'Daylight saving - Brasil 02/18/2008'); + equal(inp.val(), '02/18/2008', 'Daylight saving - Brasil 02/18/2008'); inp.val('10/01/2008').datepicker('show'); $('.ui-datepicker-calendar td:eq(13) a', dp).simulate('click'); - equals(inp.val(), '10/11/2008', 'Daylight saving - Brasil 10/11/2008'); + equal(inp.val(), '10/11/2008', 'Daylight saving - Brasil 10/11/2008'); inp.val('10/01/2008').datepicker('show'); $('.ui-datepicker-calendar td:eq(14) a', dp).simulate('click'); - equals(inp.val(), '10/12/2008', 'Daylight saving - Brasil 10/12/2008'); + equal(inp.val(), '10/12/2008', 'Daylight saving - Brasil 10/12/2008'); inp.val('10/01/2008').datepicker('show'); $('.ui-datepicker-calendar td:eq(15) a', dp).simulate('click'); - equals(inp.val(), '10/13/2008', 'Daylight saving - Brasil 10/13/2008'); + equal(inp.val(), '10/13/2008', 'Daylight saving - Brasil 10/13/2008'); // Lebanon, Beirut - midnight change, northern hemisphere inp.val('03/01/2008').datepicker('show'); $('.ui-datepicker-calendar td:eq(34) a', dp).simulate('click'); - equals(inp.val(), '03/29/2008', 'Daylight saving - Lebanon 03/29/2008'); + equal(inp.val(), '03/29/2008', 'Daylight saving - Lebanon 03/29/2008'); inp.val('03/01/2008').datepicker('show'); $('.ui-datepicker-calendar td:eq(35) a', dp).simulate('click'); - equals(inp.val(), '03/30/2008', 'Daylight saving - Lebanon 03/30/2008'); + equal(inp.val(), '03/30/2008', 'Daylight saving - Lebanon 03/30/2008'); inp.val('03/01/2008').datepicker('show'); $('.ui-datepicker-calendar td:eq(36) a', dp).simulate('click'); - equals(inp.val(), '03/31/2008', 'Daylight saving - Lebanon 03/31/2008'); + equal(inp.val(), '03/31/2008', 'Daylight saving - Lebanon 03/31/2008'); inp.val('10/01/2008').datepicker('show'); $('.ui-datepicker-calendar td:eq(27) a', dp).simulate('click'); - equals(inp.val(), '10/25/2008', 'Daylight saving - Lebanon 10/25/2008'); + equal(inp.val(), '10/25/2008', 'Daylight saving - Lebanon 10/25/2008'); inp.val('10/01/2008').datepicker('show'); $('.ui-datepicker-calendar td:eq(28) a', dp).simulate('click'); - equals(inp.val(), '10/26/2008', 'Daylight saving - Lebanon 10/26/2008'); + equal(inp.val(), '10/26/2008', 'Daylight saving - Lebanon 10/26/2008'); inp.val('10/01/2008').datepicker('show'); $('.ui-datepicker-calendar td:eq(29) a', dp).simulate('click'); - equals(inp.val(), '10/27/2008', 'Daylight saving - Lebanon 10/27/2008'); + equal(inp.val(), '10/27/2008', 'Daylight saving - Lebanon 10/27/2008'); // US, Eastern - AM change, northern hemisphere inp.val('03/01/2008').datepicker('show'); $('.ui-datepicker-calendar td:eq(13) a', dp).simulate('click'); - equals(inp.val(), '03/08/2008', 'Daylight saving - US 03/08/2008'); + equal(inp.val(), '03/08/2008', 'Daylight saving - US 03/08/2008'); inp.val('03/01/2008').datepicker('show'); $('.ui-datepicker-calendar td:eq(14) a', dp).simulate('click'); - equals(inp.val(), '03/09/2008', 'Daylight saving - US 03/09/2008'); + equal(inp.val(), '03/09/2008', 'Daylight saving - US 03/09/2008'); inp.val('03/01/2008').datepicker('show'); $('.ui-datepicker-calendar td:eq(15) a', dp).simulate('click'); - equals(inp.val(), '03/10/2008', 'Daylight saving - US 03/10/2008'); + equal(inp.val(), '03/10/2008', 'Daylight saving - US 03/10/2008'); inp.val('11/01/2008').datepicker('show'); $('.ui-datepicker-calendar td:eq(6) a', dp).simulate('click'); - equals(inp.val(), '11/01/2008', 'Daylight saving - US 11/01/2008'); + equal(inp.val(), '11/01/2008', 'Daylight saving - US 11/01/2008'); inp.val('11/01/2008').datepicker('show'); $('.ui-datepicker-calendar td:eq(7) a', dp).simulate('click'); - equals(inp.val(), '11/02/2008', 'Daylight saving - US 11/02/2008'); + equal(inp.val(), '11/02/2008', 'Daylight saving - US 11/02/2008'); inp.val('11/01/2008').datepicker('show'); $('.ui-datepicker-calendar td:eq(8) a', dp).simulate('click'); - equals(inp.val(), '11/03/2008', 'Daylight saving - US 11/03/2008'); + equal(inp.val(), '11/03/2008', 'Daylight saving - US 11/03/2008'); }); var beforeShowThis = null; @@ -680,9 +680,9 @@ test('callbacks', function() { // Before show var inp = init('#inp', {beforeShow: beforeAll}); var inst = $.data(inp[0], 'datepicker'); - equals($.datepicker._get(inst, 'currentText'), 'Today', 'Before show - initial'); + equal($.datepicker._get(inst, 'currentText'), 'Today', 'Before show - initial'); inp.val('02/04/2008').datepicker('show'); - equals($.datepicker._get(inst, 'currentText'), 'Current', 'Before show - changed'); + equal($.datepicker._get(inst, 'currentText'), 'Current', 'Before show - changed'); ok(beforeShowThis.id == inp[0].id, 'Before show - this OK'); ok(beforeShowInput.id == inp[0].id, 'Before show - input OK'); deepEqual(beforeShowInst, inst, 'Before show - inst OK'); @@ -708,26 +708,26 @@ test('localisation', function() { var inp = init('#inp', $.datepicker.regional['fr']); inp.datepicker('option', {dateFormat: 'DD, d MM yy', showButtonPanel:true, changeMonth:true, changeYear:true}).val('').datepicker('show'); var dp = $('#ui-datepicker-div'); - equals($('.ui-datepicker-close', dp).text(), 'Fermer', 'Localisation - close'); + equal($('.ui-datepicker-close', dp).text(), 'Fermer', 'Localisation - close'); $('.ui-datepicker-close', dp).simulate('mouseover'); - equals($('.ui-datepicker-prev', dp).text(), 'Précédent', 'Localisation - previous'); - equals($('.ui-datepicker-current', dp).text(), 'Aujourd\'hui', 'Localisation - current'); - equals($('.ui-datepicker-next', dp).text(), 'Suivant', 'Localisation - next'); + equal($('.ui-datepicker-prev', dp).text(), 'Précédent', 'Localisation - previous'); + equal($('.ui-datepicker-current', dp).text(), 'Aujourd\'hui', 'Localisation - current'); + equal($('.ui-datepicker-next', dp).text(), 'Suivant', 'Localisation - next'); var month = 0; $('.ui-datepicker-month option', dp).each(function() { - equals($(this).text(), $.datepicker.regional['fr'].monthNamesShort[month], + equal($(this).text(), $.datepicker.regional['fr'].monthNamesShort[month], 'Localisation - month ' + month); month++; }); var day = 1; $('.ui-datepicker-calendar th', dp).each(function() { - equals($(this).text(), $.datepicker.regional['fr'].dayNamesMin[day], + equal($(this).text(), $.datepicker.regional['fr'].dayNamesMin[day], 'Localisation - day ' + day); day = (day + 1) % 7; }); inp.simulate('keydown', {keyCode: $.simulate.VK_ENTER}); var date = new Date(); - equals(inp.val(), $.datepicker.regional['fr'].dayNames[date.getDay()] + ', ' + + equal(inp.val(), $.datepicker.regional['fr'].dayNames[date.getDay()] + ', ' + date.getDate() + ' ' + $.datepicker.regional['fr'].monthNames[date.getMonth()] + ' ' + date.getFullYear(), 'Localisation - formatting'); }); @@ -742,29 +742,29 @@ test('noWeekends', function() { test('iso8601Week', function() { var date = new Date(2000, 12 - 1, 31); - equals($.datepicker.iso8601Week(date), 52, 'ISO 8601 week ' + date); + equal($.datepicker.iso8601Week(date), 52, 'ISO 8601 week ' + date); date = new Date(2001, 1 - 1, 1); - equals($.datepicker.iso8601Week(date), 1, 'ISO 8601 week ' + date); + equal($.datepicker.iso8601Week(date), 1, 'ISO 8601 week ' + date); date = new Date(2001, 1 - 1, 7); - equals($.datepicker.iso8601Week(date), 1, 'ISO 8601 week ' + date); + equal($.datepicker.iso8601Week(date), 1, 'ISO 8601 week ' + date); date = new Date(2001, 1 - 1, 8); - equals($.datepicker.iso8601Week(date), 2, 'ISO 8601 week ' + date); + equal($.datepicker.iso8601Week(date), 2, 'ISO 8601 week ' + date); date = new Date(2003, 12 - 1, 28); - equals($.datepicker.iso8601Week(date), 52, 'ISO 8601 week ' + date); + equal($.datepicker.iso8601Week(date), 52, 'ISO 8601 week ' + date); date = new Date(2003, 12 - 1, 29); - equals($.datepicker.iso8601Week(date), 1, 'ISO 8601 week ' + date); + equal($.datepicker.iso8601Week(date), 1, 'ISO 8601 week ' + date); date = new Date(2004, 1 - 1, 4); - equals($.datepicker.iso8601Week(date), 1, 'ISO 8601 week ' + date); + equal($.datepicker.iso8601Week(date), 1, 'ISO 8601 week ' + date); date = new Date(2004, 1 - 1, 5); - equals($.datepicker.iso8601Week(date), 2, 'ISO 8601 week ' + date); + equal($.datepicker.iso8601Week(date), 2, 'ISO 8601 week ' + date); date = new Date(2009, 12 - 1, 28); - equals($.datepicker.iso8601Week(date), 53, 'ISO 8601 week ' + date); + equal($.datepicker.iso8601Week(date), 53, 'ISO 8601 week ' + date); date = new Date(2010, 1 - 1, 3); - equals($.datepicker.iso8601Week(date), 53, 'ISO 8601 week ' + date); + equal($.datepicker.iso8601Week(date), 53, 'ISO 8601 week ' + date); date = new Date(2010, 1 - 1, 4); - equals($.datepicker.iso8601Week(date), 1, 'ISO 8601 week ' + date); + equal($.datepicker.iso8601Week(date), 1, 'ISO 8601 week ' + date); date = new Date(2010, 1 - 1, 10); - equals($.datepicker.iso8601Week(date), 1, 'ISO 8601 week ' + date); + equal($.datepicker.iso8601Week(date), 1, 'ISO 8601 week ' + date); }); test('parseDate', function() { @@ -838,7 +838,7 @@ test('parseDateErrors', function() { ok(false, 'Parsed error ' + value); } catch (e) { - equals(e, error, 'Parsed error ' + value); + equal(e, error, 'Parsed error ' + value); } }; expectError(function() { $.datepicker.parseDate(null, 'Sat 2 01'); }, @@ -883,41 +883,41 @@ test('parseDateErrors', function() { test('formatDate', function() { init('#inp'); - equals($.datepicker.formatDate('d m y', new Date(2001, 2 - 1, 3)), + equal($.datepicker.formatDate('d m y', new Date(2001, 2 - 1, 3)), '3 2 01', 'Format date d m y'); - equals($.datepicker.formatDate('dd mm yy', new Date(2001, 2 - 1, 3)), + equal($.datepicker.formatDate('dd mm yy', new Date(2001, 2 - 1, 3)), '03 02 2001', 'Format date dd mm yy'); - equals($.datepicker.formatDate('d m y', new Date(2001, 12 - 1, 13)), + equal($.datepicker.formatDate('d m y', new Date(2001, 12 - 1, 13)), '13 12 01', 'Format date d m y'); - equals($.datepicker.formatDate('dd mm yy', new Date(2001, 12 - 1, 13)), + equal($.datepicker.formatDate('dd mm yy', new Date(2001, 12 - 1, 13)), '13 12 2001', 'Format date dd mm yy'); - equals($.datepicker.formatDate('yy-o', new Date(2001, 2 - 1, 3)), + equal($.datepicker.formatDate('yy-o', new Date(2001, 2 - 1, 3)), '2001-34', 'Format date yy-o'); - equals($.datepicker.formatDate('yy-oo', new Date(2001, 2 - 1, 3)), + equal($.datepicker.formatDate('yy-oo', new Date(2001, 2 - 1, 3)), '2001-034', 'Format date yy-oo'); - equals($.datepicker.formatDate('D M y', new Date(2001, 2 - 1, 3)), + equal($.datepicker.formatDate('D M y', new Date(2001, 2 - 1, 3)), 'Sat Feb 01', 'Format date D M y'); - equals($.datepicker.formatDate('DD MM yy', new Date(2001, 2 - 1, 3)), + equal($.datepicker.formatDate('DD MM yy', new Date(2001, 2 - 1, 3)), 'Saturday February 2001', 'Format date DD MM yy'); - equals($.datepicker.formatDate('DD, MM d, yy', new Date(2001, 2 - 1, 3)), + equal($.datepicker.formatDate('DD, MM d, yy', new Date(2001, 2 - 1, 3)), 'Saturday, February 3, 2001', 'Format date DD, MM d, yy'); - equals($.datepicker.formatDate('\'day\' d \'of\' MM (\'\'DD\'\'), yy', + equal($.datepicker.formatDate('\'day\' d \'of\' MM (\'\'DD\'\'), yy', new Date(2001, 2 - 1, 3)), 'day 3 of February (\'Saturday\'), 2001', 'Format date \'day\' d \'of\' MM (\'\'DD\'\'), yy'); var gmtDate = new Date(2001, 2 - 1, 3); gmtDate.setMinutes(gmtDate.getMinutes() - gmtDate.getTimezoneOffset()); - equals($.datepicker.formatDate('@', gmtDate), '981158400000', 'Format date @'); - equals($.datepicker.formatDate('!', gmtDate), '631167552000000000', 'Format date !'); + equal($.datepicker.formatDate('@', gmtDate), '981158400000', 'Format date @'); + equal($.datepicker.formatDate('!', gmtDate), '631167552000000000', 'Format date !'); var fr = $.datepicker.regional['fr']; var settings = {dayNamesShort: fr.dayNamesShort, dayNames: fr.dayNames, monthNamesShort: fr.monthNamesShort, monthNames: fr.monthNames}; - equals($.datepicker.formatDate('D M y', new Date(2001, 4 - 1, 9), settings), + equal($.datepicker.formatDate('D M y', new Date(2001, 4 - 1, 9), settings), 'Lun. Avril 01', 'Format date D M y with settings'); - equals($.datepicker.formatDate('DD MM yy', new Date(2001, 4 - 1, 9), settings), + equal($.datepicker.formatDate('DD MM yy', new Date(2001, 4 - 1, 9), settings), 'Lundi Avril 2001', 'Format date DD MM yy with settings'); - equals($.datepicker.formatDate('DD, MM d, yy', new Date(2001, 4 - 1, 9), settings), + equal($.datepicker.formatDate('DD, MM d, yy', new Date(2001, 4 - 1, 9), settings), 'Lundi, Avril 9, 2001', 'Format date DD, MM d, yy with settings'); - equals($.datepicker.formatDate('\'jour\' d \'de\' MM (\'\'DD\'\'), yy', + equal($.datepicker.formatDate('\'jour\' d \'de\' MM (\'\'DD\'\'), yy', new Date(2001, 4 - 1, 9), settings), 'jour 9 de Avril (\'Lundi\'), 2001', 'Format date \'jour\' d \'de\' MM (\'\'DD\'\'), yy with settings'); }); diff --git a/tests/unit/datepicker/datepicker_tickets.js b/tests/unit/datepicker/datepicker_tickets.js index 353426625a8..fcf71237008 100644 --- a/tests/unit/datepicker/datepicker_tickets.js +++ b/tests/unit/datepicker/datepicker_tickets.js @@ -11,16 +11,16 @@ test('beforeShowDay-getDate', function() { var dp = $('#ui-datepicker-div'); inp.val('01/01/2010').datepicker('show'); // contains non-breaking space - equals($('div.ui-datepicker-title').text(), 'January 2010', 'Initial month'); + equal($('div.ui-datepicker-title').text(), 'January 2010', 'Initial month'); $('a.ui-datepicker-next', dp).click(); $('a.ui-datepicker-next', dp).click(); // contains non-breaking space - equals($('div.ui-datepicker-title').text(), 'March 2010', 'After next clicks'); + equal($('div.ui-datepicker-title').text(), 'March 2010', 'After next clicks'); inp.datepicker('hide').datepicker('show'); $('a.ui-datepicker-prev', dp).click(); $('a.ui-datepicker-prev', dp).click(); // contains non-breaking space - equals($('div.ui-datepicker-title').text(), 'November 2009', 'After prev clicks'); + equal($('div.ui-datepicker-title').text(), 'November 2009', 'After prev clicks'); inp.datepicker('hide'); }); @@ -32,9 +32,9 @@ test('Ticket 7602: Stop datepicker from appearing with beforeShow event handler' }); var dp = $('#ui-datepicker-div'); inp.datepicker('show'); - equals(dp.css('display'), 'none',"beforeShow returns false"); + equal(dp.css('display'), 'none',"beforeShow returns false"); inp.datepicker('destroy'); - + inp = init('#inp',{ beforeShow: function(){ } @@ -44,7 +44,7 @@ test('Ticket 7602: Stop datepicker from appearing with beforeShow event handler' equal(dp.css('display'), 'block',"beforeShow returns nothing"); inp.datepicker('hide'); inp.datepicker('destroy'); - + inp = init('#inp',{ beforeShow: function(){ return true; @@ -58,8 +58,8 @@ test('Ticket 7602: Stop datepicker from appearing with beforeShow event handler' }); test('Ticket 6827: formatDate day of year calculation is wrong during day lights savings time', function(){ - var time = $.datepicker.formatDate("oo", new Date("2010/03/30 12:00:00 CDT")); - equals(time, "089"); + var time = $.datepicker.formatDate("oo", new Date("2010/03/30 12:00:00 CDT")); + equal(time, "089"); }); test('Ticket #7244: date parser does not fail when too many numbers are passed into the date function', function() { diff --git a/tests/unit/dialog/dialog_core.js b/tests/unit/dialog/dialog_core.js index 2003689e92d..4a671968e25 100644 --- a/tests/unit/dialog/dialog_core.js +++ b/tests/unit/dialog/dialog_core.js @@ -42,7 +42,7 @@ function moved(dx, dy, msg) { msg = msg ? msg + "." : ""; var actual = { left: Math.round(offsetAfter.left), top: Math.round(offsetAfter.top) }; var expected = { left: Math.round(offsetBefore.left + dx), top: Math.round(offsetBefore.top + dy) }; - same(actual, expected, 'dragged[' + dragged.dx + ', ' + dragged.dy + '] ' + msg); + deepEqual(actual, expected, 'dragged[' + dragged.dx + ', ' + dragged.dy + '] ' + msg); } function shouldmove(why) { @@ -61,7 +61,7 @@ function resized(dw, dh, msg) { msg = msg ? msg + "." : ""; var actual = { width: widthAfter, height: heightAfter }; var expected = { width: widthBefore + dw, height: heightBefore + dh }; - same(actual, expected, 'resized[' + dragged.dx + ', ' + dragged.dy + '] ' + msg); + deepEqual(actual, expected, 'resized[' + dragged.dx + ', ' + dragged.dy + '] ' + msg); } function shouldresize(why) { @@ -98,17 +98,17 @@ test("title id", function() { el = $('
      ').dialog(); titleId = dlg().find('.ui-dialog-title').attr('id'); - equals(titleId, 'ui-dialog-title-1', 'auto-numbered title id'); + equal(titleId, 'ui-dialog-title-1', 'auto-numbered title id'); el.remove(); el = $('
      ').dialog(); titleId = dlg().find('.ui-dialog-title').attr('id'); - equals(titleId, 'ui-dialog-title-2', 'auto-numbered title id'); + equal(titleId, 'ui-dialog-title-2', 'auto-numbered title id'); el.remove(); el = $('
      ').dialog(); titleId = dlg().find('.ui-dialog-title').attr('id'); - equals(titleId, 'ui-dialog-title-foo', 'carried over title id'); + equal(titleId, 'ui-dialog-title-foo', 'carried over title id'); el.remove(); }); @@ -117,14 +117,14 @@ test("ARIA", function() { el = $('
      ').dialog(); - equals(dlg().attr('role'), 'dialog', 'dialog role'); + equal(dlg().attr('role'), 'dialog', 'dialog role'); var labelledBy = dlg().attr('aria-labelledby'); ok(labelledBy.length > 0, 'has aria-labelledby attribute'); - equals(dlg().find('.ui-dialog-title').attr('id'), labelledBy, + equal(dlg().find('.ui-dialog-title').attr('id'), labelledBy, 'proper aria-labelledby attribute'); - equals(dlg().find('.ui-dialog-titlebar-close').attr('role'), 'button', + equal(dlg().find('.ui-dialog-titlebar-close').attr('role'), 'button', 'close link role'); el.remove(); @@ -132,7 +132,7 @@ test("ARIA", function() { test("widget method", function() { var dialog = $("
      ").appendTo("#main").dialog(); - same(dialog.parent()[0], dialog.dialog("widget")[0]); + deepEqual(dialog.parent()[0], dialog.dialog("widget")[0]); }); })(jQuery); diff --git a/tests/unit/dialog/dialog_events.js b/tests/unit/dialog/dialog_events.js index 40a8575b653..4b769bafc01 100644 --- a/tests/unit/dialog/dialog_events.js +++ b/tests/unit/dialog/dialog_events.js @@ -13,9 +13,9 @@ test("open", function() { open: function(ev, ui) { ok(el.data("dialog")._isOpen, "interal _isOpen flag is set"); ok(true, 'autoOpen: true fires open callback'); - equals(this, el[0], "context of callback"); - equals(ev.type, 'dialogopen', 'event type in callback'); - same(ui, {}, 'ui hash in callback'); + equal(this, el[0], "context of callback"); + equal(ev.type, 'dialogopen', 'event type in callback'); + deepEqual(ui, {}, 'ui hash in callback'); } }); el.remove(); @@ -25,15 +25,15 @@ test("open", function() { autoOpen: false, open: function(ev, ui) { ok(true, '.dialog("open") fires open callback'); - equals(this, el[0], "context of callback"); - equals(ev.type, 'dialogopen', 'event type in callback'); - same(ui, {}, 'ui hash in callback'); + equal(this, el[0], "context of callback"); + equal(ev.type, 'dialogopen', 'event type in callback'); + deepEqual(ui, {}, 'ui hash in callback'); } }).bind('dialogopen', function(ev, ui) { ok(el.data("dialog")._isOpen, "interal _isOpen flag is set"); ok(true, 'dialog("open") fires open event'); - equals(this, el[0], 'context of event'); - same(ui, {}, 'ui hash in event'); + equal(this, el[0], 'context of event'); + deepEqual(ui, {}, 'ui hash in event'); }); el.dialog("open"); el.remove(); @@ -45,14 +45,14 @@ test("dragStart", function() { el = $('
      ').dialog({ dragStart: function(ev, ui) { ok(true, 'dragging fires dragStart callback'); - equals(this, el[0], "context of callback"); - equals(ev.type, 'dialogdragstart', 'event type in callback'); + equal(this, el[0], "context of callback"); + equal(ev.type, 'dialogdragstart', 'event type in callback'); ok(ui.position !== undefined, "ui.position in callback"); ok(ui.offset !== undefined, "ui.offset in callback"); } }).bind('dialogdragstart', function(ev, ui) { ok(true, 'dragging fires dialogdragstart event'); - equals(this, el[0], 'context of event'); + equal(this, el[0], 'context of event'); ok(ui.position !== undefined, "ui.position in callback"); ok(ui.offset !== undefined, "ui.offset in callback"); }); @@ -64,22 +64,22 @@ test("dragStart", function() { test("drag", function() { expect(9); var hasDragged = false; - + el = $('
      ').dialog({ drag: function(ev, ui) { if (!hasDragged) { ok(true, 'dragging fires drag callback'); - equals(this, el[0], "context of callback"); - equals(ev.type, 'dialogdrag', 'event type in callback'); + equal(this, el[0], "context of callback"); + equal(ev.type, 'dialogdrag', 'event type in callback'); ok(ui.position !== undefined, "ui.position in callback"); ok(ui.offset !== undefined, "ui.offset in callback"); - + hasDragged = true; } } }).one('dialogdrag', function(ev, ui) { ok(true, 'dragging fires dialogdrag event'); - equals(this, el[0], 'context of event'); + equal(this, el[0], 'context of event'); ok(ui.position !== undefined, "ui.position in callback"); ok(ui.offset !== undefined, "ui.offset in callback"); }); @@ -94,14 +94,14 @@ test("dragStop", function() { el = $('
      ').dialog({ dragStop: function(ev, ui) { ok(true, 'dragging fires dragStop callback'); - equals(this, el[0], "context of callback"); - equals(ev.type, 'dialogdragstop', 'event type in callback'); + equal(this, el[0], "context of callback"); + equal(ev.type, 'dialogdragstop', 'event type in callback'); ok(ui.position !== undefined, "ui.position in callback"); ok(ui.offset !== undefined, "ui.offset in callback"); } }).bind('dialogdragstop', function(ev, ui) { ok(true, 'dragging fires dialogdragstop event'); - equals(this, el[0], 'context of event'); + equal(this, el[0], 'context of event'); ok(ui.position !== undefined, "ui.position in callback"); ok(ui.offset !== undefined, "ui.offset in callback"); }); @@ -116,8 +116,8 @@ test("resizeStart", function() { el = $('
      ').dialog({ resizeStart: function(ev, ui) { ok(true, 'resizing fires resizeStart callback'); - equals(this, el[0], "context of callback"); - equals(ev.type, 'dialogresizestart', 'event type in callback'); + equal(this, el[0], "context of callback"); + equal(ev.type, 'dialogresizestart', 'event type in callback'); ok(ui.originalPosition !== undefined, "ui.originalPosition in callback"); ok(ui.originalSize !== undefined, "ui.originalSize in callback"); ok(ui.position !== undefined, "ui.position in callback"); @@ -125,7 +125,7 @@ test("resizeStart", function() { } }).bind('dialogresizestart', function(ev, ui) { ok(true, 'resizing fires dialogresizestart event'); - equals(this, el[0], 'context of event'); + equal(this, el[0], 'context of event'); ok(ui.originalPosition !== undefined, "ui.originalPosition in callback"); ok(ui.originalSize !== undefined, "ui.originalSize in callback"); ok(ui.position !== undefined, "ui.position in callback"); @@ -144,19 +144,19 @@ test("resize", function() { resize: function(ev, ui) { if (!hasResized) { ok(true, 'resizing fires resize callback'); - equals(this, el[0], "context of callback"); - equals(ev.type, 'dialogresize', 'event type in callback'); + equal(this, el[0], "context of callback"); + equal(ev.type, 'dialogresize', 'event type in callback'); ok(ui.originalPosition !== undefined, "ui.originalPosition in callback"); ok(ui.originalSize !== undefined, "ui.originalSize in callback"); ok(ui.position !== undefined, "ui.position in callback"); ok(ui.size !== undefined, "ui.size in callback"); - + hasResized = true; } } }).one('dialogresize', function(ev, ui) { ok(true, 'resizing fires dialogresize event'); - equals(this, el[0], 'context of event'); + equal(this, el[0], 'context of event'); ok(ui.originalPosition !== undefined, "ui.originalPosition in callback"); ok(ui.originalSize !== undefined, "ui.originalSize in callback"); ok(ui.position !== undefined, "ui.position in callback"); @@ -173,8 +173,8 @@ test("resizeStop", function() { el = $('
      ').dialog({ resizeStop: function(ev, ui) { ok(true, 'resizing fires resizeStop callback'); - equals(this, el[0], "context of callback"); - equals(ev.type, 'dialogresizestop', 'event type in callback'); + equal(this, el[0], "context of callback"); + equal(ev.type, 'dialogresizestop', 'event type in callback'); ok(ui.originalPosition !== undefined, "ui.originalPosition in callback"); ok(ui.originalSize !== undefined, "ui.originalSize in callback"); ok(ui.position !== undefined, "ui.position in callback"); @@ -182,7 +182,7 @@ test("resizeStop", function() { } }).bind('dialogresizestop', function(ev, ui) { ok(true, 'resizing fires dialogresizestop event'); - equals(this, el[0], 'context of event'); + equal(this, el[0], 'context of event'); ok(ui.originalPosition !== undefined, "ui.originalPosition in callback"); ok(ui.originalSize !== undefined, "ui.originalSize in callback"); ok(ui.position !== undefined, "ui.position in callback"); @@ -199,14 +199,14 @@ test("close", function() { el = $('
      ').dialog({ close: function(ev, ui) { ok(true, '.dialog("close") fires close callback'); - equals(this, el[0], "context of callback"); - equals(ev.type, 'dialogclose', 'event type in callback'); - same(ui, {}, 'ui hash in callback'); + equal(this, el[0], "context of callback"); + equal(ev.type, 'dialogclose', 'event type in callback'); + deepEqual(ui, {}, 'ui hash in callback'); } }).bind('dialogclose', function(ev, ui) { ok(true, '.dialog("close") fires dialogclose event'); - equals(this, el[0], 'context of event'); - same(ui, {}, 'ui hash in event'); + equal(this, el[0], 'context of event'); + deepEqual(ui, {}, 'ui hash in event'); }); el.dialog('close'); el.remove(); @@ -218,9 +218,9 @@ test("beforeClose", function() { el = $('
      ').dialog({ beforeClose: function(ev, ui) { ok(true, '.dialog("close") fires beforeClose callback'); - equals(this, el[0], "context of callback"); - equals(ev.type, 'dialogbeforeclose', 'event type in callback'); - same(ui, {}, 'ui hash in callback'); + equal(this, el[0], "context of callback"); + equal(ev.type, 'dialogbeforeclose', 'event type in callback'); + deepEqual(ui, {}, 'ui hash in callback'); return false; } }); @@ -231,9 +231,9 @@ test("beforeClose", function() { el = $('
      ').dialog(); el.dialog('option', 'beforeClose', function(ev, ui) { ok(true, '.dialog("close") fires beforeClose callback'); - equals(this, el[0], "context of callback"); - equals(ev.type, 'dialogbeforeclose', 'event type in callback'); - same(ui, {}, 'ui hash in callback'); + equal(this, el[0], "context of callback"); + equal(ev.type, 'dialogbeforeclose', 'event type in callback'); + deepEqual(ui, {}, 'ui hash in callback'); return false; }); el.dialog('close'); @@ -242,8 +242,8 @@ test("beforeClose", function() { el = $('
      ').dialog().bind('dialogbeforeclose', function(ev, ui) { ok(true, '.dialog("close") triggers dialogbeforeclose event'); - equals(this, el[0], "context of event"); - same(ui, {}, 'ui hash in event'); + equal(this, el[0], "context of event"); + deepEqual(ui, {}, 'ui hash in event'); return false; }); el.dialog('close'); diff --git a/tests/unit/dialog/dialog_methods.js b/tests/unit/dialog/dialog_methods.js index a961b4e034c..645baa9f587 100644 --- a/tests/unit/dialog/dialog_methods.js +++ b/tests/unit/dialog/dialog_methods.js @@ -45,36 +45,36 @@ test("destroy", function() { var expected = $('
      ').dialog(), actual = expected.dialog('destroy'); - equals(actual, expected, 'destroy is chainable'); + equal(actual, expected, 'destroy is chainable'); }); test("enable", function() { var expected = $('
      ').dialog(), actual = expected.dialog('enable'); - equals(actual, expected, 'enable is chainable'); - + equal(actual, expected, 'enable is chainable'); + el = $('
      ').dialog({ disabled: true }); el.dialog('enable'); - equals(el.dialog('option', 'disabled'), false, 'enable method sets disabled option to false'); + equal(el.dialog('option', 'disabled'), false, 'enable method sets disabled option to false'); ok(!dlg().hasClass('ui-dialog-disabled'), 'enable method removes ui-dialog-disabled class from ui-dialog element'); }); test("disable", function() { var expected = $('
      ').dialog(), actual = expected.dialog('disable'); - equals(actual, expected, 'disable is chainable'); - + equal(actual, expected, 'disable is chainable'); + el = $('
      ').dialog({ disabled: false }); el.dialog('disable'); - equals(el.dialog('option', 'disabled'), true, 'disable method sets disabled option to true'); + equal(el.dialog('option', 'disabled'), true, 'disable method sets disabled option to true'); ok(dlg().hasClass('ui-dialog-disabled'), 'disable method adds ui-dialog-disabled class to ui-dialog element'); }); test("close", function() { var expected = $('
      ').dialog(), actual = expected.dialog('close'); - equals(actual, expected, 'close is chainable'); - + equal(actual, expected, 'close is chainable'); + el = $('
      ').dialog(); ok(dlg().is(':visible') && !dlg().is(':hidden'), 'dialog visible before close method called'); el.dialog('close'); @@ -85,22 +85,22 @@ test("isOpen", function() { expect(4); el = $('
      ').dialog(); - equals(el.dialog('isOpen'), true, "dialog is open after init"); + equal(el.dialog('isOpen'), true, "dialog is open after init"); el.dialog('close'); - equals(el.dialog('isOpen'), false, "dialog is closed"); + equal(el.dialog('isOpen'), false, "dialog is closed"); el.remove(); el = $('
      ').dialog({autoOpen: false}); - equals(el.dialog('isOpen'), false, "dialog is closed after init"); + equal(el.dialog('isOpen'), false, "dialog is closed after init"); el.dialog('open'); - equals(el.dialog('isOpen'), true, "dialog is open"); + equal(el.dialog('isOpen'), true, "dialog is open"); el.remove(); }); test("moveToTop", function() { var expected = $('
      ').dialog(), actual = expected.dialog('moveToTop'); - equals(actual, expected, 'moveToTop is chainable'); + equal(actual, expected, 'moveToTop is chainable'); var d1 = $('
      ').dialog(), dlg1 = d1.parents('.ui-dialog'); d1.dialog('close'); @@ -116,7 +116,7 @@ test("moveToTop", function() { test("open", function() { var expected = $('
      ').dialog(), actual = expected.dialog('open'); - equals(actual, expected, 'open is chainable'); + equal(actual, expected, 'open is chainable'); el = $('
      ').dialog({ autoOpen: false }); ok(dlg().is(':hidden') && !dlg().is(':visible'), 'dialog hidden before open method called'); diff --git a/tests/unit/dialog/dialog_options.js b/tests/unit/dialog/dialog_options.js index 264c2fb6ee1..10443892b0a 100644 --- a/tests/unit/dialog/dialog_options.js +++ b/tests/unit/dialog/dialog_options.js @@ -23,58 +23,58 @@ test("buttons", function() { var buttons = { "Ok": function(ev, ui) { ok(true, "button click fires callback"); - equals(this, el[0], "context of callback"); - equals(ev.target, btn[0], "event target"); + equal(this, el[0], "context of callback"); + equal(ev.target, btn[0], "event target"); }, "Cancel": function(ev, ui) { ok(true, "button click fires callback"); - equals(this, el[0], "context of callback"); - equals(ev.target, btn[1], "event target"); + equal(this, el[0], "context of callback"); + equal(ev.target, btn[1], "event target"); } }; el = $('
      ').dialog({ buttons: buttons }); var btn = $("button", dlg()); - equals(btn.length, 2, "number of buttons"); + equal(btn.length, 2, "number of buttons"); var i = 0; $.each(buttons, function(key, val) { - equals(btn.eq(i).text(), key, "text of button " + (i+1)); + equal(btn.eq(i).text(), key, "text of button " + (i+1)); i++; }); ok(btn.parent().hasClass('ui-dialog-buttonset'), "buttons in container"); ok(el.parent().hasClass('ui-dialog-buttons'), "dialog wrapper adds class about having buttons"); - + btn.trigger("click"); var newButtons = { "Close": function(ev, ui) { ok(true, "button click fires callback"); - equals(this, el[0], "context of callback"); - equals(ev.target, btn[0], "event target"); + equal(this, el[0], "context of callback"); + equal(ev.target, btn[0], "event target"); } }; - same(el.dialog("option", "buttons"), buttons, '.dialog("option", "buttons") getter'); + deepEqual(el.dialog("option", "buttons"), buttons, '.dialog("option", "buttons") getter'); el.dialog("option", "buttons", newButtons); - same(el.dialog("option", "buttons"), newButtons, '.dialog("option", "buttons", ...) setter'); + deepEqual(el.dialog("option", "buttons"), newButtons, '.dialog("option", "buttons", ...) setter'); btn = $("button", dlg()); - equals(btn.length, 1, "number of buttons after setter"); + equal(btn.length, 1, "number of buttons after setter"); btn.trigger('click'); i = 0; $.each(newButtons, function(key, val) { - equals(btn.eq(i).text(), key, "text of button " + (i+1)); + equal(btn.eq(i).text(), key, "text of button " + (i+1)); i += 1; }); - + el.dialog("option", "buttons", null); btn = $("button", dlg()); - equals(btn.length, 0, "all buttons have been removed"); - equals(el.find(".ui-dialog-buttonset").length, 0, "buttonset has been removed"); - equals(el.parent().hasClass('ui-dialog-buttons'), false, "dialog wrapper removes class about having buttons"); + equal(btn.length, 0, "all buttons have been removed"); + equal(el.find(".ui-dialog-buttonset").length, 0, "buttonset has been removed"); + equal(el.parent().hasClass('ui-dialog-buttons'), false, "dialog wrapper removes class about having buttons"); el.remove(); }); @@ -89,15 +89,15 @@ test("buttons - advanced", function() { "class": "additional-class", id: "my-button-id", click: function() { - equals(this, el[0], "correct context"); + equal(this, el[0], "correct context"); } } ] }); var buttons = dlg().find("button"); - equals(buttons.length, 1, "correct number of buttons"); - equals(buttons.attr("id"), "my-button-id", "correct id"); - equals(buttons.text(), "a button", "correct label"); + equal(buttons.length, 1, "correct number of buttons"); + equal(buttons.attr("id"), "my-button-id", "correct id"); + equal(buttons.text(), "a button", "correct label"); ok(buttons.hasClass("additional-class"), "additional classes added"); buttons.click(); @@ -112,9 +112,9 @@ test("closeOnEscape", function() { .simulate('keypress', { keyCode: $.ui.keyCode.ESCAPE }) .simulate('keyup', { keyCode: $.ui.keyCode.ESCAPE }); ok(dlg().is(':visible') && !dlg().is(':hidden'), 'dialog is open after ESC'); - + el.remove(); - + el = $('
      ').dialog({ closeOnEscape: true }); ok(true, 'closeOnEscape: true'); ok(dlg().is(':visible') && !dlg().is(':hidden'), 'dialog is open before ESC'); @@ -128,17 +128,17 @@ test("closeText", function() { expect(3); el = $('
      ').dialog(); - equals(dlg().find('.ui-dialog-titlebar-close span').text(), 'close', + equal(dlg().find('.ui-dialog-titlebar-close span').text(), 'close', 'default close text'); el.remove(); el = $('
      ').dialog({ closeText: "foo" }); - equals(dlg().find('.ui-dialog-titlebar-close span').text(), 'foo', + equal(dlg().find('.ui-dialog-titlebar-close span').text(), 'foo', 'closeText on init'); el.remove(); el = $('
      ').dialog().dialog('option', 'closeText', 'bar'); - equals(dlg().find('.ui-dialog-titlebar-close span').text(), 'bar', + equal(dlg().find('.ui-dialog-titlebar-close span').text(), 'bar', 'closeText via option method'); el.remove(); }); @@ -147,16 +147,16 @@ test("dialogClass", function() { expect(4); el = $('
      ').dialog(); - equals(dlg().is(".foo"), false, 'dialogClass not specified. foo class added'); + equal(dlg().is(".foo"), false, 'dialogClass not specified. foo class added'); el.remove(); el = $('
      ').dialog({ dialogClass: "foo" }); - equals(dlg().is(".foo"), true, 'dialogClass in init. foo class added'); + equal(dlg().is(".foo"), true, 'dialogClass in init. foo class added'); el.remove(); el = $('
      ').dialog({ dialogClass: "foo bar" }); - equals(dlg().is(".foo"), true, 'dialogClass in init, two classes. foo class added'); - equals(dlg().is(".bar"), true, 'dialogClass in init, two classes. bar class added'); + equal(dlg().is(".foo"), true, 'dialogClass in init, two classes. foo class added'); + equal(dlg().is(".bar"), true, 'dialogClass in init, two classes. bar class added'); el.remove(); }); @@ -180,21 +180,21 @@ test("height", function() { expect(4); el = $('
      ').dialog(); - equals(dlg().outerHeight(), 150, "default height"); + equal(dlg().outerHeight(), 150, "default height"); el.remove(); el = $('
      ').dialog({ height: 237 }); - equals(dlg().outerHeight(), 237, "explicit height"); + equal(dlg().outerHeight(), 237, "explicit height"); el.remove(); el = $('
      ').dialog(); el.dialog('option', 'height', 238); - equals(dlg().outerHeight(), 238, "explicit height set after init"); + equal(dlg().outerHeight(), 238, "explicit height set after init"); el.remove(); - + el = $('
      ').css("padding", "20px") .dialog({ height: 240 }); - equals(dlg().outerHeight(), 240, "explicit height with padding"); + equal(dlg().outerHeight(), 240, "explicit height with padding"); el.remove(); }); @@ -203,17 +203,17 @@ test("maxHeight", function() { el = $('
      ').dialog({ maxHeight: 200 }); drag('.ui-resizable-s', 1000, 1000); - equals(heightAfter, 200, "maxHeight"); + equal(heightAfter, 200, "maxHeight"); el.remove(); el = $('
      ').dialog({ maxHeight: 200 }); drag('.ui-resizable-n', -1000, -1000); - equals(heightAfter, 200, "maxHeight"); + equal(heightAfter, 200, "maxHeight"); el.remove(); el = $('
      ').dialog({ maxHeight: 200 }).dialog('option', 'maxHeight', 300); drag('.ui-resizable-s', 1000, 1000); - equals(heightAfter, 300, "maxHeight"); + equal(heightAfter, 300, "maxHeight"); el.remove(); }); @@ -222,17 +222,17 @@ test("maxWidth", function() { el = $('
      ').dialog({ maxWidth: 200 }); drag('.ui-resizable-e', 1000, 1000); - equals(widthAfter, 200, "maxWidth"); + equal(widthAfter, 200, "maxWidth"); el.remove(); el = $('
      ').dialog({ maxWidth: 200 }); drag('.ui-resizable-w', -1000, -1000); - equals(widthAfter, 200, "maxWidth"); + equal(widthAfter, 200, "maxWidth"); el.remove(); el = $('
      ').dialog({ maxWidth: 200 }).dialog('option', 'maxWidth', 300); drag('.ui-resizable-w', -1000, -1000); - equals(widthAfter, 300, "maxWidth"); + equal(widthAfter, 300, "maxWidth"); el.remove(); }); @@ -241,17 +241,17 @@ test("minHeight", function() { el = $('
      ').dialog({ minHeight: 10 }); drag('.ui-resizable-s', -1000, -1000); - equals(heightAfter, 10, "minHeight"); + equal(heightAfter, 10, "minHeight"); el.remove(); el = $('
      ').dialog({ minHeight: 10 }); drag('.ui-resizable-n', 1000, 1000); - equals(heightAfter, 10, "minHeight"); + equal(heightAfter, 10, "minHeight"); el.remove(); el = $('
      ').dialog({ minHeight: 10 }).dialog('option', 'minHeight', 30); drag('.ui-resizable-n', 1000, 1000); - equals(heightAfter, 30, "minHeight"); + equal(heightAfter, 30, "minHeight"); el.remove(); }); @@ -260,17 +260,17 @@ test("minWidth", function() { el = $('
      ').dialog({ minWidth: 10 }); drag('.ui-resizable-e', -1000, -1000); - equals(widthAfter, 10, "minWidth"); + equal(widthAfter, 10, "minWidth"); el.remove(); el = $('
      ').dialog({ minWidth: 10 }); drag('.ui-resizable-w', 1000, 1000); - equals(widthAfter, 10, "minWidth"); + equal(widthAfter, 10, "minWidth"); el.remove(); el = $('
      ').dialog({ minWidth: 30 }).dialog('option', 'minWidth', 30); drag('.ui-resizable-w', 1000, 1000); - equals(widthAfter, 30, "minWidth"); + equal(widthAfter, 30, "minWidth"); el.remove(); }); @@ -278,8 +278,8 @@ test("position, default center on window", function() { var el = $('
      ').dialog(); var dialog = el.dialog('widget'); var offset = dialog.offset(); - same(offset.left, Math.round($(window).width() / 2 - dialog.outerWidth() / 2) + $(window).scrollLeft()); - same(offset.top, Math.round($(window).height() / 2 - dialog.outerHeight() / 2) + $(window).scrollTop()); + deepEqual(offset.left, Math.round($(window).width() / 2 - dialog.outerWidth() / 2) + $(window).scrollLeft()); + deepEqual(offset.top, Math.round($(window).height() / 2 - dialog.outerHeight() / 2) + $(window).scrollTop()); el.remove(); }); @@ -287,8 +287,8 @@ test("position, top on window", function() { var el = $('
      ').dialog({ position: "top" }); var dialog = el.dialog('widget'); var offset = dialog.offset(); - same(offset.left, Math.round($(window).width() / 2 - dialog.outerWidth() / 2) + $(window).scrollLeft()); - same(offset.top, $(window).scrollTop()); + deepEqual(offset.left, Math.round($(window).width() / 2 - dialog.outerWidth() / 2) + $(window).scrollLeft()); + deepEqual(offset.top, $(window).scrollTop()); el.remove(); }); @@ -296,8 +296,8 @@ test("position, left on window", function() { var el = $('
      ').dialog({ position: "left" }); var dialog = el.dialog('widget'); var offset = dialog.offset(); - same(offset.left, 0); - same(offset.top, Math.round($(window).height() / 2 - dialog.outerHeight() / 2) + $(window).scrollTop()); + deepEqual(offset.left, 0); + deepEqual(offset.top, Math.round($(window).height() / 2 - dialog.outerHeight() / 2) + $(window).scrollTop()); el.remove(); }); @@ -305,8 +305,8 @@ test("position, right bottom on window", function() { var el = $('
      ').dialog({ position: "right bottom" }); var dialog = el.dialog('widget'); var offset = dialog.offset(); - same(offset.left, $(window).width() - dialog.outerWidth() + $(window).scrollLeft()); - same(offset.top, $(window).height() - dialog.outerHeight() + $(window).scrollTop()); + deepEqual(offset.left, $(window).width() - dialog.outerWidth() + $(window).scrollLeft()); + deepEqual(offset.top, $(window).height() - dialog.outerHeight() + $(window).scrollTop()); el.remove(); }); @@ -314,8 +314,8 @@ test("position, right bottom on window w/array", function() { var el = $('
      ').dialog({ position: ["right", "bottom"] }); var dialog = el.dialog('widget'); var offset = dialog.offset(); - same(offset.left, $(window).width() - dialog.outerWidth() + $(window).scrollLeft()); - same(offset.top, $(window).height() - dialog.outerHeight() + $(window).scrollTop()); + deepEqual(offset.left, $(window).width() - dialog.outerWidth() + $(window).scrollLeft()); + deepEqual(offset.top, $(window).height() - dialog.outerHeight() + $(window).scrollTop()); el.remove(); }); @@ -323,8 +323,8 @@ test("position, offset from top left w/array", function() { var el = $('
      ').dialog({ position: [10, 10] }); var dialog = el.dialog('widget'); var offset = dialog.offset(); - same(offset.left, 10 + $(window).scrollLeft()); - same(offset.top, 10 + $(window).scrollTop()); + deepEqual(offset.left, 10 + $(window).scrollLeft()); + deepEqual(offset.top, 10 + $(window).scrollTop()); el.remove(); }); @@ -339,8 +339,8 @@ test("position, right bottom at right bottom via ui.position args", function() { var dialog = el.dialog('widget'); var offset = dialog.offset(); - same(offset.left, $(window).width() - dialog.outerWidth() + $(window).scrollLeft()); - same(offset.top, $(window).height() - dialog.outerHeight() + $(window).scrollTop()); + deepEqual(offset.left, $(window).width() - dialog.outerWidth() + $(window).scrollLeft()); + deepEqual(offset.top, $(window).height() - dialog.outerHeight() + $(window).scrollTop()); el.remove(); }); @@ -364,8 +364,8 @@ test("position, at another element", function() { var dialog = el.dialog('widget'); var offset = dialog.offset(); - same(offset.left, 600); - same(offset.top, 400); + deepEqual(offset.left, 600); + deepEqual(offset.top, 400); el.dialog('option', 'position', { my: "left top", @@ -375,8 +375,8 @@ test("position, at another element", function() { var offset = dialog.offset(); - same(offset.left, 610); - same(offset.top, 410); + deepEqual(offset.left, 610); + deepEqual(offset.top, 410); el.remove(); parent.remove(); @@ -408,27 +408,27 @@ test("title", function() { el = $('
      ').dialog(); // some browsers return a non-breaking space and some return " " // so we get the text to normalize to the actual non-breaking space - equals(dlg().find(".ui-dialog-title").text(), " ", "[default]"); - equals(el.dialog("option", "title"), "", "option not changed"); + equal(dlg().find(".ui-dialog-title").text(), " ", "[default]"); + equal(el.dialog("option", "title"), "", "option not changed"); el.remove(); el = $('
      ').dialog(); - equals(titleText(), "foo", "title in element attribute"); - equals(el.dialog("option", "title"), "foo", "option updated from attribute"); + equal(titleText(), "foo", "title in element attribute"); + equal(el.dialog("option", "title"), "foo", "option updated from attribute"); el.remove(); el = $('
      ').dialog({ title: 'foo' }); - equals(titleText(), "foo", "title in init options"); - equals(el.dialog("option", "title"), "foo", "opiton set from options hash"); + equal(titleText(), "foo", "title in init options"); + equal(el.dialog("option", "title"), "foo", "opiton set from options hash"); el.remove(); el = $('
      ').dialog({ title: 'bar' }); - equals(titleText(), "bar", "title in init options should override title in element attribute"); - equals(el.dialog("option", "title"), "bar", "opiton set from options hash"); + equal(titleText(), "bar", "title in init options should override title in element attribute"); + equal(el.dialog("option", "title"), "bar", "opiton set from options hash"); el.remove(); el = $('
      ').dialog().dialog('option', 'title', 'foo'); - equals(titleText(), 'foo', 'title after init'); + equal(titleText(), 'foo', 'title after init'); el.remove(); }); @@ -436,13 +436,13 @@ test("width", function() { expect(3); el = $('
      ').dialog(); - equals(dlg().width(), 300, "default width"); + equal(dlg().width(), 300, "default width"); el.remove(); el = $('
      ').dialog({width: 437 }); - equals(dlg().width(), 437, "explicit width"); + equal(dlg().width(), 437, "explicit width"); el.dialog('option', 'width', 438); - equals(dlg().width(), 438, 'explicit width after init'); + equal(dlg().width(), 438, 'explicit width after init'); el.remove(); }); diff --git a/tests/unit/dialog/dialog_tickets.js b/tests/unit/dialog/dialog_tickets.js index f8ab8b4230e..bd90561533c 100644 --- a/tests/unit/dialog/dialog_tickets.js +++ b/tests/unit/dialog/dialog_tickets.js @@ -41,7 +41,7 @@ test("#4826: setting resizable false toggles resizable on dialog", function() { shouldnotresize("[default]"); for (var i=0; i<2; i++) { el.dialog('close').dialog('open'); - shouldnotresize('initialized with resizable false toggle ('+ (i+1) +')'); + shouldnotresize('initialized with resizable false toggle ('+ (i+1) +')'); } el.remove(); @@ -49,10 +49,10 @@ test("#4826: setting resizable false toggles resizable on dialog", function() { shouldresize("[default]"); for (var i=0; i<2; i++) { el.dialog('close').dialog('option', 'resizable', false).dialog('open'); - shouldnotresize('set option resizable false toggle ('+ (i+1) +')'); + shouldnotresize('set option resizable false toggle ('+ (i+1) +')'); } el.remove(); - + }); test("#5184: isOpen in dialogclose event is true", function() { @@ -75,11 +75,11 @@ test("#5531: dialog width should be at least minWidth on creation", function () minWidth: 300 }); - equals(el.dialog('option', 'width'), 300, "width is minWidth"); + equal(el.dialog('option', 'width'), 300, "width is minWidth"); el.dialog('option', 'width', 200); - equals(el.dialog('option', 'width'), 300, "width unchanged when set to < minWidth"); + equal(el.dialog('option', 'width'), 300, "width unchanged when set to < minWidth"); el.dialog('option', 'width', 320); - equals(el.dialog('option', 'width'), 320, "width changed if set to > minWidth"); + equal(el.dialog('option', 'width'), 320, "width changed if set to > minWidth"); el.remove(); el = $('
      ').dialog({ @@ -109,9 +109,9 @@ test("#6645: Missing element not found check in overlay", function(){ expect(2); d1 = $('
      Dialog 1
      ').dialog({modal: true}); d2 = $('
      Dialog 2
      ').dialog({modal: true, close: function(){ d2.remove()}}); - equals($.ui.dialog.overlay.instances.length, 2, 'two overlays created'); + equal($.ui.dialog.overlay.instances.length, 2, 'two overlays created'); d2.dialog('close'); - equals($.ui.dialog.overlay.instances.length, 1, 'one overlay remains after closing the 2nd overlay'); + equal($.ui.dialog.overlay.instances.length, 1, 'one overlay remains after closing the 2nd overlay'); d1.add(d2).remove(); }); diff --git a/tests/unit/draggable/draggable_core.js b/tests/unit/draggable/draggable_core.js index a01de408fc2..ba5bc4c6680 100644 --- a/tests/unit/draggable/draggable_core.js +++ b/tests/unit/draggable/draggable_core.js @@ -19,7 +19,7 @@ var moved = function (dx, dy, msg) { msg = msg ? msg + "." : ""; var actual = { left: offsetAfter.left, top: offsetAfter.top }; var expected = { left: offsetBefore.left + dx, top: offsetBefore.top + dy }; - same(actual, expected, 'dragged[' + dragged.dx + ', ' + dragged.dy + '] ' + msg); + deepEqual(actual, expected, 'dragged[' + dragged.dx + ', ' + dragged.dy + '] ' + msg); } function restoreScroll(what) { diff --git a/tests/unit/draggable/draggable_events.js b/tests/unit/draggable/draggable_events.js index d92d8ee12d3..85ba824d8fe 100644 --- a/tests/unit/draggable/draggable_events.js +++ b/tests/unit/draggable/draggable_events.js @@ -18,9 +18,9 @@ test("callbacks occurance count", function() { drag(el, 10, 10); - equals(start, 1, "start callback should happen exactly once"); - equals(dragc, 3, "drag callback should happen exactly once per mousemove"); - equals(stop, 1, "stop callback should happen exactly once"); + equal(start, 1, "start callback should happen exactly once"); + equal(dragc, 3, "drag callback should happen exactly once per mousemove"); + equal(stop, 1, "stop callback should happen exactly once"); }); @@ -37,9 +37,9 @@ test("stopping the start callback", function() { drag(el, 10, 10); - equals(start, 1, "start callback should happen exactly once"); - equals(dragc, 0, "drag callback should not happen at all"); - equals(stop, 0, "stop callback should not happen if there wasnt even a start"); + equal(start, 1, "start callback should happen exactly once"); + equal(dragc, 0, "drag callback should not happen at all"); + equal(stop, 0, "stop callback should not happen if there wasnt even a start"); }); @@ -56,9 +56,9 @@ test("stopping the drag callback", function() { drag(el, 10, 10); - equals(start, 1, "start callback should happen exactly once"); - equals(dragc, 1, "drag callback should happen exactly once"); - equals(stop, 1, "stop callback should happen, as we need to actively stop the drag"); + equal(start, 1, "start callback should happen exactly once"); + equal(dragc, 1, "drag callback should happen exactly once"); + equal(stop, 1, "stop callback should happen, as we need to actively stop the drag"); }); diff --git a/tests/unit/draggable/draggable_methods.js b/tests/unit/draggable/draggable_methods.js index 4ffadf09e54..bb3fd07719e 100644 --- a/tests/unit/draggable/draggable_methods.js +++ b/tests/unit/draggable/draggable_methods.js @@ -52,7 +52,7 @@ test("destroy", function() { var expected = $('
      ').draggable(), actual = expected.draggable('destroy'); - equals(actual, expected, 'destroy is chainable'); + equal(actual, expected, 'destroy is chainable'); }); test("enable", function() { @@ -61,18 +61,18 @@ test("enable", function() { shouldnotmove('.draggable({ disabled: true })'); el.draggable("enable"); shouldmove('.draggable("enable")'); - equals(el.draggable("option", "disabled"), false, "disabled option getter"); + equal(el.draggable("option", "disabled"), false, "disabled option getter"); el.draggable("destroy"); el.draggable({ disabled: true }); shouldnotmove('.draggable({ disabled: true })'); el.draggable("option", "disabled", false); - equals(el.draggable("option", "disabled"), false, "disabled option setter"); + equal(el.draggable("option", "disabled"), false, "disabled option setter"); shouldmove('.draggable("option", "disabled", false)'); - + var expected = $('
      ').draggable(), actual = expected.draggable('enable'); - equals(actual, expected, 'enable is chainable'); + equal(actual, expected, 'enable is chainable'); }); test("disable", function() { @@ -81,19 +81,19 @@ test("disable", function() { shouldmove('.draggable({ disabled: false })'); el.draggable("disable"); shouldnotmove('.draggable("disable")'); - equals(el.draggable("option", "disabled"), true, "disabled option getter"); + equal(el.draggable("option", "disabled"), true, "disabled option getter"); el.draggable("destroy"); el.draggable({ disabled: false }); shouldmove('.draggable({ disabled: false })'); el.draggable("option", "disabled", true); - equals(el.draggable("option", "disabled"), true, "disabled option setter"); + equal(el.draggable("option", "disabled"), true, "disabled option setter"); shouldnotmove('.draggable("option", "disabled", true)'); - + var expected = $('
      ').draggable(), actual = expected.draggable('disable'); - equals(actual, expected, 'disable is chainable'); + equal(actual, expected, 'disable is chainable'); }); })(jQuery); diff --git a/tests/unit/draggable/draggable_options.js b/tests/unit/draggable/draggable_options.js index 8ba77fb93b0..d5f85feab85 100644 --- a/tests/unit/draggable/draggable_options.js +++ b/tests/unit/draggable/draggable_options.js @@ -24,7 +24,7 @@ var margin = function(el, side) { return parseInt(el.css('margin-' + side)); } module("draggable: options"); test("{ addClasses: true }, default", function() { - equals(draggable_defaults.addClasses, true); + equal(draggable_defaults.addClasses, true); el = $("
      ").draggable({ addClasses: true }); ok(el.is(".ui-draggable"), "'ui-draggable' class added"); @@ -40,12 +40,12 @@ test("{ addClasses: false }", function() { }); test("{ appendTo: 'parent' }, default", function() { - equals(draggable_defaults.appendTo, "parent"); + equal(draggable_defaults.appendTo, "parent"); el = $("#draggable2").draggable({ appendTo: 'parent' }); drag(el, 50, 50); moved(50, 50); - + el = $("#draggable1").draggable({ appendTo: 'parent' }); drag(el, 50, 50); moved(50, 50); @@ -56,7 +56,7 @@ test("{ appendTo: Element }", function() { el = $("#draggable2").draggable({ appendTo: $("#draggable2").parent()[0] }); drag(el, 50, 50); moved(50, 50); - + el = $("#draggable1").draggable({ appendTo: $("#draggable2").parent()[0] }); drag(el, 50, 50); moved(50, 50); @@ -66,14 +66,14 @@ test("{ appendTo: Selector }", function() { el = $("#draggable2").draggable({ appendTo: "#main" }); drag(el, 50, 50); moved(50, 50); - + el = $("#draggable1").draggable({ appendTo: "#main" }); drag(el, 50, 50); moved(50, 50); }); test("{ axis: false }, default", function() { - equals(draggable_defaults.axis, false); + equal(draggable_defaults.axis, false); el = $("#draggable2").draggable({ axis: false }); drag(el, 50, 50); @@ -110,7 +110,7 @@ test("{ axis: ? }, unexpected", function() { }); test("{ cancel: ':input,option' }, default", function() { - equals(draggable_defaults.cancel, ":input,option"); + equal(draggable_defaults.cancel, ":input,option"); $('
      ').appendTo('#main'); @@ -159,7 +159,7 @@ test("{ cancel: ? }, unexpected", function() { }); test("{ containment: false }, default", function() { - equals(draggable_defaults.containment, false); + equal(draggable_defaults.containment, false); ok(false, 'missing test - untested code is broken code'); }); @@ -176,7 +176,7 @@ test("{ containment: 'parent' }, relative", function() { left: po.left + border(p, 'left') + margin(el, 'left'), top: po.top + border(p, 'top') + margin(el, 'top') } - same(offsetAfter, expected, 'compare offset to parent'); + deepEqual(offsetAfter, expected, 'compare offset to parent'); }); test("{ containment: 'parent' }, absolute", function() { @@ -187,7 +187,7 @@ test("{ containment: 'parent' }, absolute", function() { left: po.left + border(p, 'left') + margin(el, 'left'), top: po.top + border(p, 'top') + margin(el, 'top') } - same(offsetAfter, expected, 'compare offset to parent'); + deepEqual(offsetAfter, expected, 'compare offset to parent'); }); test("{ containment: 'document' }", function() { @@ -207,7 +207,7 @@ test("{ containment: [x1, y1, x2, y2] }", function() { }); test("{ cursor: 'auto' }, default", function() { - equals(draggable_defaults.cursor, 'auto'); + equal(draggable_defaults.cursor, 'auto'); function getCursor() { return $("#draggable2").css("cursor"); } @@ -226,8 +226,8 @@ test("{ cursor: 'auto' }, default", function() { drag("#draggable2", -1, -1); after = getCursor(); - equals(actual, expected, "start callback: cursor '" + expected + "'"); - equals(after, before, "after drag: cursor restored"); + equal(actual, expected, "start callback: cursor '" + expected + "'"); + equal(after, before, "after drag: cursor restored"); }); @@ -250,13 +250,13 @@ test("{ cursor: 'move' }", function() { drag("#draggable2", -1, -1); after = getCursor(); - equals(actual, expected, "start callback: cursor '" + expected + "'"); - equals(after, before, "after drag: cursor restored"); + equal(actual, expected, "start callback: cursor '" + expected + "'"); + equal(after, before, "after drag: cursor restored"); }); test("{ cursorAt: false}, default", function() { - equals(draggable_defaults.cursorAt, false); + equal(draggable_defaults.cursorAt, false); ok(false, 'missing test - untested code is broken code'); }); @@ -272,8 +272,8 @@ test("{ cursorAt: { left: -5, top: -5 } }", function() { var el = $('#draggable' + (i + 1)).draggable({ cursorAt: { left: cursorAtX, top: cursorAtY }, drag: function(event, ui) { - equals(ui.offset.left, expected.left, position + ' left'); - equals(ui.offset.top, expected.top, position + ' top'); + equal(ui.offset.left, expected.left, position + ' left'); + equal(ui.offset.top, expected.top, position + ' top'); } }), before = el.offset(), @@ -305,8 +305,8 @@ test("{ cursorAt: { right: 10, bottom: 20 } }", function() { var el = $('#draggable' + (i + 1)).draggable({ cursorAt: { right: cursorAtX, bottom: cursorAtY }, drag: function(event, ui) { - equals(ui.offset.left, expected.left, position + ' left'); - equals(ui.offset.top, expected.top, position + ' top'); + equal(ui.offset.left, expected.left, position + ' left'); + equal(ui.offset.top, expected.top, position + ' top'); } }), before = el.offset(), @@ -338,8 +338,8 @@ test("{ cursorAt: [10, 20] }", function() { var el = $('#draggable' + (i + 1)).draggable({ cursorAt: { left: cursorAtX, top: cursorAtY }, drag: function(event, ui) { - equals(ui.offset.left, expected.left, position + ' left'); - equals(ui.offset.top, expected.top, position + ' top'); + equal(ui.offset.left, expected.left, position + ' left'); + equal(ui.offset.top, expected.top, position + ' top'); } }), before = el.offset(), @@ -371,8 +371,8 @@ test("{ cursorAt: '20, 40' }", function() { var el = $('#draggable' + (i + 1)).draggable({ cursorAt: { left: cursorAtX, top: cursorAtY }, drag: function(event, ui) { - equals(ui.offset.left, expected.left, position + ' left'); - equals(ui.offset.top, expected.top, position + ' top'); + equal(ui.offset.left, expected.left, position + ' left'); + equal(ui.offset.top, expected.top, position + ' top'); } }), before = el.offset(), @@ -446,58 +446,58 @@ test("{ helper: 'clone' }, absolute", function() { }); test("{ helper: 'original' }, relative, with scroll offset on parent", function() { - + el = $("#draggable1").draggable({ helper: "original" }); setScroll(); testScroll('relative'); - + setScroll(); testScroll('static'); - + setScroll(); testScroll('absolute'); restoreScroll(); - + }); test("{ helper: 'original' }, relative, with scroll offset on root", function() { - + el = $("#draggable1").draggable({ helper: "original" }); - + setScroll('root'); testScroll('relative'); - + setScroll('root'); testScroll('static'); - + setScroll('root'); testScroll('absolute'); restoreScroll('root'); - + }); test("{ helper: 'original' }, relative, with scroll offset on root and parent", function() { - + el = $("#draggable1").draggable({ helper: "original" }); - + setScroll(); setScroll('root'); testScroll('relative'); - + setScroll(); setScroll('root'); testScroll('static'); - + setScroll(); setScroll('root'); testScroll('absolute'); restoreScroll(); restoreScroll('root'); - + }); test("{ helper: 'original' }, absolute, with scroll offset on parent", function() { @@ -506,10 +506,10 @@ test("{ helper: 'original' }, absolute, with scroll offset on parent", function( setScroll(); testScroll('relative'); - + setScroll(); testScroll('static'); - + setScroll(); testScroll('absolute'); @@ -520,18 +520,18 @@ test("{ helper: 'original' }, absolute, with scroll offset on parent", function( test("{ helper: 'original' }, absolute, with scroll offset on root", function() { el = $("#draggable1").css({ position: 'absolute', top: 0, left: 0 }).draggable({ helper: "original" }); - + setScroll('root'); testScroll('relative'); - + setScroll('root'); testScroll('static'); - + setScroll('root'); testScroll('absolute'); restoreScroll('root'); - + }); test("{ helper: 'original' }, absolute, with scroll offset on root and parent", function() { @@ -541,18 +541,18 @@ test("{ helper: 'original' }, absolute, with scroll offset on root and parent", setScroll(); setScroll('root'); testScroll('relative'); - + setScroll(); setScroll('root'); testScroll('static'); - + setScroll(); setScroll('root'); testScroll('absolute'); restoreScroll(); restoreScroll('root'); - + }); test("{ helper: 'original' }, fixed, with scroll offset on parent", function() { @@ -561,10 +561,10 @@ test("{ helper: 'original' }, fixed, with scroll offset on parent", function() { setScroll(); testScroll('relative'); - + setScroll(); testScroll('static'); - + setScroll(); testScroll('absolute'); @@ -573,15 +573,15 @@ test("{ helper: 'original' }, fixed, with scroll offset on parent", function() { }); test("{ helper: 'original' }, fixed, with scroll offset on root", function() { - + el = $("#draggable1").css({ position: 'fixed', top: 0, left: 0 }).draggable({ helper: "original" }); setScroll('root'); testScroll('relative'); - + setScroll('root'); testScroll('static'); - + setScroll('root'); testScroll('absolute'); @@ -595,15 +595,15 @@ test("{ helper: 'original' }, fixed, with scroll offset on root and parent", fun setScroll(); setScroll('root'); testScroll('relative'); - + setScroll(); setScroll('root'); testScroll('static'); - + setScroll(); setScroll('root'); testScroll('absolute'); - + restoreScroll(); restoreScroll('root'); @@ -619,7 +619,7 @@ test("{ helper: 'clone' }, absolute", function() { } }); drag(el, 1, 1); - same({ top: helperOffset.top-1, left: helperOffset.left-1 }, origOffset, 'dragged[' + dragged.dx + ', ' + dragged.dy + '] '); + deepEqual({ top: helperOffset.top-1, left: helperOffset.left-1 }, origOffset, 'dragged[' + dragged.dx + ', ' + dragged.dy + '] '); }); @@ -636,18 +636,18 @@ test("{ helper: 'clone' }, absolute with scroll offset on parent", function() { $("#main").css('position', 'relative'); origOffset = $("#draggable1").offset(); drag(el, 1, 1); - same({ top: helperOffset.top-1, left: helperOffset.left-1 }, origOffset, 'dragged[' + dragged.dx + ', ' + dragged.dy + '] '); + deepEqual({ top: helperOffset.top-1, left: helperOffset.left-1 }, origOffset, 'dragged[' + dragged.dx + ', ' + dragged.dy + '] '); $("#main").css('position', 'static'); origOffset = $("#draggable1").offset(); drag(el, 1, 1); - same({ top: helperOffset.top-1, left: helperOffset.left-1 }, origOffset, 'dragged[' + dragged.dx + ', ' + dragged.dy + '] '); - + deepEqual({ top: helperOffset.top-1, left: helperOffset.left-1 }, origOffset, 'dragged[' + dragged.dx + ', ' + dragged.dy + '] '); + $("#main").css('position', 'absolute'); origOffset = $("#draggable1").offset(); drag(el, 1, 1); - same({ top: helperOffset.top-1, left: helperOffset.left-1 }, origOffset, 'dragged[' + dragged.dx + ', ' + dragged.dy + '] '); - + deepEqual({ top: helperOffset.top-1, left: helperOffset.left-1 }, origOffset, 'dragged[' + dragged.dx + ', ' + dragged.dy + '] '); + restoreScroll(); }); @@ -661,22 +661,22 @@ test("{ helper: 'clone' }, absolute with scroll offset on root", function() { el = $("#draggable1").draggable({ helper: "clone", drag: function(event, ui) { helperOffset = ui.helper.offset(); } }); - + $("#main").css('position', 'relative'); origOffset = $("#draggable1").offset(); drag(el, 1, 1); - same({ top: helperOffset.top-1, left: helperOffset.left-1 }, origOffset, 'dragged[' + dragged.dx + ', ' + dragged.dy + '] '); + deepEqual({ top: helperOffset.top-1, left: helperOffset.left-1 }, origOffset, 'dragged[' + dragged.dx + ', ' + dragged.dy + '] '); $("#main").css('position', 'static'); origOffset = $("#draggable1").offset(); drag(el, 1, 1); - same({ top: helperOffset.top-1, left: helperOffset.left-1 }, origOffset, 'dragged[' + dragged.dx + ', ' + dragged.dy + '] '); - + deepEqual({ top: helperOffset.top-1, left: helperOffset.left-1 }, origOffset, 'dragged[' + dragged.dx + ', ' + dragged.dy + '] '); + $("#main").css('position', 'absolute'); origOffset = $("#draggable1").offset(); drag(el, 1, 1); - same({ top: helperOffset.top-1, left: helperOffset.left-1 }, origOffset, 'dragged[' + dragged.dx + ', ' + dragged.dy + '] '); - + deepEqual({ top: helperOffset.top-1, left: helperOffset.left-1 }, origOffset, 'dragged[' + dragged.dx + ', ' + dragged.dy + '] '); + restoreScroll('root'); }); @@ -695,18 +695,18 @@ test("{ helper: 'clone' }, absolute with scroll offset on root and parent", func $("#main").css('position', 'relative'); origOffset = $("#draggable1").offset() drag(el, 1, 1); - same({ top: helperOffset.top-1, left: helperOffset.left-1 }, origOffset, 'dragged[' + dragged.dx + ', ' + dragged.dy + '] '); + deepEqual({ top: helperOffset.top-1, left: helperOffset.left-1 }, origOffset, 'dragged[' + dragged.dx + ', ' + dragged.dy + '] '); $("#main").css('position', 'static'); origOffset = $("#draggable1").offset() drag(el, 1, 1); - same({ top: helperOffset.top-1, left: helperOffset.left-1 }, origOffset, 'dragged[' + dragged.dx + ', ' + dragged.dy + '] '); - + deepEqual({ top: helperOffset.top-1, left: helperOffset.left-1 }, origOffset, 'dragged[' + dragged.dx + ', ' + dragged.dy + '] '); + $("#main").css('position', 'absolute'); origOffset = $("#draggable1").offset() drag(el, 1, 1); - same({ top: helperOffset.top-1, left: helperOffset.left-1 }, origOffset, 'dragged[' + dragged.dx + ', ' + dragged.dy + '] '); - + deepEqual({ top: helperOffset.top-1, left: helperOffset.left-1 }, origOffset, 'dragged[' + dragged.dx + ', ' + dragged.dy + '] '); + restoreScroll('root'); restoreScroll(); @@ -726,7 +726,7 @@ test("{ opacity: 0.5 }", function() { drag("#draggable2", -1, -1); - equals(opacity, 0.5, "start callback: opacity is"); + equal(opacity, 0.5, "start callback: opacity is"); }); @@ -746,7 +746,7 @@ test("{ zIndex: 10 }", function() { drag("#draggable2", -1, -1); - equals(actual, expected, "start callback: zIndex is"); + equal(actual, expected, "start callback: zIndex is"); }); diff --git a/tests/unit/droppable/droppable_methods.js b/tests/unit/droppable/droppable_methods.js index 87b91688898..8fd49d2657c 100644 --- a/tests/unit/droppable/droppable_methods.js +++ b/tests/unit/droppable/droppable_methods.js @@ -39,10 +39,10 @@ test("destroy", function() { $("
      ").droppable().droppable("destroy").droppable("foo"); ok(true, 'arbitrary method called after destroy'); - + var expected = $('
      ').droppable(), actual = expected.droppable('destroy'); - equals(actual, expected, 'destroy is chainable'); + equal(actual, expected, 'destroy is chainable'); }); test("enable", function() { @@ -51,17 +51,17 @@ test("enable", function() { shouldNotBeDroppable(); el.droppable("enable"); shouldBeDroppable(); - equals(el.droppable("option", "disabled"), false, "disabled option getter"); + equal(el.droppable("option", "disabled"), false, "disabled option getter"); el.droppable("destroy"); el.droppable({ disabled: true }); shouldNotBeDroppable(); el.droppable("option", "disabled", false); - equals(el.droppable("option", "disabled"), false, "disabled option setter"); + equal(el.droppable("option", "disabled"), false, "disabled option setter"); shouldBeDroppable(); - + var expected = $('
      ').droppable(), actual = expected.droppable('enable'); - equals(actual, expected, 'enable is chainable'); + equal(actual, expected, 'enable is chainable'); }); test("disable", function() { @@ -70,17 +70,17 @@ test("disable", function() { shouldBeDroppable(); el.droppable("disable"); shouldNotBeDroppable(); - equals(el.droppable("option", "disabled"), true, "disabled option getter"); + equal(el.droppable("option", "disabled"), true, "disabled option getter"); el.droppable("destroy"); el.droppable({ disabled: false }); shouldBeDroppable(); el.droppable("option", "disabled", true); - equals(el.droppable("option", "disabled"), true, "disabled option setter"); + equal(el.droppable("option", "disabled"), true, "disabled option setter"); shouldNotBeDroppable(); - + var expected = $('
      ').droppable(), actual = expected.droppable('disable'); - equals(actual, expected, 'disable is chainable'); + equal(actual, expected, 'disable is chainable'); }); })(jQuery); diff --git a/tests/unit/droppable/droppable_options.js b/tests/unit/droppable/droppable_options.js index 2f2dbf673f1..4df2d9ecb53 100644 --- a/tests/unit/droppable/droppable_options.js +++ b/tests/unit/droppable/droppable_options.js @@ -6,7 +6,7 @@ module("droppable: options"); test("{ accept '*' }, default ", function() { - equals(droppable_defaults.accept, '*'); + equal(droppable_defaults.accept, '*'); ok(false, 'missing test - untested code is broken code'); }); @@ -24,7 +24,7 @@ test("activeClass", function() { }); test("{ addClasses: true }, default", function() { - equals(droppable_defaults.addClasses, true); + equal(droppable_defaults.addClasses, true); el = $("
      ").droppable({ addClasses: true }); ok(el.is(".ui-droppable"), "'ui-droppable' class added"); diff --git a/tests/unit/menu/menu_core.js b/tests/unit/menu/menu_core.js index bccf4a1f205..02e3be3be2e 100644 --- a/tests/unit/menu/menu_core.js +++ b/tests/unit/menu/menu_core.js @@ -13,16 +13,16 @@ test("accessibility", function () { var item0 = $("li:eq(0) a"); ok( menu.hasClass("ui-menu ui-widget ui-widget-content ui-corner-all"), "menu class"); - equals( menu.attr("role"), "menu", "main role"); + equal( menu.attr("role"), "menu", "main role"); ok( !menu.attr("aria-activedescendant"), "aria attribute not yet active"); var item = menu.find( "li:first" ).find( "a" ).attr( "id", "xid" ).end(); menu.menu( "focus", $.Event(), item ); - equals( menu.attr("aria-activedescendant"), "xid", "aria attribute, id from dom"); + equal( menu.attr("aria-activedescendant"), "xid", "aria attribute, id from dom"); var item = menu.find( "li:last" ); menu.menu( "focus", $.Event(), item ); - equals( menu.attr("aria-activedescendant"), "menu1-4", "aria attribute, generated id"); + equal( menu.attr("aria-activedescendant"), "menu1-4", "aria attribute, generated id"); }); test("items class and role", function () { @@ -31,10 +31,10 @@ test("items class and role", function () { ok( ($("li",menu).length > 0 ), "number of menu items"); $("li",menu).each(function(item) { ok( $(this).hasClass("ui-menu-item"), "menu item ("+ item + ") class for item"); - equals( $(this).attr("role"), "presentation", "menu item ("+ item + ") role"); - equals( $("a", this).attr("role"), "menuitem", "menu item ("+ item + ") role"); + equal( $(this).attr("role"), "presentation", "menu item ("+ item + ") role"); + equal( $("a", this).attr("role"), "menuitem", "menu item ("+ item + ") role"); ok( $("a",this).hasClass("ui-corner-all"), "a element class for menu item ("+ item + ") "); - equals( $("a",this).attr("tabindex"), "-1", "a element tabindex for menu item ("+ item + ") "); + equal( $("a",this).attr("tabindex"), "-1", "a element tabindex for menu item ("+ item + ") "); }); }); diff --git a/tests/unit/menu/menu_events.js b/tests/unit/menu/menu_events.js index 6b03efb3c43..bee6fcfa62b 100644 --- a/tests/unit/menu/menu_events.js +++ b/tests/unit/menu/menu_events.js @@ -18,7 +18,7 @@ test("handle click on menu", function() { menu_click( menu,"2"); menu_click($('#menu1'),"3"); menu_click( menu,"1"); - equals( $("#log").html(), "1,3,2,afterclick,1,click,", "Click order not valid."); + equal( $("#log").html(), "1,3,2,afterclick,1,click,", "Click order not valid."); }); test("handle click on custom item menu", function() { @@ -35,10 +35,10 @@ test("handle click on custom item menu", function() { menu_click( menu,"2"); menu_click($('#menu5'),"3"); menu_click( menu,"1"); - equals( $("#log").html(), "1,3,2,afterclick,1,click,", "Click order not valid."); + equal( $("#log").html(), "1,3,2,afterclick,1,click,", "Click order not valid."); }); -/* Commenting out these tests until a way to handle the extra focus and blur events +/* Commenting out these tests until a way to handle the extra focus and blur events fired by IE is found test( "handle blur: click", function() { expect( 4 ); @@ -154,51 +154,51 @@ test("handle keyboard navigation on menu without scroll and without submenus", f element.focus(); element.simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } ); element.simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } ); - equals( $("#log").html(), "2,1,0,keydown,", "Keydown DOWN"); + equal( $("#log").html(), "2,1,0,keydown,", "Keydown DOWN"); menu_log("keydown",true); element.simulate( "keydown", { keyCode: $.ui.keyCode.UP } ); - equals( $("#log").html(), "1,keydown,", "Keydown UP"); + equal( $("#log").html(), "1,keydown,", "Keydown UP"); menu_log("keydown",true); element.simulate( "keydown", { keyCode: $.ui.keyCode.LEFT } ); - equals( $("#log").html(), "keydown,", "Keydown LEFT (no effect)"); + equal( $("#log").html(), "keydown,", "Keydown LEFT (no effect)"); menu_log("keydown",true); element.simulate( "keydown", { keyCode: $.ui.keyCode.RIGHT } ); - equals( $("#log").html(), "keydown,", "Keydown RIGHT (no effect)"); + equal( $("#log").html(), "keydown,", "Keydown RIGHT (no effect)"); menu_log("keydown",true); element.simulate( "keydown", { keyCode: $.ui.keyCode.PAGE_DOWN } ); - equals( $("#log").html(), "4,keydown,", "Keydown PAGE_DOWN"); + equal( $("#log").html(), "4,keydown,", "Keydown PAGE_DOWN"); menu_log("keydown",true); element.simulate( "keydown", { keyCode: $.ui.keyCode.PAGE_DOWN } ); - equals( $("#log").html(), "keydown,", "Keydown PAGE_DOWN (no effect)"); + equal( $("#log").html(), "keydown,", "Keydown PAGE_DOWN (no effect)"); menu_log("keydown",true); element.simulate( "keydown", { keyCode: $.ui.keyCode.PAGE_UP } ); - equals( $("#log").html(), "0,keydown,", "Keydown PAGE_UP"); + equal( $("#log").html(), "0,keydown,", "Keydown PAGE_UP"); menu_log("keydown",true); element.simulate( "keydown", { keyCode: $.ui.keyCode.PAGE_UP } ); - equals( $("#log").html(), "keydown,", "Keydown PAGE_UP (no effect)"); + equal( $("#log").html(), "keydown,", "Keydown PAGE_UP (no effect)"); menu_log("keydown",true); element.simulate( "keydown", { keyCode: $.ui.keyCode.END } ); - equals( $("#log").html(), "4,keydown,", "Keydown END"); + equal( $("#log").html(), "4,keydown,", "Keydown END"); menu_log("keydown",true); element.simulate( "keydown", { keyCode: $.ui.keyCode.HOME } ); - equals( $("#log").html(), "0,keydown,", "Keydown HOME"); + equal( $("#log").html(), "0,keydown,", "Keydown HOME"); menu_log("keydown",true); element.simulate( "keydown", { keyCode: $.ui.keyCode.ESCAPE } ); - equals( $("#log").html(), "keydown,", "Keydown ESCAPE (no effect)"); + equal( $("#log").html(), "keydown,", "Keydown ESCAPE (no effect)"); menu_log("keydown",true); element.simulate( "keydown", { keyCode: $.ui.keyCode.ENTER } ); - equals( $("#log").html(), "Aberdeen,keydown,", "Keydown ENTER"); + equal( $("#log").html(), "Aberdeen,keydown,", "Keydown ENTER"); }); asyncTest("handle keyboard navigation on menu without scroll and with submenus", function() { @@ -216,7 +216,7 @@ asyncTest("handle keyboard navigation on menu without scroll and with submenus", element.one( "menufocus", function( event, ui ) { element.simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } ); element.simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } ); - equals( $("#log").html(), "2,1,keydown,", "Keydown DOWN"); + equal( $("#log").html(), "2,1,keydown,", "Keydown DOWN"); setTimeout( menukeyboard1, 50 ); }); element.focus(); @@ -225,11 +225,11 @@ asyncTest("handle keyboard navigation on menu without scroll and with submenus", menu_log("keydown",true); element.simulate( "keydown", { keyCode: $.ui.keyCode.UP } ); element.simulate( "keydown", { keyCode: $.ui.keyCode.UP } ); - equals( $("#log").html(), "0,1,keydown,", "Keydown UP"); + equal( $("#log").html(), "0,1,keydown,", "Keydown UP"); menu_log("keydown",true); element.simulate( "keydown", { keyCode: $.ui.keyCode.LEFT } ); - equals( $("#log").html(), "keydown,", "Keydown LEFT (no effect)"); + equal( $("#log").html(), "keydown,", "Keydown LEFT (no effect)"); menu_log("keydown",true); element.simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } ); @@ -239,7 +239,7 @@ asyncTest("handle keyboard navigation on menu without scroll and with submenus", element.simulate( "keydown", { keyCode: $.ui.keyCode.RIGHT } ); setTimeout( function() { - equals( $("#log").html(), "0,4,3,2,1,keydown,", "Keydown RIGHT (open submenu)"); + equal( $("#log").html(), "0,4,3,2,1,keydown,", "Keydown RIGHT (open submenu)"); }, 50); setTimeout( menukeyboard2, 50 ); } @@ -247,7 +247,7 @@ asyncTest("handle keyboard navigation on menu without scroll and with submenus", function menukeyboard2() { menu_log("keydown",true); element.simulate( "keydown", { keyCode: $.ui.keyCode.LEFT } ); - equals( $("#log").html(), "4,keydown,", "Keydown LEFT (close submenu)"); + equal( $("#log").html(), "4,keydown,", "Keydown LEFT (close submenu)"); //re-open submenu element.simulate( "keydown", { keyCode: $.ui.keyCode.RIGHT } ); @@ -257,31 +257,31 @@ asyncTest("handle keyboard navigation on menu without scroll and with submenus", function menukeyboard3() { menu_log("keydown",true); element.simulate( "keydown", { keyCode: $.ui.keyCode.PAGE_DOWN } ); - equals( $("#log").html(), "2,keydown,", "Keydown PAGE_DOWN"); + equal( $("#log").html(), "2,keydown,", "Keydown PAGE_DOWN"); menu_log("keydown",true); element.simulate( "keydown", { keyCode: $.ui.keyCode.PAGE_DOWN } ); - equals( $("#log").html(), "keydown,", "Keydown PAGE_DOWN (no effect)"); + equal( $("#log").html(), "keydown,", "Keydown PAGE_DOWN (no effect)"); menu_log("keydown",true); element.simulate( "keydown", { keyCode: $.ui.keyCode.PAGE_UP } ); - equals( $("#log").html(), "0,keydown,", "Keydown PAGE_UP"); + equal( $("#log").html(), "0,keydown,", "Keydown PAGE_UP"); menu_log("keydown",true); element.simulate( "keydown", { keyCode: $.ui.keyCode.PAGE_UP } ); - equals( $("#log").html(), "keydown,", "Keydown PAGE_UP (no effect)"); + equal( $("#log").html(), "keydown,", "Keydown PAGE_UP (no effect)"); menu_log("keydown",true); element.simulate( "keydown", { keyCode: $.ui.keyCode.END } ); - equals( $("#log").html(), "2,keydown,", "Keydown END"); + equal( $("#log").html(), "2,keydown,", "Keydown END"); menu_log("keydown",true); element.simulate( "keydown", { keyCode: $.ui.keyCode.HOME } ); - equals( $("#log").html(), "0,keydown,", "Keydown HOME"); + equal( $("#log").html(), "0,keydown,", "Keydown HOME"); menu_log("keydown",true); element.simulate( "keydown", { keyCode: $.ui.keyCode.ESCAPE } ); - equals( $("#log").html(), "4,keydown,", "Keydown ESCAPE (close submenu)"); + equal( $("#log").html(), "4,keydown,", "Keydown ESCAPE (close submenu)"); menu_log("keydown",true); element.simulate( "keydown", { keyCode: $.ui.keyCode.ENTER } ); @@ -289,11 +289,11 @@ asyncTest("handle keyboard navigation on menu without scroll and with submenus", } function menukeyboard4() { - equals( $("#log").html(), "0,keydown,", "Keydown ENTER (open submenu)"); + equal( $("#log").html(), "0,keydown,", "Keydown ENTER (open submenu)"); menu_log("keydown",true); element.simulate( "keydown", { keyCode: $.ui.keyCode.ENTER } ); - equals( $("#log").html(), "Ada,keydown,", "Keydown ENTER (select item)"); + equal( $("#log").html(), "Ada,keydown,", "Keydown ENTER (select item)"); start(); } @@ -314,60 +314,60 @@ test("handle keyboard navigation on menu with scroll and without submenus", func element.focus(); element.simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } ); element.simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } ); - equals( $("#log").html(), "2,1,0,keydown,", "Keydown DOWN"); + equal( $("#log").html(), "2,1,0,keydown,", "Keydown DOWN"); menu_log("keydown",true); element.simulate( "keydown", { keyCode: $.ui.keyCode.UP } ); element.simulate( "keydown", { keyCode: $.ui.keyCode.UP } ); - equals( $("#log").html(), "0,1,keydown,", "Keydown UP"); + equal( $("#log").html(), "0,1,keydown,", "Keydown UP"); menu_log("keydown",true); element.simulate( "keydown", { keyCode: $.ui.keyCode.LEFT } ); - equals( $("#log").html(), "keydown,", "Keydown LEFT (no effect)"); + equal( $("#log").html(), "keydown,", "Keydown LEFT (no effect)"); menu_log("keydown",true); element.simulate( "keydown", { keyCode: $.ui.keyCode.RIGHT } ); - equals( $("#log").html(), "keydown,", "Keydown RIGHT (no effect)"); + equal( $("#log").html(), "keydown,", "Keydown RIGHT (no effect)"); menu_log("keydown",true); element.simulate( "keydown", { keyCode: $.ui.keyCode.PAGE_DOWN } ); - equals( $("#log").html(), "10,keydown,", "Keydown PAGE_DOWN"); + equal( $("#log").html(), "10,keydown,", "Keydown PAGE_DOWN"); menu_log("keydown",true); element.simulate( "keydown", { keyCode: $.ui.keyCode.PAGE_DOWN } ); - equals( $("#log").html(), "20,keydown,", "Keydown PAGE_DOWN"); + equal( $("#log").html(), "20,keydown,", "Keydown PAGE_DOWN"); menu_log("keydown",true); element.simulate( "keydown", { keyCode: $.ui.keyCode.PAGE_UP } ); - equals( $("#log").html(), "10,keydown,", "Keydown PAGE_UP"); + equal( $("#log").html(), "10,keydown,", "Keydown PAGE_UP"); menu_log("keydown",true); element.simulate( "keydown", { keyCode: $.ui.keyCode.PAGE_UP } ); - equals( $("#log").html(), "0,keydown,", "Keydown PAGE_UP"); + equal( $("#log").html(), "0,keydown,", "Keydown PAGE_UP"); menu_log("keydown",true); element.simulate( "keydown", { keyCode: $.ui.keyCode.PAGE_UP } ); - equals( $("#log").html(), "keydown,", "Keydown PAGE_UP (no effect)"); + equal( $("#log").html(), "keydown,", "Keydown PAGE_UP (no effect)"); menu_log("keydown",true); element.simulate( "keydown", { keyCode: $.ui.keyCode.END } ); - equals( $("#log").html(), "37,keydown,", "Keydown END"); + equal( $("#log").html(), "37,keydown,", "Keydown END"); menu_log("keydown",true); element.simulate( "keydown", { keyCode: $.ui.keyCode.PAGE_DOWN } ); - equals( $("#log").html(), "keydown,", "Keydown PAGE_DOWN (no effect)"); + equal( $("#log").html(), "keydown,", "Keydown PAGE_DOWN (no effect)"); menu_log("keydown",true); element.simulate( "keydown", { keyCode: $.ui.keyCode.HOME } ); - equals( $("#log").html(), "0,keydown,", "Keydown HOME"); + equal( $("#log").html(), "0,keydown,", "Keydown HOME"); menu_log("keydown",true); element.simulate( "keydown", { keyCode: $.ui.keyCode.ESCAPE } ); - equals( $("#log").html(), "keydown,", "Keydown ESCAPE (no effect)"); + equal( $("#log").html(), "keydown,", "Keydown ESCAPE (no effect)"); menu_log("keydown",true); element.simulate( "keydown", { keyCode: $.ui.keyCode.ENTER } ); - equals( $("#log").html(), "Aberdeen,keydown,", "Keydown ENTER"); + equal( $("#log").html(), "Aberdeen,keydown,", "Keydown ENTER"); }); asyncTest("handle keyboard navigation on menu with scroll and with submenus", function() { @@ -385,28 +385,28 @@ asyncTest("handle keyboard navigation on menu with scroll and with submenus", fu element.one( "menufocus", function( event, ui ) { element.simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } ); element.simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } ); - equals( $("#log").html(), "2,1,keydown,", "Keydown DOWN"); + equal( $("#log").html(), "2,1,keydown,", "Keydown DOWN"); setTimeout( menukeyboard1, 50 ); }); element.focus(); - + function menukeyboard1() { menu_log("keydown",true); element.simulate( "keydown", { keyCode: $.ui.keyCode.UP } ); element.simulate( "keydown", { keyCode: $.ui.keyCode.UP } ); - equals( $("#log").html(), "0,1,keydown,", "Keydown UP"); + equal( $("#log").html(), "0,1,keydown,", "Keydown UP"); menu_log("keydown",true); element.simulate( "keydown", { keyCode: $.ui.keyCode.LEFT } ); - equals( $("#log").html(), "keydown,", "Keydown LEFT (no effect)"); + equal( $("#log").html(), "keydown,", "Keydown LEFT (no effect)"); menu_log("keydown",true); element.simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } ); element.simulate( "keydown", { keyCode: $.ui.keyCode.RIGHT } ); setTimeout( function() { - equals( $("#log").html(), "0,1,keydown,", "Keydown RIGHT (open submenu)"); + equal( $("#log").html(), "0,1,keydown,", "Keydown RIGHT (open submenu)"); }, 50); setTimeout( menukeyboard2, 50 ); } @@ -414,7 +414,7 @@ asyncTest("handle keyboard navigation on menu with scroll and with submenus", fu function menukeyboard2() { menu_log("keydown",true); element.simulate( "keydown", { keyCode: $.ui.keyCode.LEFT } ); - equals( $("#log").html(), "1,keydown,", "Keydown LEFT (close submenu)"); + equal( $("#log").html(), "1,keydown,", "Keydown LEFT (close submenu)"); //re-open submenu element.simulate( "keydown", { keyCode: $.ui.keyCode.RIGHT } ); @@ -424,31 +424,31 @@ asyncTest("handle keyboard navigation on menu with scroll and with submenus", fu function menukeyboard3() { menu_log("keydown",true); element.simulate( "keydown", { keyCode: $.ui.keyCode.PAGE_DOWN } ); - equals( $("#log").html(), "10,keydown,", "Keydown PAGE_DOWN"); + equal( $("#log").html(), "10,keydown,", "Keydown PAGE_DOWN"); menu_log("keydown",true); element.simulate( "keydown", { keyCode: $.ui.keyCode.PAGE_DOWN } ); - equals( $("#log").html(), "20,keydown,", "Keydown PAGE_DOWN"); + equal( $("#log").html(), "20,keydown,", "Keydown PAGE_DOWN"); menu_log("keydown",true); element.simulate( "keydown", { keyCode: $.ui.keyCode.PAGE_UP } ); - equals( $("#log").html(), "10,keydown,", "Keydown PAGE_UP"); + equal( $("#log").html(), "10,keydown,", "Keydown PAGE_UP"); menu_log("keydown",true); element.simulate( "keydown", { keyCode: $.ui.keyCode.PAGE_UP } ); - equals( $("#log").html(), "0,keydown,", "Keydown PAGE_UP"); + equal( $("#log").html(), "0,keydown,", "Keydown PAGE_UP"); menu_log("keydown",true); element.simulate( "keydown", { keyCode: $.ui.keyCode.END } ); - equals( $("#log").html(), "27,keydown,", "Keydown END"); + equal( $("#log").html(), "27,keydown,", "Keydown END"); menu_log("keydown",true); element.simulate( "keydown", { keyCode: $.ui.keyCode.HOME } ); - equals( $("#log").html(), "0,keydown,", "Keydown HOME"); + equal( $("#log").html(), "0,keydown,", "Keydown HOME"); menu_log("keydown",true); element.simulate( "keydown", { keyCode: $.ui.keyCode.ESCAPE } ); - equals( $("#log").html(), "1,keydown,", "Keydown ESCAPE (close submenu)"); + equal( $("#log").html(), "1,keydown,", "Keydown ESCAPE (close submenu)"); menu_log("keydown",true); element.simulate( "keydown", { keyCode: $.ui.keyCode.ENTER } ); @@ -456,11 +456,11 @@ asyncTest("handle keyboard navigation on menu with scroll and with submenus", fu } function menukeyboard4() { - equals( $("#log").html(), "0,keydown,", "Keydown ENTER (open submenu)"); + equal( $("#log").html(), "0,keydown,", "Keydown ENTER (open submenu)"); menu_log("keydown",true); element.simulate( "keydown", { keyCode: $.ui.keyCode.ENTER } ); - equals( $("#log").html(), "Aberdeen,keydown,", "Keydown ENTER (select item)"); + equal( $("#log").html(), "Aberdeen,keydown,", "Keydown ENTER (select item)"); start(); } diff --git a/tests/unit/menu/menu_methods.js b/tests/unit/menu/menu_methods.js index 3bcab3361f1..200ea4427b8 100644 --- a/tests/unit/menu/menu_methods.js +++ b/tests/unit/menu/menu_methods.js @@ -22,17 +22,17 @@ test( "enable/disable", function() { menu_log("click"); menu_click(menu,"1"); menu_log("afterclick"); - equals( $("#log").html(), "afterclick,1,click,afterclick,click,", "Click order not valid."); + equal( $("#log").html(), "afterclick,1,click,afterclick,click,", "Click order not valid."); }); test( "refresh", function() { expect( 3 ); var menu = $( "#menu1" ).menu(); - equals(menu.find(".ui-menu-item").length,5,"Incorrect number of menu items"); + equal(menu.find(".ui-menu-item").length,5,"Incorrect number of menu items"); menu.append("
    1. test item
    2. ").menu("refresh"); - equals(menu.find(".ui-menu-item").length,6,"Incorrect number of menu items"); + equal(menu.find(".ui-menu-item").length,6,"Incorrect number of menu items"); menu.find(".ui-menu-item:last").remove().end().menu("refresh"); - equals(menu.find(".ui-menu-item").length,5,"Incorrect number of menu items"); + equal(menu.find(".ui-menu-item").length,5,"Incorrect number of menu items"); }); test("destroy", function() { diff --git a/tests/unit/menu/menu_options.js b/tests/unit/menu/menu_options.js index 479aab0d197..cda52d88d86 100644 --- a/tests/unit/menu/menu_options.js +++ b/tests/unit/menu/menu_options.js @@ -17,7 +17,7 @@ test( "{ disabled: true }", function() { menu_log("click",true); menu_click(menu,"1"); menu_log("afterclick"); - equals( $("#log").html(), "afterclick,click,", "Click order not valid."); + equal( $("#log").html(), "afterclick,click,", "Click order not valid."); }); test( "{ disabled: false }", function() { @@ -32,7 +32,7 @@ test( "{ disabled: false }", function() { menu_log("click",true); menu_click(menu,"1"); menu_log("afterclick"); - equals( $("#log").html(), "afterclick,1,click,", "Click order not valid."); + equal( $("#log").html(), "afterclick,1,click,", "Click order not valid."); }); })(jQuery); diff --git a/tests/unit/position/position_core.js b/tests/unit/position/position_core.js index ea1baee72fd..fbcac4b7f81 100644 --- a/tests/unit/position/position_core.js +++ b/tests/unit/position/position_core.js @@ -14,7 +14,7 @@ test( "my, at, of", function() { of: "#parentx", collision: "none" }); - same( $( "#elx" ).offset(), { top: 40, left: 40 }, "left top, left top" ); + deepEqual( $( "#elx" ).offset(), { top: 40, left: 40 }, "left top, left top" ); $( "#elx" ).position({ my: "left top", @@ -22,7 +22,7 @@ test( "my, at, of", function() { of: "#parentx", collision: "none" }); - same( $( "#elx" ).offset(), { top: 60, left: 40 }, "left top, left bottom" ); + deepEqual( $( "#elx" ).offset(), { top: 60, left: 40 }, "left top, left bottom" ); $( "#elx" ).position({ my: "left", @@ -30,7 +30,7 @@ test( "my, at, of", function() { of: "#parentx", collision: "none" }); - same( $( "#elx" ).offset(), { top: 55, left: 50 }, "left, bottom" ); + deepEqual( $( "#elx" ).offset(), { top: 55, left: 50 }, "left, bottom" ); $( "#elx" ).position({ my: "left foo", @@ -38,7 +38,7 @@ test( "my, at, of", function() { of: "#parentx", collision: "none" }); - same( $( "#elx" ).offset(), { top: 45, left: 50 }, "left foo, bar baz" ); + deepEqual( $( "#elx" ).offset(), { top: 45, left: 50 }, "left foo, bar baz" ); }); test( "multiple elements", function() { @@ -50,10 +50,10 @@ test( "multiple elements", function() { collision: "none" }); - same( result, elements ); + deepEqual( result, elements ); var expected = { top: 10, left: 4 }; elements.each(function() { - same( $( this ).offset(), expected ); + deepEqual( $( this ).offset(), expected ); }); }); @@ -89,7 +89,7 @@ test( "positions", function() { of: "#parent", collision: "none" }); - same( el.offset(), definition.result, + deepEqual( el.offset(), definition.result, "Position via " + QUnit.jsDump.parse({ my:definition.my, at:definition.at }) ); }); }); @@ -101,7 +101,7 @@ test( "of", function() { of: "#parentx", collision: "none" }); - same( $( "#elx" ).offset(), { top: 40, left: 40 }, "selector" ); + deepEqual( $( "#elx" ).offset(), { top: 40, left: 40 }, "selector" ); $( "#elx" ).position({ my: "left top", @@ -109,7 +109,7 @@ test( "of", function() { of: $( "#parentx"), collision: "none" }); - same( $( "#elx" ).offset(), { top: 60, left: 40 }, "jQuery object" ); + deepEqual( $( "#elx" ).offset(), { top: 60, left: 40 }, "jQuery object" ); $( "#elx" ).position({ my: "left top", @@ -117,7 +117,7 @@ test( "of", function() { of: $( "#parentx" )[ 0 ], collision: "none" }); - same( $( "#elx" ).offset(), { top: 40, left: 40 }, "DOM element" ); + deepEqual( $( "#elx" ).offset(), { top: 40, left: 40 }, "DOM element" ); $( "#elx" ).position({ my: "right bottom", @@ -125,7 +125,7 @@ test( "of", function() { of: document, collision: "none" }); - same( $( "#elx" ).offset(), { + deepEqual( $( "#elx" ).offset(), { top: $( document ).height() - 10, left: $( document ).width() - 10 }, "document" ); @@ -136,7 +136,7 @@ test( "of", function() { of: $( document ), collision: "none" }); - same( $( "#elx" ).offset(), { + deepEqual( $( "#elx" ).offset(), { top: $( document ).height() - 10, left: $( document ).width() - 10 }, "document as jQuery object" ); @@ -149,7 +149,7 @@ test( "of", function() { of: window, collision: "none" }); - same( $( "#elx" ).offset(), { + deepEqual( $( "#elx" ).offset(), { top: $( window ).height() - 10, left: $( window ).width() - 10 }, "window" ); @@ -160,7 +160,7 @@ test( "of", function() { of: $( window ), collision: "none" }); - same( $( "#elx" ).offset(), { + deepEqual( $( "#elx" ).offset(), { top: $( window ).height() - 10, left: $( window ).width() - 10 }, "window as jQuery object" ); @@ -173,7 +173,7 @@ test( "of", function() { of: window, collision: "none" }); - same( $( "#elx" ).offset(), { + deepEqual( $( "#elx" ).offset(), { top: $( window ).height() + 500 - 10, left: $( window ).width() + 200 - 10 }, "window, scrolled" ); @@ -187,7 +187,7 @@ test( "of", function() { of: event, collision: "none" }); - same( $( "#elx" ).offset(), { + deepEqual( $( "#elx" ).offset(), { top: 300, left: 200 }, "event - left top, left top" ); @@ -199,7 +199,7 @@ test( "of", function() { of: event, collision: "none" }); - same( $( "#elx" ).offset(), { + deepEqual( $( "#elx" ).offset(), { top: 600, left: 400 }, "event - left top, right bottom" ); @@ -212,7 +212,7 @@ test( "offsets", function() { of: "#parentx", collision: "none" }); - same( $( "#elx" ).offset(), { top: 70, left: 50 }, "offsets in at" ); + deepEqual( $( "#elx" ).offset(), { top: 70, left: 50 }, "offsets in at" ); $( "#elx" ).position({ my: "left+10 top-10", @@ -220,7 +220,7 @@ test( "offsets", function() { of: "#parentx", collision: "none" }); - same( $( "#elx" ).offset(), { top: 50, left: 50 }, "offsets in my" ); + deepEqual( $( "#elx" ).offset(), { top: 50, left: 50 }, "offsets in my" ); $( "#elx" ).position({ my: "left top", @@ -228,7 +228,7 @@ test( "offsets", function() { of: "#parentx", collision: "none" }); - same( $( "#elx" ).offset(), { top: 58, left: 50 }, "percentage offsets in at" ); + deepEqual( $( "#elx" ).offset(), { top: 58, left: 50 }, "percentage offsets in at" ); $( "#elx" ).position({ my: "left-30% top+50%", @@ -236,7 +236,7 @@ test( "offsets", function() { of: "#parentx", collision: "none" }); - same( $( "#elx" ).offset(), { top: 65, left: 37 }, "percentage offsets in my" ); + deepEqual( $( "#elx" ).offset(), { top: 65, left: 37 }, "percentage offsets in my" ); }); test( "using", function() { @@ -257,14 +257,14 @@ test( "using", function() { at: "left top", of: "#parentx", using: function( position ) { - same( this, elems[ count ], "correct context for call #" + count ); - same( position, expectedPosition, "correct position for call #" + count ); + deepEqual( this, elems[ count ], "correct context for call #" + count ); + deepEqual( position, expectedPosition, "correct position for call #" + count ); count++; } }); elems.each(function() { - same( $( this ).offset(), originalPosition, "elements not moved" ); + deepEqual( $( this ).offset(), originalPosition, "elements not moved" ); }); }); @@ -274,7 +274,7 @@ function collisionTest( config, result, msg ) { at: "right bottom", of: window }, config ) ); - same( elem.offset(), result, msg ); + deepEqual( elem.offset(), result, msg ); } function collisionTest2( config, result, msg ) { @@ -443,7 +443,7 @@ test( "addClass: flipped left", function() { at: "right center" }); - same( elem.hasClass( 'ui-flipped-left' ), false, 'Has ui-flipped-left class' ); + deepEqual( elem.hasClass( 'ui-flipped-left' ), false, 'Has ui-flipped-left class' ); elem.position( { my: "right center", @@ -452,7 +452,7 @@ test( "addClass: flipped left", function() { at: "left center" }) - same( elem.hasClass( 'ui-flipped-left' ), false, 'Removed ui-flipped-left class' ); + deepEqual( elem.hasClass( 'ui-flipped-left' ), false, 'Removed ui-flipped-left class' ); }); test( "addClass: flipped top", function() { @@ -463,7 +463,7 @@ test( "addClass: flipped top", function() { at: "right bottom" }); - same( elem.hasClass( 'ui-flipped-top' ), false, 'Has ui-flipped-top class' ); + deepEqual( elem.hasClass( 'ui-flipped-top' ), false, 'Has ui-flipped-top class' ); elem.position( { my: "left bottom", @@ -472,7 +472,7 @@ test( "addClass: flipped top", function() { at: "right top" }); - same( elem.hasClass( 'ui-flipped-top' ), false, 'Removed ui-flipped-top class' ); + deepEqual( elem.hasClass( 'ui-flipped-top' ), false, 'Removed ui-flipped-top class' ); }); test( "addClass: flipped right", function() { @@ -483,7 +483,7 @@ test( "addClass: flipped right", function() { at: "left center" }); - same( elem.hasClass( 'ui-flipped-right' ), false, 'Has ui-flipped-right class' ); + deepEqual( elem.hasClass( 'ui-flipped-right' ), false, 'Has ui-flipped-right class' ); elem.position( { my: "left center", @@ -492,7 +492,7 @@ test( "addClass: flipped right", function() { at: "right center" }); - same( elem.hasClass( 'ui-flipped-right' ), false, 'Removed ui-flipped-right class' ); + deepEqual( elem.hasClass( 'ui-flipped-right' ), false, 'Removed ui-flipped-right class' ); }); @@ -504,7 +504,7 @@ test( "addClass: flipped bottom", function() { at: "right top" }); - same( elem.hasClass( 'ui-flipped-bottom' ), false, 'Has ui-flipped-bottom class' ); + deepEqual( elem.hasClass( 'ui-flipped-bottom' ), false, 'Has ui-flipped-bottom class' ); elem.position( { my: "left top", @@ -513,7 +513,7 @@ test( "addClass: flipped bottom", function() { at: "right bottom" }); - same( elem.hasClass( 'ui-flipped-bottom' ), false, 'Removed ui-flipped-bottom class' ); + deepEqual( elem.hasClass( 'ui-flipped-bottom' ), false, 'Removed ui-flipped-bottom class' ); }); test( "fractions", function() { @@ -523,7 +523,7 @@ test( "fractions", function() { of: "#fractions-parent", collision: "none" }); - same( $( "#fractions-element" ).offset(), $( "#fractions-parent" ).offset(), "left top, left top" ); + deepEqual( $( "#fractions-element" ).offset(), $( "#fractions-parent" ).offset(), "left top, left top" ); }); test( "bug #5280: consistent results (avoid fractional values)", function() { @@ -541,7 +541,7 @@ test( "bug #5280: consistent results (avoid fractional values)", function() { of: wrapper, collision: "none" }).offset(); - same( offset1, offset2 ); + deepEqual( offset1, offset2 ); }); }( jQuery ) ); diff --git a/tests/unit/position/position_core_within.js b/tests/unit/position/position_core_within.js index 392e409c558..9dc91238f93 100644 --- a/tests/unit/position/position_core_within.js +++ b/tests/unit/position/position_core_within.js @@ -34,7 +34,7 @@ test( "my, at, of", function() { collision: "none", within: within }); - same( $( "#elx" ).addOffsets(), { top: addTop + 40, left: addLeft + 40 }, "left top, left top" ); + deepEqual( $( "#elx" ).addOffsets(), { top: addTop + 40, left: addLeft + 40 }, "left top, left top" ); $( "#elx" ).position({ my: "left top", @@ -43,7 +43,7 @@ test( "my, at, of", function() { collision: "none", within: within }); - same( $( "#elx" ).addOffsets(), { top: addTop + 60, left: addLeft + 40 }, "left top, left bottom" ); + deepEqual( $( "#elx" ).addOffsets(), { top: addTop + 60, left: addLeft + 40 }, "left top, left bottom" ); $( "#elx" ).position({ my: "left", @@ -52,7 +52,7 @@ test( "my, at, of", function() { collision: "none", within: within }); - same( $( "#elx" ).addOffsets(), { top: addTop + 55, left: addLeft + 50 }, "left, bottom" ); + deepEqual( $( "#elx" ).addOffsets(), { top: addTop + 55, left: addLeft + 50 }, "left, bottom" ); $( "#elx" ).position({ my: "left foo", @@ -61,7 +61,7 @@ test( "my, at, of", function() { collision: "none", within: within }); - same( $( "#elx" ).addOffsets(), { top: addTop + 45, left: addLeft +50 }, "left foo, bar baz" ); + deepEqual( $( "#elx" ).addOffsets(), { top: addTop + 45, left: addLeft +50 }, "left foo, bar baz" ); }); test( "multiple elements", function() { @@ -74,10 +74,10 @@ test( "multiple elements", function() { within: $("#within-container") }); - same( result, elements ); + deepEqual( result, elements ); var expected = { top: addTop + 10, left: addLeft + 4 }; elements.each(function() { - same( $( this ).addOffsets(), expected ); + deepEqual( $( this ).addOffsets(), expected ); }); }); @@ -114,7 +114,7 @@ test( "positions", function() { collision: "none", within: $("#within-container") }); - same( el.addOffsets(), definition.result, + deepEqual( el.addOffsets(), definition.result, "Position via " + QUnit.jsDump.parse({ my:definition.my, at:definition.at }) ); }); }); @@ -129,7 +129,7 @@ test( "of", function() { collision: "none", within: within }); - same( $( "#elx" ).addOffsets(), { top: addTop + 40, left: addLeft + 40 }, "selector" ); + deepEqual( $( "#elx" ).addOffsets(), { top: addTop + 40, left: addLeft + 40 }, "selector" ); $( "#elx" ).position({ my: "left top", @@ -138,7 +138,7 @@ test( "of", function() { collision: "none", within: within }); - same( $( "#elx" ).addOffsets(), { top: addTop + 60, left: addLeft + 40 }, "jQuery object" ); + deepEqual( $( "#elx" ).addOffsets(), { top: addTop + 60, left: addLeft + 40 }, "jQuery object" ); $( "#elx" ).position({ my: "left top", @@ -147,7 +147,7 @@ test( "of", function() { collision: "none", within: within }); - same( $( "#elx" ).addOffsets(), { top: addTop + 40, left: addLeft + 40 }, "DOM element" ); + deepEqual( $( "#elx" ).addOffsets(), { top: addTop + 40, left: addLeft + 40 }, "DOM element" ); var event = $.extend( $.Event( "someEvent" ), { pageX: 200, pageY: 300 } ); $( "#elx" ).position({ @@ -157,7 +157,7 @@ test( "of", function() { collision: "none", within: within }); - same( $( "#elx" ).offset(), { + deepEqual( $( "#elx" ).offset(), { top: 300, left: 200 }, "event - left top, left top" ); @@ -170,7 +170,7 @@ test( "of", function() { collision: "none", within: within }); - same( $( "#elx" ).offset(), { + deepEqual( $( "#elx" ).offset(), { top: 600, left: 400 }, "event - left top, right bottom" ); @@ -186,7 +186,7 @@ test( "within:offsets", function() { collision: "none", within: within }); - same( $( "#elx" ).addOffsets(), { top: addTop + 70, left: addLeft + 50 }, "offsets in at" ); + deepEqual( $( "#elx" ).addOffsets(), { top: addTop + 70, left: addLeft + 50 }, "offsets in at" ); $( "#elx" ).position({ my: "left+10 top-10", @@ -195,7 +195,7 @@ test( "within:offsets", function() { collision: "none", within: within }); - same( $( "#elx" ).addOffsets(), { top: addTop + 50, left: addLeft + 50 }, "offsets in my" ); + deepEqual( $( "#elx" ).addOffsets(), { top: addTop + 50, left: addLeft + 50 }, "offsets in my" ); $( "#elx" ).position({ my: "left top", @@ -204,7 +204,7 @@ test( "within:offsets", function() { collision: "none", within: within }); - same( $( "#elx" ).addOffsets(), { top: addTop + 58, left: addLeft + 50 }, "percentage offsets in at" ); + deepEqual( $( "#elx" ).addOffsets(), { top: addTop + 58, left: addLeft + 50 }, "percentage offsets in at" ); $( "#elx" ).position({ my: "left-30% top+50%", @@ -213,7 +213,7 @@ test( "within:offsets", function() { collision: "none", within: within }); - same( $( "#elx" ).addOffsets(), { top: addTop + 65, left: addLeft + 37 }, "percentage offsets in my" ); + deepEqual( $( "#elx" ).addOffsets(), { top: addTop + 65, left: addLeft + 37 }, "percentage offsets in my" ); }); test( "using", function() { @@ -239,15 +239,15 @@ test( "using", function() { using: function( position ) { position.top -= within.offset().top; position.left -= within.offset().left; - same( this, elems[ count ], "correct context for call #" + count ); - same( position, expectedPosition, "correct position for call #" + count ); + deepEqual( this, elems[ count ], "correct context for call #" + count ); + deepEqual( position, expectedPosition, "correct position for call #" + count ); count++; }, within: within }); elems.each(function() { - same( $( this ).addOffsets(), originalPosition, "elements not moved" ); + deepEqual( $( this ).addOffsets(), originalPosition, "elements not moved" ); }); }); @@ -261,7 +261,7 @@ function collisionTest( config, result, msg ) { within: within }, config ) ); - same( elem.addOffsets(), result, msg ); + deepEqual( elem.addOffsets(), result, msg ); } function collisionTest2( config, result, msg ) { @@ -458,7 +458,7 @@ test( "addClass: flipped left", function() { at: "right center" }); - same( elem.hasClass( 'ui-flipped-left' ), false, 'Has ui-flipped-left class' ); + deepEqual( elem.hasClass( 'ui-flipped-left' ), false, 'Has ui-flipped-left class' ); elem.position( { my: "right center", @@ -468,7 +468,7 @@ test( "addClass: flipped left", function() { at: "left center" }) - same( elem.hasClass( 'ui-flipped-left' ), false, 'Removed ui-flipped-left class' ); + deepEqual( elem.hasClass( 'ui-flipped-left' ), false, 'Removed ui-flipped-left class' ); }); test( "addClass: flipped top", function() { @@ -482,7 +482,7 @@ test( "addClass: flipped top", function() { at: "right bottom" }); - same( elem.hasClass( 'ui-flipped-top' ), false, 'Has ui-flipped-top class' ); + deepEqual( elem.hasClass( 'ui-flipped-top' ), false, 'Has ui-flipped-top class' ); elem.position( { my: "left bottom", @@ -492,7 +492,7 @@ test( "addClass: flipped top", function() { at: "right top" }); - same( elem.hasClass( 'ui-flipped-top' ), false, 'Removed ui-flipped-top class' ); + deepEqual( elem.hasClass( 'ui-flipped-top' ), false, 'Removed ui-flipped-top class' ); }); test( "addClass: flipped right", function() { @@ -506,7 +506,7 @@ test( "addClass: flipped right", function() { at: "left center" }); - same( elem.hasClass( 'ui-flipped-right' ), false, 'Has ui-flipped-right class' ); + deepEqual( elem.hasClass( 'ui-flipped-right' ), false, 'Has ui-flipped-right class' ); elem.position( { my: "left center", @@ -516,7 +516,7 @@ test( "addClass: flipped right", function() { at: "right center" }); - same( elem.hasClass( 'ui-flipped-right' ), false, 'Removed ui-flipped-right class' ); + deepEqual( elem.hasClass( 'ui-flipped-right' ), false, 'Removed ui-flipped-right class' ); }); @@ -530,7 +530,7 @@ test( "addClass: flipped bottom", function() { at: "right top" }); - same( elem.hasClass( 'ui-flipped-bottom' ), false, 'Has ui-flipped-bottom class' ); + deepEqual( elem.hasClass( 'ui-flipped-bottom' ), false, 'Has ui-flipped-bottom class' ); elem.position( { my: "left top", @@ -539,7 +539,7 @@ test( "addClass: flipped bottom", function() { at: "right bottom" }); - same( elem.hasClass( 'ui-flipped-bottom' ), false, 'Removed ui-flipped-bottom class' ); + deepEqual( elem.hasClass( 'ui-flipped-bottom' ), false, 'Removed ui-flipped-bottom class' ); }); }( jQuery ) ); diff --git a/tests/unit/position/position_deprecated.js b/tests/unit/position/position_deprecated.js index 3e72c4a4d6e..9a3164246cd 100644 --- a/tests/unit/position/position_deprecated.js +++ b/tests/unit/position/position_deprecated.js @@ -8,7 +8,7 @@ test( "offset", function() { offset: "10", collision: "none" }); - same( $( "#elx" ).offset(), { top: 70, left: 50 }, "single value" ); + deepEqual( $( "#elx" ).offset(), { top: 70, left: 50 }, "single value" ); $( "#elx" ).position({ my: "left top", @@ -17,7 +17,7 @@ test( "offset", function() { offset: "5 -3", collision: "none" }); - same( $( "#elx" ).offset(), { top: 57, left: 45 }, "two values" ); + deepEqual( $( "#elx" ).offset(), { top: 57, left: 45 }, "two values" ); $( "#elx" ).position({ my: "left top", @@ -26,7 +26,7 @@ test( "offset", function() { offset: "5px -3px", collision: "none" }); - same( $( "#elx" ).offset(), { top: 57, left: 45 }, "with units" ); + deepEqual( $( "#elx" ).offset(), { top: 57, left: 45 }, "with units" ); }); }( jQuery ) ); diff --git a/tests/unit/progressbar/progressbar_core.js b/tests/unit/progressbar/progressbar_core.js index a499d858c6c..a0ea6c48fa8 100644 --- a/tests/unit/progressbar/progressbar_core.js +++ b/tests/unit/progressbar/progressbar_core.js @@ -12,17 +12,17 @@ test("accessibility", function() { expect(7); el = $("#progressbar").progressbar(); - equals(el.attr("role"), "progressbar", "aria role"); - equals(el.attr("aria-valuemin"), 0, "aria-valuemin"); - equals(el.attr("aria-valuemax"), 100, "aria-valuemax"); - equals(el.attr("aria-valuenow"), 0, "aria-valuenow initially"); + equal(el.attr("role"), "progressbar", "aria role"); + equal(el.attr("aria-valuemin"), 0, "aria-valuemin"); + equal(el.attr("aria-valuemax"), 100, "aria-valuemax"); + equal(el.attr("aria-valuenow"), 0, "aria-valuenow initially"); el.progressbar("value", 77); - equals(el.attr("aria-valuenow"), 77, "aria-valuenow"); + equal(el.attr("aria-valuenow"), 77, "aria-valuenow"); el.progressbar("disable"); - equals(el.attr("aria-disabled"), "true", "aria-disabled on"); + equal(el.attr("aria-disabled"), "true", "aria-disabled on"); el.progressbar("enable"); // FAIL: for some reason IE6 and 7 return a boolean false instead of the string - equals(el.attr("aria-disabled"), "false", "aria-disabled off"); + equal(el.attr("aria-disabled"), "false", "aria-disabled off"); }); })(jQuery); diff --git a/tests/unit/progressbar/progressbar_events.js b/tests/unit/progressbar/progressbar_events.js index 585c090918d..8d7b8868dca 100644 --- a/tests/unit/progressbar/progressbar_events.js +++ b/tests/unit/progressbar/progressbar_events.js @@ -10,7 +10,7 @@ test("create", function() { $("#progressbar").progressbar({ value: 5, create: function() { - same(5, $(this).progressbar("value") ); + deepEqual(5, $(this).progressbar("value") ); }, change: function() { ok(false, 'create() has triggered change()'); @@ -22,7 +22,7 @@ test("change", function() { expect(1); $("#progressbar").progressbar({ change: function() { - same( 5, $(this).progressbar("value") ); + deepEqual( 5, $(this).progressbar("value") ); } }).progressbar("value", 5); }); @@ -31,17 +31,17 @@ test( "complete", function() { expect( 3 ); var changes = 0, value; - + $( "#progressbar" ).progressbar({ change: function() { changes++; - same( $( this ).progressbar( "value" ), value, "change at " + value ); + deepEqual( $( this ).progressbar( "value" ), value, "change at " + value ); }, complete: function() { equal( changes, 2, "complete triggered after change" ); } }); - + value = 5; $( "#progressbar" ).progressbar( "value", value ); value = 100; diff --git a/tests/unit/progressbar/progressbar_methods.js b/tests/unit/progressbar/progressbar_methods.js index a48fa3d4705..966c0c55a75 100644 --- a/tests/unit/progressbar/progressbar_methods.js +++ b/tests/unit/progressbar/progressbar_methods.js @@ -21,16 +21,16 @@ test("destroy", function() { var expected = $('
      ').progressbar(), actual = expected.progressbar('destroy'); - equals(actual, expected, 'destroy is chainable'); + equal(actual, expected, 'destroy is chainable'); }); test('value', function() { expect(3); - + var el = $('
      ').progressbar({ value: 20 }); - equals(el.progressbar('value'), 20, 'correct value as getter'); - equals(el.progressbar('value', 30), el, 'chainable as setter'); - equals(el.progressbar('option', 'value'), 30, 'correct value after setter'); + equal(el.progressbar('value'), 20, 'correct value as getter'); + equal(el.progressbar('value', 30), el, 'chainable as setter'); + equal(el.progressbar('option', 'value'), 30, 'correct value after setter'); }); })(jQuery); diff --git a/tests/unit/progressbar/progressbar_options.js b/tests/unit/progressbar/progressbar_options.js index 230c939abd0..815606ec66c 100644 --- a/tests/unit/progressbar/progressbar_options.js +++ b/tests/unit/progressbar/progressbar_options.js @@ -7,7 +7,7 @@ module("progressbar: options"); test("{ value : 0 }, default", function() { $("#progressbar").progressbar(); - same( 0, $("#progressbar").progressbar("value") ); + deepEqual( 0, $("#progressbar").progressbar("value") ); }); // Ticket #7231 - valueDiv should be hidden when value is at 0% @@ -31,21 +31,21 @@ test("{ value : 5 }", function() { $("#progressbar").progressbar({ value: 5 }); - same( 5, $("#progressbar").progressbar("value") ); + deepEqual( 5, $("#progressbar").progressbar("value") ); }); test("{ value : -5 }", function() { $("#progressbar").progressbar({ value: -5 }); - same( 0, $("#progressbar").progressbar("value") ); + deepEqual( 0, $("#progressbar").progressbar("value") ); }); test("{ value : 105 }", function() { $("#progressbar").progressbar({ value: 105 }); - same( 100, $("#progressbar").progressbar("value") ); + deepEqual( 100, $("#progressbar").progressbar("value") ); }); test("{ max : 5, value : 10 }", function() { @@ -53,7 +53,7 @@ test("{ max : 5, value : 10 }", function() { max: 5, value: 10 }); - same( 5, $("#progressbar").progressbar("value") ); + deepEqual( 5, $("#progressbar").progressbar("value") ); }); })(jQuery); diff --git a/tests/unit/resizable/resizable_core.js b/tests/unit/resizable/resizable_core.js index 33a3f723b66..aef2ae15c79 100644 --- a/tests/unit/resizable/resizable_core.js +++ b/tests/unit/resizable/resizable_core.js @@ -14,7 +14,7 @@ var drag = function(el, dx, dy, complete) { $(el).simulate("mouseover"); return $(el).simulate("drag", { - dx: dx||0, dy: dy||0, speed: 'sync', complete: complete + dx: dx||0, dy: dy||0, speed: 'sync', complete: complete }); }; @@ -47,10 +47,10 @@ test("n", function() { var handle = '.ui-resizable-n', target = $('#resizable1').resizable({ handles: 'all' }); drag(handle, 0, -50); - equals( target.height(), 150, "compare height" ); + equal( target.height(), 150, "compare height" ); drag(handle, 0, 50); - equals( target.height(), 100, "compare height" ); + equal( target.height(), 100, "compare height" ); }); test("s", function() { @@ -59,10 +59,10 @@ test("s", function() { var handle = '.ui-resizable-s', target = $('#resizable1').resizable({ handles: 'all' }); drag(handle, 0, 50); - equals( target.height(), 150, "compare height" ); + equal( target.height(), 150, "compare height" ); drag(handle, 0, -50); - equals( target.height(), 100, "compare height" ); + equal( target.height(), 100, "compare height" ); }); test("e", function() { @@ -71,10 +71,10 @@ test("e", function() { var handle = '.ui-resizable-e', target = $('#resizable1').resizable({ handles: 'all' }); drag(handle, 50); - equals( target.width(), 150, "compare width"); + equal( target.width(), 150, "compare width"); drag(handle, -50); - equals( target.width(), 100, "compare width" ); + equal( target.width(), 100, "compare width" ); }); test("w", function() { @@ -83,10 +83,10 @@ test("w", function() { var handle = '.ui-resizable-w', target = $('#resizable1').resizable({ handles: 'all' }); drag(handle, -50); - equals( target.width(), 150, "compare width" ); + equal( target.width(), 150, "compare width" ); drag(handle, 50); - equals( target.width(), 100, "compare width" ); + equal( target.width(), 100, "compare width" ); }); test("ne", function() { @@ -95,12 +95,12 @@ test("ne", function() { var handle = '.ui-resizable-ne', target = $('#resizable1').css({ overflow: 'hidden' }).resizable({ handles: 'all' }); drag(handle, -50, -50); - equals( target.width(), 50, "compare width" ); - equals( target.height(), 150, "compare height" ); + equal( target.width(), 50, "compare width" ); + equal( target.height(), 150, "compare height" ); drag(handle, 50, 50); - equals( target.width(), 100, "compare width" ); - equals( target.height(), 100, "compare height" ); + equal( target.width(), 100, "compare width" ); + equal( target.height(), 100, "compare height" ); }); test("se", function() { @@ -109,12 +109,12 @@ test("se", function() { var handle = '.ui-resizable-se', target = $('#resizable1').resizable({ handles: 'all' }); drag(handle, 50, 50); - equals( target.width(), 150, "compare width" ); - equals( target.height(), 150, "compare height" ); + equal( target.width(), 150, "compare width" ); + equal( target.height(), 150, "compare height" ); drag(handle, -50, -50); - equals( target.width(), 100, "compare width" ); - equals( target.height(), 100, "compare height" ); + equal( target.width(), 100, "compare width" ); + equal( target.height(), 100, "compare height" ); }); test("sw", function() { @@ -123,12 +123,12 @@ test("sw", function() { var handle = '.ui-resizable-sw', target = $('#resizable1').resizable({ handles: 'all' }); drag(handle, -50, -50); - equals( target.width(), 150, "compare width" ); - equals( target.height(), 50, "compare height" ); + equal( target.width(), 150, "compare width" ); + equal( target.height(), 50, "compare height" ); drag(handle, 50, 50); - equals( target.width(), 100, "compare width" ); - equals( target.height(), 100, "compare height" ); + equal( target.width(), 100, "compare width" ); + equal( target.height(), 100, "compare height" ); }); test("nw", function() { @@ -137,12 +137,12 @@ test("nw", function() { var handle = '.ui-resizable-nw', target = $('#resizable1').resizable({ handles: 'all' }); drag(handle, -50, -50); - equals( target.width(), 150, "compare width" ); - equals( target.height(), 150, "compare height" ); + equal( target.width(), 150, "compare width" ); + equal( target.height(), 150, "compare height" ); drag(handle, 50, 50); - equals( target.width(), 100, "compare width" ); - equals( target.height(), 100, "compare height" ); + equal( target.width(), 100, "compare width" ); + equal( target.height(), 100, "compare height" ); }); })(jQuery); diff --git a/tests/unit/resizable/resizable_methods.js b/tests/unit/resizable/resizable_methods.js index 6ac287fe2d6..03e91d44013 100644 --- a/tests/unit/resizable/resizable_methods.js +++ b/tests/unit/resizable/resizable_methods.js @@ -44,20 +44,20 @@ test("destroy", function() { var expected = $('
      ').resizable(), actual = expected.resizable('destroy'); - equals(actual, expected, 'destroy is chainable'); + equal(actual, expected, 'destroy is chainable'); }); test("enable", function() { var expected = $('
      ').resizable(), actual = expected.resizable('enable'); - equals(actual, expected, 'enable is chainable'); + equal(actual, expected, 'enable is chainable'); ok(false, "missing test - untested code is broken code."); }); test("disable", function() { var expected = $('
      ').resizable(), actual = expected.resizable('disable'); - equals(actual, expected, 'disable is chainable'); + equal(actual, expected, 'disable is chainable'); ok(false, "missing test - untested code is broken code."); }); diff --git a/tests/unit/resizable/resizable_options.js b/tests/unit/resizable/resizable_options.js index 389931f92f1..76cca560a59 100644 --- a/tests/unit/resizable/resizable_options.js +++ b/tests/unit/resizable/resizable_options.js @@ -11,12 +11,12 @@ test("aspectRatio: 'preserve' (e)", function() { var handle = '.ui-resizable-e', target = $('#resizable1').resizable({ aspectRatio: 'preserve', handles: 'all', minWidth: 70, minHeight: 50, maxWidth: 150, maxHeight: 130 }); drag(handle, 80); - equals( target.width(), 130, "compare maxWidth"); - equals( target.height(), 130, "compare maxHeight"); + equal( target.width(), 130, "compare maxWidth"); + equal( target.height(), 130, "compare maxHeight"); drag(handle, -130); - equals( target.width(), 70, "compare minWidth"); - equals( target.height(), 70, "compare minHeight"); + equal( target.width(), 70, "compare minWidth"); + equal( target.height(), 70, "compare minHeight"); }); test("aspectRatio: 'preserve' (w)", function() { @@ -25,12 +25,12 @@ test("aspectRatio: 'preserve' (w)", function() { var handle = '.ui-resizable-w', target = $('#resizable1').resizable({ aspectRatio: 'preserve', handles: 'all', minWidth: 70, minHeight: 50, maxWidth: 150, maxHeight: 130 }); drag(handle, -80); - equals( target.width(), 130, "compare maxWidth"); - equals( target.height(), 130, "compare maxHeight"); + equal( target.width(), 130, "compare maxWidth"); + equal( target.height(), 130, "compare maxHeight"); drag(handle, 130); - equals( target.width(), 70, "compare minWidth"); - equals( target.height(), 70, "compare minHeight"); + equal( target.width(), 70, "compare minWidth"); + equal( target.height(), 70, "compare minHeight"); }); test("aspectRatio: 'preserve' (n)", function() { @@ -39,12 +39,12 @@ test("aspectRatio: 'preserve' (n)", function() { var handle = '.ui-resizable-n', target = $('#resizable1').resizable({ aspectRatio: 'preserve', handles: 'all', minWidth: 70, minHeight: 50, maxWidth: 150, maxHeight: 130 }); drag(handle, 0, -80); - equals( target.width(), 130, "compare maxWidth"); - equals( target.height(), 130, "compare maxHeight"); + equal( target.width(), 130, "compare maxWidth"); + equal( target.height(), 130, "compare maxHeight"); drag(handle, 0, 80); - equals( target.width(), 70, "compare minWidth"); - equals( target.height(), 70, "compare minHeight"); + equal( target.width(), 70, "compare minWidth"); + equal( target.height(), 70, "compare minHeight"); }); test("aspectRatio: 'preserve' (s)", function() { @@ -53,12 +53,12 @@ test("aspectRatio: 'preserve' (s)", function() { var handle = '.ui-resizable-s', target = $('#resizable1').resizable({ aspectRatio: 'preserve', handles: 'all', minWidth: 70, minHeight: 50, maxWidth: 150, maxHeight: 130 }); drag(handle, 0, 80); - equals( target.width(), 130, "compare maxWidth"); - equals( target.height(), 130, "compare maxHeight"); + equal( target.width(), 130, "compare maxWidth"); + equal( target.height(), 130, "compare maxHeight"); drag(handle, 0, -80); - equals( target.width(), 70, "compare minWidth"); - equals( target.height(), 70, "compare minHeight"); + equal( target.width(), 70, "compare minWidth"); + equal( target.height(), 70, "compare minHeight"); }); test("aspectRatio: 'preserve' (se)", function() { @@ -67,12 +67,12 @@ test("aspectRatio: 'preserve' (se)", function() { var handle = '.ui-resizable-se', target = $('#resizable1').resizable({ aspectRatio: 'preserve', handles: 'all', minWidth: 70, minHeight: 50, maxWidth: 150, maxHeight: 130 }); drag(handle, 80, 80); - equals( target.width(), 130, "compare maxWidth"); - equals( target.height(), 130, "compare maxHeight"); + equal( target.width(), 130, "compare maxWidth"); + equal( target.height(), 130, "compare maxHeight"); drag(handle, -80, -80); - equals( target.width(), 70, "compare minWidth"); - equals( target.height(), 70, "compare minHeight"); + equal( target.width(), 70, "compare minWidth"); + equal( target.height(), 70, "compare minHeight"); }); test("aspectRatio: 'preserve' (sw)", function() { @@ -81,12 +81,12 @@ test("aspectRatio: 'preserve' (sw)", function() { var handle = '.ui-resizable-sw', target = $('#resizable1').resizable({ aspectRatio: 'preserve', handles: 'all', minWidth: 70, minHeight: 50, maxWidth: 150, maxHeight: 130 }); drag(handle, -80, 80); - equals( target.width(), 130, "compare maxWidth"); - equals( target.height(), 130, "compare maxHeight"); + equal( target.width(), 130, "compare maxWidth"); + equal( target.height(), 130, "compare maxHeight"); drag(handle, 80, -80); - equals( target.width(), 70, "compare minWidth"); - equals( target.height(), 70, "compare minHeight"); + equal( target.width(), 70, "compare minWidth"); + equal( target.height(), 70, "compare minHeight"); }); test("aspectRatio: 'preserve' (ne)", function() { @@ -95,12 +95,12 @@ test("aspectRatio: 'preserve' (ne)", function() { var handle = '.ui-resizable-ne', target = $('#resizable1').resizable({ aspectRatio: 'preserve', handles: 'all', minWidth: 70, minHeight: 50, maxWidth: 150, maxHeight: 130 }); drag(handle, 80, -80); - equals( target.width(), 130, "compare maxWidth"); - equals( target.height(), 130, "compare maxHeight"); + equal( target.width(), 130, "compare maxWidth"); + equal( target.height(), 130, "compare maxHeight"); drag(handle, -80, 80); - equals( target.width(), 70, "compare minWidth"); - equals( target.height(), 70, "compare minHeight"); + equal( target.width(), 70, "compare minWidth"); + equal( target.height(), 70, "compare minHeight"); }); test("grid", function() { @@ -109,12 +109,12 @@ test("grid", function() { var handle = '.ui-resizable-se', target = $('#resizable1').resizable({ handles: 'all', grid: [0, 20] }); drag(handle, 3, 9); - equals( target.width(), 103, "compare width"); - equals( target.height(), 100, "compare height"); + equal( target.width(), 103, "compare width"); + equal( target.height(), 100, "compare height"); drag(handle, 15, 11); - equals( target.width(), 118, "compare width"); - equals( target.height(), 120, "compare height"); + equal( target.width(), 118, "compare width"); + equal( target.height(), 120, "compare height"); }); test("grid (wrapped)", function() { @@ -123,12 +123,12 @@ test("grid (wrapped)", function() { var handle = '.ui-resizable-se', target = $('#resizable2').resizable({ handles: 'all', grid: [0, 20] }); drag(handle, 3, 9); - equals( target.width(), 103, "compare width"); - equals( target.height(), 100, "compare height"); + equal( target.width(), 103, "compare width"); + equal( target.height(), 100, "compare height"); drag(handle, 15, 11); - equals( target.width(), 118, "compare width"); - equals( target.height(), 120, "compare height"); + equal( target.width(), 118, "compare width"); + equal( target.height(), 120, "compare height"); }); test("ui-resizable-se { handles: 'all', minWidth: 60, minHeight: 60, maxWidth: 100, maxHeight: 100 }", function() { @@ -137,12 +137,12 @@ test("ui-resizable-se { handles: 'all', minWidth: 60, minHeight: 60, maxWidth: 1 var handle = '.ui-resizable-se', target = $('#resizable1').resizable({ handles: 'all', minWidth: 60, minHeight: 60, maxWidth: 100, maxHeight: 100 }); drag(handle, -50, -50); - equals( target.width(), 60, "compare minWidth" ); - equals( target.height(), 60, "compare minHeight" ); + equal( target.width(), 60, "compare minWidth" ); + equal( target.height(), 60, "compare minHeight" ); drag(handle, 70, 70); - equals( target.width(), 100, "compare maxWidth" ); - equals( target.height(), 100, "compare maxHeight" ); + equal( target.width(), 100, "compare maxWidth" ); + equal( target.height(), 100, "compare maxHeight" ); }); test("ui-resizable-sw { handles: 'all', minWidth: 60, minHeight: 60, maxWidth: 100, maxHeight: 100 }", function() { @@ -151,12 +151,12 @@ test("ui-resizable-sw { handles: 'all', minWidth: 60, minHeight: 60, maxWidth: 1 var handle = '.ui-resizable-sw', target = $('#resizable1').resizable({ handles: 'all', minWidth: 60, minHeight: 60, maxWidth: 100, maxHeight: 100 }); drag(handle, 50, -50); - equals( target.width(), 60, "compare minWidth" ); - equals( target.height(), 60, "compare minHeight" ); + equal( target.width(), 60, "compare minWidth" ); + equal( target.height(), 60, "compare minHeight" ); drag(handle, -70, 70); - equals( target.width(), 100, "compare maxWidth" ); - equals( target.height(), 100, "compare maxHeight" ); + equal( target.width(), 100, "compare maxWidth" ); + equal( target.height(), 100, "compare maxHeight" ); }); test("ui-resizable-ne { handles: 'all', minWidth: 60, minHeight: 60, maxWidth: 100, maxHeight: 100 }", function() { @@ -165,12 +165,12 @@ test("ui-resizable-ne { handles: 'all', minWidth: 60, minHeight: 60, maxWidth: 1 var handle = '.ui-resizable-ne', target = $('#resizable1').resizable({ handles: 'all', minWidth: 60, minHeight: 60, maxWidth: 100, maxHeight: 100 }); drag(handle, -50, 50); - equals( target.width(), 60, "compare minWidth" ); - equals( target.height(), 60, "compare minHeight" ); + equal( target.width(), 60, "compare minWidth" ); + equal( target.height(), 60, "compare minHeight" ); drag(handle, 70, -70); - equals( target.width(), 100, "compare maxWidth" ); - equals( target.height(), 100, "compare maxHeight" ); + equal( target.width(), 100, "compare maxWidth" ); + equal( target.height(), 100, "compare maxHeight" ); }); test("ui-resizable-nw { handles: 'all', minWidth: 60, minHeight: 60, maxWidth: 100, maxHeight: 100 }", function() { @@ -179,12 +179,12 @@ test("ui-resizable-nw { handles: 'all', minWidth: 60, minHeight: 60, maxWidth: 1 var handle = '.ui-resizable-nw', target = $('#resizable1').resizable({ handles: 'all', minWidth: 60, minHeight: 60, maxWidth: 100, maxHeight: 100 }); drag(handle, 70, 70); - equals( target.width(), 60, "compare minWidth" ); - equals( target.height(), 60, "compare minHeight" ); + equal( target.width(), 60, "compare minWidth" ); + equal( target.height(), 60, "compare minHeight" ); drag(handle, -70, -70); - equals( target.width(), 100, "compare maxWidth" ); - equals( target.height(), 100, "compare maxHeight" ); + equal( target.width(), 100, "compare maxWidth" ); + equal( target.height(), 100, "compare maxHeight" ); }); })(jQuery); diff --git a/tests/unit/selectable/selectable_events.js b/tests/unit/selectable/selectable_events.js index 03b65ab885b..2623818a75f 100644 --- a/tests/unit/selectable/selectable_events.js +++ b/tests/unit/selectable/selectable_events.js @@ -11,7 +11,7 @@ test("start", function() { el.selectable({ start: function(ev, ui) { ok(true, "drag fired start callback"); - equals(this, el[0], "context of callback"); + equal(this, el[0], "context of callback"); } }); el.simulate("drag", 20, 20); @@ -23,7 +23,7 @@ test("stop", function() { el.selectable({ start: function(ev, ui) { ok(true, "drag fired stop callback"); - equals(this, el[0], "context of callback"); + equal(this, el[0], "context of callback"); } }); el.simulate("drag", 20, 20); diff --git a/tests/unit/selectable/selectable_methods.js b/tests/unit/selectable/selectable_methods.js index 06b75f9fc72..32dfe00ed17 100644 --- a/tests/unit/selectable/selectable_methods.js +++ b/tests/unit/selectable/selectable_methods.js @@ -44,7 +44,7 @@ test("destroy", function() { var expected = $('
      ').selectable(), actual = expected.selectable('destroy'); - equals(actual, expected, 'destroy is chainable'); + equal(actual, expected, 'destroy is chainable'); }); test("enable", function() { @@ -57,15 +57,15 @@ test("enable", function() { start: function() { fired = true; } }); el.simulate("drag", 20, 20); - equals(fired, false, "start fired"); + equal(fired, false, "start fired"); el.selectable("enable"); el.simulate("drag", 20, 20); - equals(fired, true, "start fired"); + equal(fired, true, "start fired"); el.selectable("destroy"); - + var expected = $('
      ').selectable(), actual = expected.selectable('enable'); - equals(actual, expected, 'enable is chainable'); + equal(actual, expected, 'enable is chainable'); }); test("disable", function() { @@ -78,16 +78,16 @@ test("disable", function() { start: function() { fired = true; } }); el.simulate("drag", 20, 20); - equals(fired, true, "start fired"); + equal(fired, true, "start fired"); el.selectable("disable"); fired = false; el.simulate("drag", 20, 20); - equals(fired, false, "start fired"); + equal(fired, false, "start fired"); el.selectable("destroy"); - + var expected = $('
      ').selectable(), actual = expected.selectable('disable'); - equals(actual, expected, 'disable is chainable'); + equal(actual, expected, 'disable is chainable'); }); })(jQuery); diff --git a/tests/unit/selectable/selectable_options.js b/tests/unit/selectable/selectable_options.js index 36b7b5b0d18..2bc44e6e00d 100644 --- a/tests/unit/selectable/selectable_options.js +++ b/tests/unit/selectable/selectable_options.js @@ -14,7 +14,7 @@ test("autoRefresh", function() { el = $("#selectable1").selectable({ autoRefresh: false, selected: selected }); sel.hide(); drag(1000, 1000); - equals(actual, sel.length); + equal(actual, sel.length); el.selectable("destroy"); actual = 0; @@ -22,10 +22,10 @@ test("autoRefresh", function() { el = $("#selectable1").selectable({ autoRefresh: true, selected: selected }); sel.hide(); drag(1000, 1000); - equals(actual, 0); + equal(actual, 0); sel.show(); drag(1000, 1000); - equals(actual, sel.length); + equal(actual, sel.length); el.selectable("destroy"); sel.show(); }); @@ -39,7 +39,7 @@ test("filter", function() { el = $("#selectable1").selectable({ filter: '.special', selected: selected }); drag(1000, 1000); ok(sel.length != 1, "this test assumes more than 1 selectee"); - equals(actual, 1); + equal(actual, 1); el.selectable("destroy"); }); diff --git a/tests/unit/slider/slider_core.js b/tests/unit/slider/slider_core.js index 38d4f46691b..e5f21ee1b71 100644 --- a/tests/unit/slider/slider_core.js +++ b/tests/unit/slider/slider_core.js @@ -28,9 +28,9 @@ test("keydown HOME on handle sets value to min", function() { el.slider("value", 0); handle().simulate("keydown", { keyCode: $.ui.keyCode.HOME }); - equals(el.slider("value"), options.min); + equal(el.slider("value"), options.min); - el.slider('destroy'); + el.slider('destroy'); el = $('
      '); options = { @@ -44,7 +44,7 @@ test("keydown HOME on handle sets value to min", function() { el.slider("value", 0); handle().simulate("keydown", { keyCode: $.ui.keyCode.HOME }); - equals(el.slider("value"), options.min); + equal(el.slider("value"), options.min); el.slider('destroy'); }); @@ -62,9 +62,9 @@ test("keydown END on handle sets value to max", function() { el.slider("value", 0); handle().simulate("keydown", { keyCode: $.ui.keyCode.END }); - equals(el.slider("value"), options.max); + equal(el.slider("value"), options.max); - el.slider('destroy'); + el.slider('destroy'); el = $('
      '); options = { @@ -78,7 +78,7 @@ test("keydown END on handle sets value to max", function() { el.slider("value", 0); handle().simulate("keydown", { keyCode: $.ui.keyCode.END }); - equals(el.slider("value"), options.max); + equal(el.slider("value"), options.max); el.slider('destroy'); }); @@ -97,10 +97,10 @@ test("keydown PAGE_UP on handle increases value by 1/5 range, not greater than m el.slider("value", 70); handle().simulate("keydown", { keyCode: $.ui.keyCode.PAGE_UP }); - equals(el.slider("value"), 90); + equal(el.slider("value"), 90); handle().simulate("keydown", { keyCode: $.ui.keyCode.PAGE_UP }); - equals(el.slider("value"), 100); + equal(el.slider("value"), 100); el.slider("destroy"); }); @@ -120,10 +120,10 @@ test("keydown PAGE_DOWN on handle decreases value by 1/5 range, not less than mi el.slider("value", 30); handle().simulate("keydown", { keyCode: $.ui.keyCode.PAGE_DOWN }); - equals(el.slider("value"), 10); + equal(el.slider("value"), 10); handle().simulate("keydown", { keyCode: $.ui.keyCode.PAGE_DOWN }); - equals(el.slider("value"), 0); + equal(el.slider("value"), 0); el.slider("destroy"); }); @@ -142,12 +142,12 @@ test("keydown UP on handle increases value by step, not greater than max", funct el.slider("value", options.max - options.step); handle().simulate("keydown", { keyCode: $.ui.keyCode.UP }); - equals(el.slider("value"), options.max); + equal(el.slider("value"), options.max); handle().simulate("keydown", { keyCode: $.ui.keyCode.UP }); - equals(el.slider("value"), options.max); + equal(el.slider("value"), options.max); - el.slider("destroy"); + el.slider("destroy"); el = $('
      '); options = { @@ -161,12 +161,12 @@ test("keydown UP on handle increases value by step, not greater than max", funct el.slider("value", options.max - options.step); handle().simulate("keydown", { keyCode: $.ui.keyCode.UP }); - equals(el.slider("value"), options.max); + equal(el.slider("value"), options.max); handle().simulate("keydown", { keyCode: $.ui.keyCode.UP }); - equals(el.slider("value"), options.max); + equal(el.slider("value"), options.max); - el.slider("destroy"); + el.slider("destroy"); }); test("keydown RIGHT on handle increases value by step, not greater than max", function() { @@ -182,12 +182,12 @@ test("keydown RIGHT on handle increases value by step, not greater than max", fu el.slider("value", options.max - options.step); handle().simulate("keydown", { keyCode: $.ui.keyCode.RIGHT }); - equals(el.slider("value"), options.max); + equal(el.slider("value"), options.max); handle().simulate("keydown", { keyCode: $.ui.keyCode.RIGHT }); - equals(el.slider("value"), options.max); + equal(el.slider("value"), options.max); - el.slider("destroy"); + el.slider("destroy"); el = $('
      '); options = { @@ -201,12 +201,12 @@ test("keydown RIGHT on handle increases value by step, not greater than max", fu el.slider("value", options.max - options.step); handle().simulate("keydown", { keyCode: $.ui.keyCode.RIGHT }); - equals(el.slider("value"), options.max); + equal(el.slider("value"), options.max); handle().simulate("keydown", { keyCode: $.ui.keyCode.RIGHT }); - equals(el.slider("value"), options.max); + equal(el.slider("value"), options.max); - el.slider("destroy"); + el.slider("destroy"); }); test("keydown DOWN on handle decreases value by step, not less than min", function() { @@ -222,12 +222,12 @@ test("keydown DOWN on handle decreases value by step, not less than min", functi el.slider("value", options.min + options.step); handle().simulate("keydown", { keyCode: $.ui.keyCode.DOWN }); - equals(el.slider("value"), options.min); + equal(el.slider("value"), options.min); handle().simulate("keydown", { keyCode: $.ui.keyCode.DOWN }); - equals(el.slider("value"), options.min); + equal(el.slider("value"), options.min); - el.slider("destroy"); + el.slider("destroy"); el = $('
      '); options = { @@ -241,12 +241,12 @@ test("keydown DOWN on handle decreases value by step, not less than min", functi el.slider("value", options.min + options.step); handle().simulate("keydown", { keyCode: $.ui.keyCode.DOWN }); - equals(el.slider("value"), options.min); + equal(el.slider("value"), options.min); handle().simulate("keydown", { keyCode: $.ui.keyCode.DOWN }); - equals(el.slider("value"), options.min); + equal(el.slider("value"), options.min); - el.slider("destroy"); + el.slider("destroy"); }); test("keydown LEFT on handle decreases value by step, not less than min", function() { @@ -262,12 +262,12 @@ test("keydown LEFT on handle decreases value by step, not less than min", functi el.slider("value", options.min + options.step); handle().simulate("keydown", { keyCode: $.ui.keyCode.LEFT }); - equals(el.slider("value"), options.min); + equal(el.slider("value"), options.min); handle().simulate("keydown", { keyCode: $.ui.keyCode.LEFT }); - equals(el.slider("value"), options.min); + equal(el.slider("value"), options.min); - el.slider("destroy"); + el.slider("destroy"); el = $('
      '); options = { @@ -281,12 +281,12 @@ test("keydown LEFT on handle decreases value by step, not less than min", functi el.slider("value", options.min + options.step); handle().simulate("keydown", { keyCode: $.ui.keyCode.LEFT }); - equals(el.slider("value"), options.min); + equal(el.slider("value"), options.min); handle().simulate("keydown", { keyCode: $.ui.keyCode.LEFT }); - equals(el.slider("value"), options.min); + equal(el.slider("value"), options.min); - el.slider("destroy"); + el.slider("destroy"); }); })(jQuery); diff --git a/tests/unit/slider/slider_events.js b/tests/unit/slider/slider_events.js index 0b7b250f28b..9e39d2a3e33 100644 --- a/tests/unit/slider/slider_events.js +++ b/tests/unit/slider/slider_events.js @@ -2,7 +2,7 @@ * slider_events.js */ (function($) { - + module( "slider: events" ); //Specs from http://wiki.jqueryui.com/Slider#specs @@ -11,21 +11,21 @@ module( "slider: events" ); // or value method/option" test( "mouse based interaction", function() { expect(4); - + var el = $( "
      " ) .appendTo( "body" ) .slider({ start: function(event, ui) { - equals( event.originalEvent.type, "mousedown", "start triggered by mousedown" ); + equal( event.originalEvent.type, "mousedown", "start triggered by mousedown" ); }, slide: function(event, ui) { - equals( event.originalEvent.type, "mousemove", "slider triggered by mousemove" ); + equal( event.originalEvent.type, "mousemove", "slider triggered by mousemove" ); }, stop: function(event, ui) { - equals( event.originalEvent.type, "mouseup", "stop triggered by mouseup" ); + equal( event.originalEvent.type, "mouseup", "stop triggered by mouseup" ); }, change: function(event, ui) { - equals( event.originalEvent.type, "mouseup", "change triggered by mouseup" ); + equal( event.originalEvent.type, "mouseup", "change triggered by mouseup" ); } }); @@ -35,22 +35,22 @@ test( "mouse based interaction", function() { }); test( "keyboard based interaction", function() { expect(3); - + // Test keyup at end of handle slide (keyboard) var el = $( "
      " ) .appendTo( "body" ) .slider({ start: function(event, ui) { - equals( event.originalEvent.type, "keydown", "start triggered by keydown" ); + equal( event.originalEvent.type, "keydown", "start triggered by keydown" ); }, slide: function(event, ui) { ok( false, "Slider never triggered by keys" ); }, stop: function(event, ui) { - equals( event.originalEvent.type, "keyup", "stop triggered by keyup" ); + equal( event.originalEvent.type, "keyup", "stop triggered by keyup" ); }, change: function(event, ui) { - equals( event.originalEvent.type, "keyup", "change triggered by keyup" ); + equal( event.originalEvent.type, "keyup", "change triggered by keyup" ); } }); @@ -62,7 +62,7 @@ test( "keyboard based interaction", function() { }); test( "programmatic event triggers", function() { expect(6); - + // Test value method var el = $( "
      " ) .slider({ diff --git a/tests/unit/slider/slider_methods.js b/tests/unit/slider/slider_methods.js index 66624e8a8c2..b462220025b 100644 --- a/tests/unit/slider/slider_methods.js +++ b/tests/unit/slider/slider_methods.js @@ -38,13 +38,13 @@ test("destroy", function() { var expected = $('
      ').slider(), actual = expected.slider('destroy'); - equals(actual, expected, 'destroy is chainable'); + equal(actual, expected, 'destroy is chainable'); }); test("enable", function() { var expected = $('
      ').slider(), actual = expected.slider('enable'); - equals(actual, expected, 'enable is chainable'); + equal(actual, expected, 'enable is chainable'); var el = $('
      ').slider({ disabled: true }); ok(el.hasClass('ui-disabled'), 'slider has ui-disabled class before enable method call'); @@ -57,7 +57,7 @@ test("enable", function() { test("disable", function() { var expected = $('
      ').slider(), actual = expected.slider('disable'); - equals(actual, expected, 'disable is chainable'); + equal(actual, expected, 'disable is chainable'); var el = $('
      ').slider({ disabled: false }); ok(!el.hasClass('ui-disabled'), 'slider does not have ui-disabled class before disabled method call'); @@ -73,9 +73,9 @@ test("value", function() { range: this, value: 5 }); - equals(el.slider('value'), 5, 'range: ' + this + ' slider method get'); - equals(el.slider('value', 10), el, 'value method is chainable'); - equals(el.slider('value'), 10, 'range: ' + this + ' slider method set'); + equal(el.slider('value'), 5, 'range: ' + this + ' slider method get'); + equal(el.slider('value', 10), el, 'value method is chainable'); + equal(el.slider('value'), 10, 'range: ' + this + ' slider method set'); el.remove(); }); var el = $('
      ').slider({ @@ -83,16 +83,16 @@ test("value", function() { }); // min with value option vs value method el.slider('option', 'value', -2); - equals(el.slider('option', 'value'), -2, 'value option does not respect min'); - equals(el.slider('value'), -1, 'value method get respects min'); - equals(el.slider('value', -2), el, 'value method is chainable'); - equals(el.slider('option', 'value'), -1, 'value method set respects min'); + equal(el.slider('option', 'value'), -2, 'value option does not respect min'); + equal(el.slider('value'), -1, 'value method get respects min'); + equal(el.slider('value', -2), el, 'value method is chainable'); + equal(el.slider('option', 'value'), -1, 'value method set respects min'); // max with value option vs value method el.slider('option', 'value', 2); - equals(el.slider('option', 'value'), 2, 'value option does not respect max'); - equals(el.slider('value'), 1, 'value method get respects max'); - equals(el.slider('value', 2), el, 'value method is chainable'); - equals(el.slider('option', 'value'), 1, 'value method set respects max'); + equal(el.slider('option', 'value'), 2, 'value option does not respect max'); + equal(el.slider('value'), 1, 'value method get respects max'); + equal(el.slider('value', 2), el, 'value method is chainable'); + equal(el.slider('option', 'value'), 1, 'value method set respects max'); }); //test("values", function() { diff --git a/tests/unit/slider/slider_options.js b/tests/unit/slider/slider_options.js index 040589bd643..7d9899284bb 100644 --- a/tests/unit/slider/slider_options.js +++ b/tests/unit/slider/slider_options.js @@ -13,7 +13,7 @@ module("slider: options"); test("max", function() { el = $('
      '); - + options = { max: 37, min: 6, @@ -31,7 +31,7 @@ test("max", function() { test("min", function() { el = $('
      '); - + options = { max: 37, min: 6, @@ -62,7 +62,7 @@ test("orientation", function() { el.slider(options).slider("option", "orientation", "horizontal"); ok(el.is('.ui-slider-horizontal'), "horizontal slider has class .ui-slider-horizontal"); ok(!el.is('.ui-slider-vertical'), "horizontal slider does not have class .ui-slider-vertical"); - equals(handle().css('left'), percentVal + '%', "horizontal slider handle is positioned with left: %"); + equal(handle().css('left'), percentVal + '%', "horizontal slider handle is positioned with left: %"); el.slider('destroy'); @@ -78,7 +78,7 @@ test("orientation", function() { el.slider(options).slider("option", "orientation", "vertical"); ok(el.is('.ui-slider-vertical'), "vertical slider has class .ui-slider-vertical"); ok(!el.is('.ui-slider-horizontal'), "vertical slider does not have class .ui-slider-horizontal"); - equals(handle().css('bottom'), percentVal + '%', "vertical slider handle is positioned with bottom: %"); + equal(handle().css('bottom'), percentVal + '%', "vertical slider handle is positioned with bottom: %"); el.slider('destroy'); @@ -98,19 +98,19 @@ test("step", function() { step: 10, max: 100 }); - equals( el.slider("value"), 0 ); + equal( el.slider("value"), 0 ); el.slider("value", 1); - equals( el.slider("value"), 0 ); + equal( el.slider("value"), 0 ); el.slider("value", 9); - equals( el.slider("value"), 10 ); + equal( el.slider("value"), 10 ); el.slider("value", 11); - equals( el.slider("value"), 10 ); + equal( el.slider("value"), 10 ); el.slider("value", 19); - equals( el.slider("value"), 20 ); + equal( el.slider("value"), 20 ); el = $('
      ').slider({ min: 0, @@ -121,16 +121,16 @@ el = $('
      ').slider({ el.slider("value", 0); el.slider("option", "value", 1); - equals( el.slider("value"), 0 ); + equal( el.slider("value"), 0 ); el.slider("option", "value", 9); - equals( el.slider("value"), 0 ); + equal( el.slider("value"), 0 ); el.slider("option", "value", 11); - equals( el.slider("value"), 20 ); + equal( el.slider("value"), 20 ); el.slider("option", "value", 19); - equals( el.slider("value"), 20 ); + equal( el.slider("value"), 20 ); el.slider('destroy'); }); diff --git a/tests/unit/sortable/sortable_methods.js b/tests/unit/sortable/sortable_methods.js index c4b5cdc08ff..2446d27558a 100644 --- a/tests/unit/sortable/sortable_methods.js +++ b/tests/unit/sortable/sortable_methods.js @@ -17,7 +17,7 @@ var drag = function(handle, dx, dy) { var sort = function(handle, dx, dy, index, msg) { drag(handle, dx, dy); - equals($(handle).parent().children().index(handle), index, msg); + equal($(handle).parent().children().index(handle), index, msg); } module("sortable: methods"); @@ -59,7 +59,7 @@ test("destroy", function() { var expected = $('
      ').sortable(), actual = expected.sortable('destroy'); - equals(actual, expected, 'destroy is chainable'); + equal(actual, expected, 'destroy is chainable'); }); test("enable", function() { @@ -69,18 +69,18 @@ test("enable", function() { sort($("li", el)[0], 0, 40, 0, '.sortable({ disabled: true })'); el.sortable("enable"); - equals(el.sortable("option", "disabled"), false, "disabled option getter"); + equal(el.sortable("option", "disabled"), false, "disabled option getter"); el.sortable("destroy"); el.sortable({ disabled: true }); el.sortable("option", "disabled", false); - equals(el.sortable("option", "disabled"), false, "disabled option setter"); + equal(el.sortable("option", "disabled"), false, "disabled option setter"); sort($("li", el)[0], 0, 40, 2, '.sortable("option", "disabled", false)'); - + var expected = $('
      ').sortable(), actual = expected.sortable('enable'); - equals(actual, expected, 'enable is chainable'); + equal(actual, expected, 'enable is chainable'); }); test("disable", function() { @@ -96,13 +96,13 @@ test("disable", function() { el.sortable({ disabled: false }); sort($("li", el)[0], 0, 40, 2, '.sortable({ disabled: false })'); el.sortable("option", "disabled", true); - equals(el.sortable("option", "disabled"), true, "disabled option setter"); + equal(el.sortable("option", "disabled"), true, "disabled option setter"); ok(el.sortable("widget").is(":not(.ui-state-disabled)"), "sortable element does not get ui-state-disabled since it's an interaction"); sort($("li", el)[0], 0, 40, 0, '.sortable("option", "disabled", true)'); - + var expected = $('
      ').sortable(), actual = expected.sortable('disable'); - equals(actual, expected, 'disable is chainable'); + equal(actual, expected, 'disable is chainable'); }); })(jQuery); diff --git a/tests/unit/sortable/sortable_tickets.js b/tests/unit/sortable/sortable_tickets.js index 3edc8c04cfb..6ee503a58cb 100644 --- a/tests/unit/sortable/sortable_tickets.js +++ b/tests/unit/sortable/sortable_tickets.js @@ -17,7 +17,7 @@ var drag = function(handle, dx, dy) { var sort = function(handle, dx, dy, index, msg) { drag(handle, dx, dy); - equals($(handle).parent().children().index(handle), index, msg); + equal($(handle).parent().children().index(handle), index, msg); } module("sortable: tickets"); @@ -32,7 +32,7 @@ test("#3019: Stop fires too early", function() { }); sort($("li", el)[0], 0, 40, 2, 'Dragging the sortable'); - equals(helper, null, "helper should be false"); + equal(helper, null, "helper should be false"); }); diff --git a/tests/unit/spinner/spinner_methods.js b/tests/unit/spinner/spinner_methods.js index a9fd6c889f7..9c82218e182 100644 --- a/tests/unit/spinner/spinner_methods.js +++ b/tests/unit/spinner/spinner_methods.js @@ -22,34 +22,34 @@ test( "disable", function() { ok( element.is( ":disabled"), "after: input has disabled attribute" ); spinner_simulateKeyDownUp( element, $.ui.keyCode.UP ); - equals( 2, element.val(), "keyboard - value does not change on key UP" ); + equal( 2, element.val(), "keyboard - value does not change on key UP" ); spinner_simulateKeyDownUp( element, $.ui.keyCode.DOWN ); - equals( 2, element.val(), "keyboard - value does not change on key DOWN" ); + equal( 2, element.val(), "keyboard - value does not change on key DOWN" ); spinner_simulateKeyDownUp( element, $.ui.keyCode.PAGE_UP ); - equals( 2, element.val(), "keyboard - value does not change on key PGUP" ); + equal( 2, element.val(), "keyboard - value does not change on key PGUP" ); spinner_simulateKeyDownUp( element, $.ui.keyCode.PAGE_DOWN ); - equals( 2, element.val(), "keyboard - value does not change on key PGDN" ); + equal( 2, element.val(), "keyboard - value does not change on key PGDN" ); wrapper.find( ".ui-spinner-up" ).trigger( "mousedown" ).trigger( "mouseup" ); - equals( 2, element.val(), "mouse - value does not change on clicking up button" ); + equal( 2, element.val(), "mouse - value does not change on clicking up button" ); wrapper.find( ".ui-spinner-down" ).trigger( "mousedown" ).trigger( "mouseup" ); - equals( 2, element.val(), "mouse - value does not change on clicking down button" ); + equal( 2, element.val(), "mouse - value does not change on clicking down button" ); element.spinner( "stepUp", 6 ); - equals( 8, element.val(), "script - stepUp 6 steps changes value"); + equal( 8, element.val(), "script - stepUp 6 steps changes value"); element.spinner( "stepDown" ); - equals( 7, element.val(), "script - stepDown 1 step changes value" ); + equal( 7, element.val(), "script - stepDown 1 step changes value" ); element.spinner( "pageUp" ); - equals( 17, element.val(), "script - pageUp 1 page changes value" ); + equal( 17, element.val(), "script - pageUp 1 page changes value" ); element.spinner( "pageDown" ); - equals( 7, element.val(), "script - pageDown 1 page changes value" ); + equal( 7, element.val(), "script - pageDown 1 page changes value" ); }); test( "enable", function() { @@ -66,7 +66,7 @@ test( "enable", function() { ok( !element.is( ":disabled" ), "after: input does not have disabled attribute" ); spinner_simulateKeyDownUp( element, $.ui.keyCode.UP ); - equals( 2, element.val(), "keyboard - value changes on key UP" ); + equal( 2, element.val(), "keyboard - value changes on key UP" ); }); test( "pageDown", function() { @@ -77,16 +77,16 @@ test( "pageDown", function() { }); element.spinner( "pageDown" ); - equals( element.val(), -32, "pageDown 1 page" ); + equal( element.val(), -32, "pageDown 1 page" ); element.spinner( "pageDown", 3 ); - equals( element.val(), -92, "pageDown 3 pages" ); + equal( element.val(), -92, "pageDown 3 pages" ); element.spinner( "pageDown" ); - equals( element.val(), -100, "value close to min and pageDown 1 page" ); + equal( element.val(), -100, "value close to min and pageDown 1 page" ); element.spinner( "pageDown", 10 ); - equals( element.val(), -100, "value at min and pageDown 10 pages" ); + equal( element.val(), -100, "value at min and pageDown 10 pages" ); }); test( "pageUp", function() { @@ -97,16 +97,16 @@ test( "pageUp", function() { }); element.spinner( "pageUp" ); - equals( element.val(), 32, "pageUp 1 page" ); + equal( element.val(), 32, "pageUp 1 page" ); element.spinner( "pageUp", 3 ); - equals( element.val(), 92, "pageUp 3 pages" ); + equal( element.val(), 92, "pageUp 3 pages" ); element.spinner( "pageUp" ); - equals( element.val(), 100, "value close to max and pageUp 1 page" ); + equal( element.val(), 100, "value close to max and pageUp 1 page" ); element.spinner( "pageUp", 10 ); - equals( element.val(), 100, "value at max and pageUp 10 pages" ); + equal( element.val(), 100, "value at max and pageUp 10 pages" ); }); test( "stepDown", function() { @@ -117,16 +117,16 @@ test( "stepDown", function() { }); element.spinner( "stepDown" ); - equals( element.val(), "-1", "stepDown 1 step" ); + equal( element.val(), "-1", "stepDown 1 step" ); element.spinner( "stepDown", 5 ); - equals( element.val(), "-11", "stepDown 5 steps" ); + equal( element.val(), "-11", "stepDown 5 steps" ); element.spinner( "stepDown", 4 ); - equals( element.val(), "-15", "close to min and stepDown 4 steps" ); + equal( element.val(), "-15", "close to min and stepDown 4 steps" ); element.spinner( "stepDown" ); - equals( element.val(), "-15", "at min and stepDown 1 step" ); + equal( element.val(), "-15", "at min and stepDown 1 step" ); }); test( "stepUp", function() { @@ -137,16 +137,16 @@ test( "stepUp", function() { }); element.spinner( "stepUp" ); - equals( element.val(), 2, "stepUp 1 step" ); + equal( element.val(), 2, "stepUp 1 step" ); element.spinner( "stepUp", 5 ); - equals( element.val(), 12, "stepUp 5 steps" ); + equal( element.val(), 12, "stepUp 5 steps" ); element.spinner( "stepUp", 4 ); - equals( element.val(), 16, "close to min and stepUp 4 steps" ); + equal( element.val(), 16, "close to min and stepUp 4 steps" ); element.spinner( "stepUp" ); - equals( element.val(), 16, "at max and stepUp 1 step" ); + equal( element.val(), 16, "at max and stepUp 1 step" ); }); test( "value", function() { @@ -156,9 +156,9 @@ test( "value", function() { }); element.spinner( "value", 10 ); - equals( element.val(), 9, "change value via value method" ); + equal( element.val(), 9, "change value via value method" ); - equals( element.spinner( "value" ), 9, "get value via value method" ); + equal( element.spinner( "value" ), 9, "get value via value method" ); }); })( jQuery ); diff --git a/tests/unit/spinner/spinner_options.js b/tests/unit/spinner/spinner_options.js index 0be59bd0770..cbad3f870bb 100644 --- a/tests/unit/spinner/spinner_options.js +++ b/tests/unit/spinner/spinner_options.js @@ -141,13 +141,13 @@ test( "currency, change", function() { test( "max", function() { expect( 3 ); var element = $( "#spin" ).val( 1000 ).spinner({ max: 100 }); - equals( element.val(), 1000, "value not constrained on init" ); + equal( element.val(), 1000, "value not constrained on init" ); element.spinner( "value", 1000 ); - equals( element.val(), 100, "max constrained in value method" ); + equal( element.val(), 100, "max constrained in value method" ); element.val( 1000 ).blur(); - equals( element.val(), 1000, "max not constrained if manual entry" ); + equal( element.val(), 1000, "max not constrained if manual entry" ); }); test( "max, string", function() { @@ -159,23 +159,23 @@ test( "max, string", function() { numberFormat: "C", culture: "en" }); - equals( element.val(), "$1,000.00", "value not constrained on init" ); - equals( element.spinner( "option", "max" ), 100, "option converted to number" ); + equal( element.val(), "$1,000.00", "value not constrained on init" ); + equal( element.spinner( "option", "max" ), 100, "option converted to number" ); element.spinner( "value", 1000 ); - equals( element.val(), "$100.00", "max constrained in value method" ); + equal( element.val(), "$100.00", "max constrained in value method" ); }); test( "min", function() { expect( 3 ); var element = $( "#spin" ).val( -1000 ).spinner({ min: -100 }); - equals( element.val(), -1000, "value not constrained on init" ); + equal( element.val(), -1000, "value not constrained on init" ); element.spinner( "value", -1000 ); - equals( element.val(), -100, "min constrained in value method" ); + equal( element.val(), -100, "min constrained in value method" ); element.val( -1000 ).blur(); - equals( element.val(), -1000, "min not constrained if manual entry" ); + equal( element.val(), -1000, "min not constrained if manual entry" ); }); test( "min, string", function() { @@ -187,11 +187,11 @@ test( "min, string", function() { numberFormat: "C", culture: "en" }); - equals( element.val(), "($1,000.00)", "value not constrained on init" ); - equals( element.spinner( "option", "min" ), -100, "option converted to number" ); + equal( element.val(), "($1,000.00)", "value not constrained on init" ); + equal( element.spinner( "option", "min" ), -100, "option converted to number" ); element.spinner( "value", -1000 ); - equals( element.val(), "($100.00)", "min constrained in value method") + equal( element.val(), "($100.00)", "min constrained in value method") }); test( "step, 2", function() { @@ -199,14 +199,14 @@ test( "step, 2", function() { var element = $( "#spin" ).val( 0 ).spinner({ step: 2 }); element.spinner( "stepUp" ); - equals( element.val(), "2", "stepUp" ); + equal( element.val(), "2", "stepUp" ); element.spinner( "value", "10.5" ); - equals( element.val(), "10", "value reset to 10" ); + equal( element.val(), "10", "value reset to 10" ); element.val( "4.5" ); element.spinner( "stepUp" ); - equals( element.val(), "6", "stepUp" ); + equal( element.val(), "6", "stepUp" ); }); test( "step, 0.7", function() { @@ -216,7 +216,7 @@ test( "step, 0.7", function() { }); element.spinner( "stepUp" ); - equals( element.val(), "0.7", "stepUp" ); + equal( element.val(), "0.7", "stepUp" ); }); test( "step, string", function() { @@ -227,10 +227,10 @@ test( "step, string", function() { culture: "en" }); - equals( element.spinner( "option", "step" ), 0.7, "option converted to number" ); + equal( element.spinner( "option", "step" ), 0.7, "option converted to number" ); element.spinner( "stepUp" ); - equals( element.val(), "$0.70", "stepUp" ); + equal( element.val(), "$0.70", "stepUp" ); }); })( jQuery ); diff --git a/tests/unit/tabs/tabs.html b/tests/unit/tabs/tabs.html index f2a672b2e4e..fc494e0137a 100644 --- a/tests/unit/tabs/tabs.html +++ b/tests/unit/tabs/tabs.html @@ -49,7 +49,7 @@ } return -1; // mixed state - invalid }).get(); - same( actual, expected ); + deepEqual( actual, expected ); } function tabs_disabled( tabs, state ) { @@ -83,8 +83,8 @@ } return -1; // mixed state - invalid }).get(); - same( tabs.tabs( "option", "disabled" ), state ); - same( actual, expected ); + deepEqual( tabs.tabs( "option", "disabled" ), state ); + deepEqual( actual, expected ); } diff --git a/tests/unit/tabs/tabs_core.js b/tests/unit/tabs/tabs_core.js index e7c1ee57649..263032921b7 100644 --- a/tests/unit/tabs/tabs_core.js +++ b/tests/unit/tabs/tabs_core.js @@ -31,15 +31,15 @@ test( "nested list", function() { expect( 1 ); var element = $( "#tabs6" ).tabs(); - equals( element.data( "tabs" ).anchors.length, 2, "should contain 2 tab" ); + equal( element.data( "tabs" ).anchors.length, 2, "should contain 2 tab" ); }); test( "disconnected from DOM", function() { expect( 2 ); var element = $( "#tabs1" ).remove().tabs(); - equals( element.find( ".ui-tabs-nav" ).length, 1, "should initialize nav" ); - equals( element.find( ".ui-tabs-panel" ).length, 3, "should initialize panels" ); + equal( element.find( ".ui-tabs-nav" ).length, 1, "should initialize nav" ); + equal( element.find( ".ui-tabs-panel" ).length, 3, "should initialize panels" ); }); test( "aria-controls", function() { @@ -87,7 +87,7 @@ test( "#4033 - IE expands hash to full url and misinterprets tab as ajax", funct } }); - equals( element.find( ".ui-tabs-nav a" ).attr( "aria-controls" ), "tab", "aria-contorls attribute is correct" ); + equal( element.find( ".ui-tabs-nav a" ).attr( "aria-controls" ), "tab", "aria-contorls attribute is correct" ); tabs_state( element, 1 ); }); diff --git a/tests/unit/tabs/tabs_deprecated.html b/tests/unit/tabs/tabs_deprecated.html index 92d9be81c92..410aebc40be 100644 --- a/tests/unit/tabs/tabs_deprecated.html +++ b/tests/unit/tabs/tabs_deprecated.html @@ -48,7 +48,7 @@ } return -1; // mixed state - invalid }).get(); - same( actual, expected ); + deepEqual( actual, expected ); } function tabs_disabled( tabs, state ) { @@ -82,8 +82,8 @@ } return -1; // mixed state - invalid }).get(); - same( tabs.tabs( "option", "disabled" ), state ); - same( actual, expected ); + deepEqual( tabs.tabs( "option", "disabled" ), state ); + deepEqual( actual, expected ); } diff --git a/tests/unit/tabs/tabs_deprecated.js b/tests/unit/tabs/tabs_deprecated.js index d0d13fa8476..80bc4a326da 100644 --- a/tests/unit/tabs/tabs_deprecated.js +++ b/tests/unit/tabs/tabs_deprecated.js @@ -35,7 +35,7 @@ asyncTest( "ajaxOptions", function() { } }); element.one( "tabsload", function( event, ui ) { - equals( $( ui.panel ).html(), "test" ); + equal( $( ui.panel ).html(), "test" ); start(); }); element.tabs( "option", "active", 2 ); @@ -56,7 +56,7 @@ asyncTest( "cache", function() { setTimeout(function() { element.tabs( "option", "active", 0 ); tabs_state( element, 1, 0, 0, 0, 0 ); - + element.one( "tabsshow", function( event, ui ) { tabs_state( element, 0, 0, 1, 0, 0 ); }); @@ -105,10 +105,10 @@ test( "tabTemplate + panelTemplate", function() { element.tabs( "add", "#new", "New" ); var tab = element.find( ".ui-tabs-nav li" ).last(), anchor = tab.find( "a" ); - equals( tab.text(), "New", "label" ); + equal( tab.text(), "New", "label" ); ok( tab.hasClass( "customTab" ), "tab custom class" ); - equals( anchor.attr( "href" ), "http://example.com/#new", "href" ); - equals( anchor.attr( "aria-controls" ), "new", "aria-controls" ); + equal( anchor.attr( "href" ), "http://example.com/#new", "href" ); + equal( anchor.attr( "aria-controls" ), "new", "aria-controls" ); ok( element.find( "#new" ).hasClass( "customPanel" ), "panel custom class" ); }); @@ -124,24 +124,24 @@ test( "cookie", function() { } element.tabs({ cookie: cookieObj }); - equals( cookie(), 0, "initial cookie value" ); + equal( cookie(), 0, "initial cookie value" ); element.tabs( "destroy" ); element.tabs({ active: 1, cookie: cookieObj }); - equals( cookie(), 1, "initial cookie value, from active property" ); + equal( cookie(), 1, "initial cookie value, from active property" ); element.tabs( "option", "active", 2 ); - equals( cookie(), 2, "cookie value updated after activating" ); + equal( cookie(), 2, "cookie value updated after activating" ); element.tabs( "destroy" ); $.cookie( cookieName, 1 ); element.tabs({ cookie: cookieObj }); - equals( cookie(), 1, "initial cookie value, from existing cookie" ); + equal( cookie(), 1, "initial cookie value, from existing cookie" ); element.tabs( "destroy" ); element.tabs({ cookie: cookieObj, collapsible: true }); element.tabs( "option", "active", false ); - equals( cookie(), -1, "cookie value for all tabs unselected" ); + equal( cookie(), -1, "cookie value for all tabs unselected" ); element.tabs( "destroy" ); ok( $.cookie( cookieName ) === null, "erase cookie after destroy" ); @@ -153,12 +153,12 @@ asyncTest( "spinner", function() { var element = $( "#tabs2" ).tabs(); element.one( "tabsbeforeload", function( event, ui ) { - equals( element.find( ".ui-tabs-nav li:eq(2) em" ).length, 1, "beforeload" ); + equal( element.find( ".ui-tabs-nav li:eq(2) em" ).length, 1, "beforeload" ); }); element.one( "tabsload", function( event, ui ) { // wait until after the load finishes before checking for the spinner to be removed setTimeout(function() { - equals( element.find( ".ui-tabs-nav li:eq(2) em" ).length, 0, "load" ); + equal( element.find( ".ui-tabs-nav li:eq(2) em" ).length, 0, "load" ); start(); }, 1 ); }); @@ -169,13 +169,13 @@ test( "selected", function() { expect( 19 ); var element = $( "#tabs1" ).tabs(); - equals( element.tabs( "option", "selected" ), 0, "should be 0 by default" ); + equal( element.tabs( "option", "selected" ), 0, "should be 0 by default" ); tabs_state( element, 1, 0, 0 ); element.tabs( "destroy" ); location.hash = "#fragment-3"; element = $( "#tabs1" ).tabs(); - equals( element.tabs( "option", "selected" ), 2, "should be 2 based on URL" ); + equal( element.tabs( "option", "selected" ), 2, "should be 2 based on URL" ); tabs_state( element, 0, 0, 1 ); element.tabs( "destroy" ); @@ -200,19 +200,19 @@ test( "selected", function() { element.tabs( "destroy" ); element.tabs({ selected: 2 }); - equals( element.tabs( "option", "selected" ), 2 ); + equal( element.tabs( "option", "selected" ), 2 ); tabs_state( element, 0, 0, 1 ); element.tabs( "option", "selected", 0 ); - equals( element.tabs( "option", "selected" ), 0 ); + equal( element.tabs( "option", "selected" ), 0 ); tabs_state( element, 1, 0, 0 ); element.find( ".ui-tabs-nav a" ).eq( 1 ).click(); - equals( element.tabs( "option", "selected" ), 1 ); + equal( element.tabs( "option", "selected" ), 1 ); tabs_state( element, 0, 1, 0 ); element.tabs( "option", "selected", 10 ); - equals( element.tabs( "option", "selected" ), 1 ); + equal( element.tabs( "option", "selected" ), 1 ); tabs_state( element, 0, 1, 0 ); location.hash = "#"; @@ -235,7 +235,7 @@ asyncTest( "load", function() { ok( !( "originalEvent" in event ), "originalEvent" ); strictEqual( ui.tab, tab[ 0 ], "tab" ); strictEqual( ui.panel, panel[ 0 ], "panel" ); - equals( $( ui.panel ).find( "p" ).length, 1, "panel html" ); + equal( $( ui.panel ).find( "p" ).length, 1, "panel html" ); tabs_state( element, 0, 0, 1, 0, 0 ); tabsload1(); }); @@ -251,7 +251,7 @@ asyncTest( "load", function() { ok( !( "originalEvent" in event ), "originalEvent" ); strictEqual( ui.tab, tab[ 0 ], "tab" ); strictEqual( ui.panel, panel[ 0 ], "panel" ); - equals( $( ui.panel ).find( "p" ).length, 1, "panel html" ); + equal( $( ui.panel ).find( "p" ).length, 1, "panel html" ); tabs_state( element, 0, 0, 0, 1, 0 ); tabsload2(); }); @@ -265,10 +265,10 @@ asyncTest( "load", function() { panelId = tab.attr( "aria-controls" ); panel = $( "#" + panelId ); - equals( event.originalEvent.type, "click", "originalEvent" ); + equal( event.originalEvent.type, "click", "originalEvent" ); strictEqual( ui.tab, tab[ 0 ], "tab" ); strictEqual( ui.panel, panel[ 0 ], "panel" ); - equals( $( ui.panel ).find( "p" ).length, 1, "panel html" ); + equal( $( ui.panel ).find( "p" ).length, 1, "panel html" ); tabs_state( element, 0, 0, 0, 0, 1 ); start(); }); @@ -282,9 +282,9 @@ test( "enable", function() { var element = $( "#tabs1" ).tabs({ disabled: [ 0, 1 ], enable: function( event, ui ) { - equals( ui.tab, element.find( ".ui-tabs-nav a" )[ 1 ], "ui.tab" ); - equals( ui.panel, element.find( ".ui-tabs-panel" )[ 1 ], "ui.panel" ); - equals( ui.index, 1, "ui.index" ); + equal( ui.tab, element.find( ".ui-tabs-nav a" )[ 1 ], "ui.tab" ); + equal( ui.panel, element.find( ".ui-tabs-panel" )[ 1 ], "ui.panel" ); + equal( ui.index, 1, "ui.index" ); } }); element.tabs( "enable", 1 ); @@ -297,9 +297,9 @@ test( "disable", function() { var element = $( "#tabs1" ).tabs({ disable: function( event, ui ) { - equals( ui.tab, element.find( ".ui-tabs-nav a" )[ 1 ], "ui.tab" ); - equals( ui.panel, element.find( ".ui-tabs-panel" )[ 1 ], "ui.panel" ); - equals( ui.index, 1, "ui.index" ); + equal( ui.tab, element.find( ".ui-tabs-nav a" )[ 1 ], "ui.tab" ); + equal( ui.panel, element.find( ".ui-tabs-panel" )[ 1 ], "ui.panel" ); + equal( ui.index, 1, "ui.index" ); } }); element.tabs( "disable", 1 ); @@ -331,7 +331,7 @@ test( "show", function() { // switching tabs element.one( "tabsshow", function( event, ui ) { - equals( event.originalEvent.type, "click", "originalEvent" ); + equal( event.originalEvent.type, "click", "originalEvent" ); strictEqual( ui.tab, tabs[ 1 ], "ui.tab" ); strictEqual( ui.panel, panels[ 1 ], "ui.panel" ); equal( ui.index, 1, "ui.index" ); @@ -371,7 +371,7 @@ test( "select", function() { // switching tabs element.one( "tabsselect", function( event, ui ) { - equals( event.originalEvent.type, "click", "originalEvent" ); + equal( event.originalEvent.type, "click", "originalEvent" ); strictEqual( ui.tab, tabs[ 1 ], "ui.tab" ); strictEqual( ui.panel, panels[ 1 ], "ui.panel" ); equal( ui.index, 1, "ui.index" ); @@ -406,9 +406,9 @@ test( "add", function() { tabs_state( element, 1, 0, 0, 0 ); var tab = element.find( ".ui-tabs-nav li" ).last(), anchor = tab.find( "a" ); - equals( tab.text(), "New", "label" ); - equals( anchor.attr( "href" ), "#new", "href" ); - equals( anchor.attr( "aria-controls" ), "new", "aria-controls" ); + equal( tab.text(), "New", "label" ); + equal( anchor.attr( "href" ), "#new", "href" ); + equal( anchor.attr( "aria-controls" ), "new", "aria-controls" ); ok( !tab.hasClass( "ui-state-hover" ), "not hovered" ); anchor.simulate( "mouseover" ); ok( tab.hasClass( "ui-state-hover" ), "hovered" ); @@ -425,8 +425,8 @@ test( "add", function() { tabs_state( element, 0, 0, 0, 0, 1 ); tab = element.find( ".ui-tabs-nav li" ).eq( 1 ); anchor = tab.find( "a" ); - equals( tab.text(), "New Remote", "label" ); - equals( anchor.attr( "href" ), "data/test.html", "href" ); + equal( tab.text(), "New Remote", "label" ); + equal( anchor.attr( "href" ), "data/test.html", "href" ); ok( /^ui-tabs-\d+$/.test( anchor.attr( "aria-controls" ) ), "aria controls" ); ok( !tab.hasClass( "ui-state-hover" ), "not hovered" ); anchor.simulate( "mouseover" ); @@ -436,7 +436,7 @@ test( "add", function() { // add to empty tab set element = $( "
        " ).tabs(); - equals( element.tabs( "option", "active" ), false, "active: false on init" ); + equal( element.tabs( "option", "active" ), false, "active: false on init" ); element.one( "tabsadd", function( event, ui ) { equal( ui.index, 0, "ui.index" ); equal( $( ui.tab ).text(), "First", "ui.tab" ); @@ -444,16 +444,16 @@ test( "add", function() { }); element.tabs( "add", "#first", "First" ); tabs_state( element, 1 ); - equals( element.tabs( "option", "active" ), 0, "active: 0 after add" ); + equal( element.tabs( "option", "active" ), 0, "active: 0 after add" ); }); test( "#5069 - ui.tabs.add creates two tab panels when using a full URL", function() { expect( 2 ); var element = $( "#tabs2" ).tabs(); - equals( element.children( "div" ).length, element.find( ".ui-tabs-nav li" ).length ); + equal( element.children( "div" ).length, element.find( ".ui-tabs-nav li" ).length ); element.tabs( "add", "/new", "New" ); - equals( element.children( "div" ).length, element.find( ".ui-tabs-nav li" ).length ); + equal( element.children( "div" ).length, element.find( ".ui-tabs-nav li" ).length ); }); test( "remove", function() { @@ -469,10 +469,10 @@ test( "remove", function() { }); element.tabs( "remove", 1 ); tabs_state( element, 0, 1 ); - equals( element.tabs( "option", "active" ), 1 ); - equals( element.find( ".ui-tabs-nav li a[href$='fragment-2']" ).length, 0, + equal( element.tabs( "option", "active" ), 1 ); + equal( element.find( ".ui-tabs-nav li a[href$='fragment-2']" ).length, 0, "remove correct list item" ); - equals( element.find( "#fragment-2" ).length, 0, "remove correct panel" ); + equal( element.find( "#fragment-2" ).length, 0, "remove correct panel" ); element.one( "tabsremove", function( event, ui ) { equal( ui.index, -1, "ui.index" ); @@ -481,7 +481,7 @@ test( "remove", function() { }); element.tabs( "remove", 1 ); tabs_state( element, 1 ); - equals( element.tabs( "option", "active"), 0 ); + equal( element.tabs( "option", "active"), 0 ); element.one( "tabsremove", function( event, ui ) { equal( ui.index, -1, "ui.index" ); @@ -489,7 +489,7 @@ test( "remove", function() { equal( ui.panel.id, "fragment-1", "ui.panel" ); }); element.tabs( "remove", 0 ); - equals( element.tabs( "option", "active" ), false ); + equal( element.tabs( "option", "active" ), false ); }); test( "select", function() { @@ -499,49 +499,49 @@ test( "select", function() { tabs_state( element, 1, 0, 0 ); element.tabs( "select", 1 ); tabs_state( element, 0, 1, 0 ); - equals( element.tabs( "option", "active" ), 1, "active" ); - equals( element.tabs( "option", "selected" ), 1, "selected" ); + equal( element.tabs( "option", "active" ), 1, "active" ); + equal( element.tabs( "option", "selected" ), 1, "selected" ); element.tabs( "destroy" ); element.tabs({ collapsible: true }); tabs_state( element, 1, 0, 0 ); element.tabs( "select", 0 ); tabs_state( element, 0, 0, 0 ); - equals( element.tabs( "option", "active" ), false, "active" ); - equals( element.tabs( "option", "selected" ), -1, "selected" ); + equal( element.tabs( "option", "active" ), false, "active" ); + equal( element.tabs( "option", "selected" ), -1, "selected" ); element.tabs( "destroy" ); element.tabs({ collapsible: true }); element.tabs( "select", -1 ); tabs_state( element, 0, 0, 0 ); - equals( element.tabs( "option", "active" ), false, "active" ); - equals( element.tabs( "option", "selected" ), -1, "selected" ); + equal( element.tabs( "option", "active" ), false, "active" ); + equal( element.tabs( "option", "selected" ), -1, "selected" ); element.tabs( "destroy" ); element.tabs(); tabs_state( element, 1, 0, 0 ); - equals( element.tabs( "option", "active" ), 0, "active" ); - equals( element.tabs( "option", "selected" ), 0, "selected" ); + equal( element.tabs( "option", "active" ), 0, "active" ); + equal( element.tabs( "option", "selected" ), 0, "selected" ); element.tabs( "select", 0 ); tabs_state( element, 1, 0, 0 ); - equals( element.tabs( "option", "active" ), 0, "active" ); - equals( element.tabs( "option", "selected" ), 0, "selected" ); + equal( element.tabs( "option", "active" ), 0, "active" ); + equal( element.tabs( "option", "selected" ), 0, "selected" ); element.tabs( "select", -1 ); tabs_state( element, 1, 0, 0 ); - equals( element.tabs( "option", "active" ), 0, "active" ); - equals( element.tabs( "option", "selected" ), 0, "selected" ); + equal( element.tabs( "option", "active" ), 0, "active" ); + equal( element.tabs( "option", "selected" ), 0, "selected" ); element.tabs( "select", "#fragment-2" ); tabs_state( element, 0, 1, 0 ); - equals( element.tabs( "option", "active" ), 1, "active" ); - equals( element.tabs( "option", "selected" ), 1, "selected" ); + equal( element.tabs( "option", "active" ), 1, "active" ); + equal( element.tabs( "option", "selected" ), 1, "selected" ); }); test( "length", function() { expect( 2 ); - equals( $( "#tabs1" ).tabs().tabs( "length" ), 3, "basic tabs" ); - equals( $( "#tabs2" ).tabs().tabs( "length" ), 5, "ajax tabs with missing panels" ); + equal( $( "#tabs1" ).tabs().tabs( "length" ), 3, "basic tabs" ); + equal( $( "#tabs2" ).tabs().tabs( "length" ), 5, "ajax tabs with missing panels" ); }); test( "url", function() { @@ -551,9 +551,9 @@ test( "url", function() { tab = element.find( "a" ).eq( 3 ); element.tabs( "url", 3, "data/test2.html" ); - equals( tab.attr( "href" ), "data/test2.html", "href was updated" ); + equal( tab.attr( "href" ), "data/test2.html", "href was updated" ); element.one( "tabsbeforeload", function( event, ui ) { - equals( ui.ajaxSettings.url, "data/test2.html", "ajaxSettings.url" ); + equal( ui.ajaxSettings.url, "data/test2.html", "ajaxSettings.url" ); event.preventDefault(); }); element.tabs( "option", "active", 3 ); @@ -565,7 +565,7 @@ asyncTest( "abort", function() { var element = $( "#tabs2" ).tabs(); element.one( "tabsbeforeload", function( event, ui ) { ui.jqXHR.error(function( jqXHR, status ) { - equals( status, "abort", "aborted" ); + equal( status, "abort", "aborted" ); start(); }); }); diff --git a/tests/unit/tabs/tabs_events.js b/tests/unit/tabs/tabs_events.js index 3335789079e..4f9269b62d3 100644 --- a/tests/unit/tabs/tabs_events.js +++ b/tests/unit/tabs/tabs_events.js @@ -11,9 +11,9 @@ test( "create", function() { element.tabs({ create: function( event, ui ) { - equals( ui.tab.size(), 1, "tab size" ); + equal( ui.tab.size(), 1, "tab size" ); strictEqual( ui.tab[ 0 ], tabs[ 0 ], "tab" ); - equals( ui.panel.size(), 1, "panel size" ); + equal( ui.panel.size(), 1, "panel size" ); strictEqual( ui.panel[ 0 ], panels[ 0 ], "panel" ); } }); @@ -22,9 +22,9 @@ test( "create", function() { element.tabs({ active: 2, create: function( event, ui ) { - equals( ui.tab.size(), 1, "tab size" ); + equal( ui.tab.size(), 1, "tab size" ); strictEqual( ui.tab[ 0 ], tabs[ 2 ], "tab" ); - equals( ui.panel.size(), 1, "panel size" ); + equal( ui.panel.size(), 1, "panel size" ); strictEqual( ui.panel[ 0 ], panels[ 2 ], "panel" ); } }); @@ -34,8 +34,8 @@ test( "create", function() { active: false, collapsible: true, create: function( event, ui ) { - equals( ui.tab.size(), 0, "tab size" ); - equals( ui.panel.size(), 0, "panel size" ); + equal( ui.tab.size(), 0, "tab size" ); + equal( ui.panel.size(), 0, "panel size" ); } }); element.tabs( "destroy" ); @@ -54,11 +54,11 @@ test( "beforeActivate", function() { // from collapsed element.one( "tabsbeforeactivate", function( event, ui ) { ok( !( "originalEvent" in event ), "originalEvent" ); - equals( ui.oldTab.size(), 0, "oldTab size" ); - equals( ui.oldPanel.size(), 0, "oldPanel size" ); - equals( ui.newTab.size(), 1, "newTab size" ); + equal( ui.oldTab.size(), 0, "oldTab size" ); + equal( ui.oldPanel.size(), 0, "oldPanel size" ); + equal( ui.newTab.size(), 1, "newTab size" ); strictEqual( ui.newTab[ 0 ], tabs[ 0 ], "newTab" ); - equals( ui.newPanel.size(), 1, "newPanel size" ); + equal( ui.newPanel.size(), 1, "newPanel size" ); strictEqual( ui.newPanel[ 0 ], panels[ 0 ], "newPanel" ); tabs_state( element, 0, 0, 0 ); }); @@ -67,14 +67,14 @@ test( "beforeActivate", function() { // switching tabs element.one( "tabsbeforeactivate", function( event, ui ) { - equals( event.originalEvent.type, "click", "originalEvent" ); - equals( ui.oldTab.size(), 1, "oldTab size" ); + equal( event.originalEvent.type, "click", "originalEvent" ); + equal( ui.oldTab.size(), 1, "oldTab size" ); strictEqual( ui.oldTab[ 0 ], tabs[ 0 ], "oldTab" ); - equals( ui.oldPanel.size(), 1, "oldPanel size" ); + equal( ui.oldPanel.size(), 1, "oldPanel size" ); strictEqual( ui.oldPanel[ 0 ], panels[ 0 ], "oldPanel" ); - equals( ui.newTab.size(), 1, "newTab size" ); + equal( ui.newTab.size(), 1, "newTab size" ); strictEqual( ui.newTab[ 0 ], tabs[ 1 ], "newTab" ); - equals( ui.newPanel.size(), 1, "newPanel size" ); + equal( ui.newPanel.size(), 1, "newPanel size" ); strictEqual( ui.newPanel[ 0 ], panels[ 1 ], "newPanel" ); tabs_state( element, 1, 0, 0 ); }); @@ -84,12 +84,12 @@ test( "beforeActivate", function() { // collapsing element.one( "tabsbeforeactivate", function( event, ui ) { ok( !( "originalEvent" in event ), "originalEvent" ); - equals( ui.oldTab.size(), 1, "oldTab size" ); + equal( ui.oldTab.size(), 1, "oldTab size" ); strictEqual( ui.oldTab[ 0 ], tabs[ 1 ], "oldTab" ); - equals( ui.oldPanel.size(), 1, "oldPanel size" ); + equal( ui.oldPanel.size(), 1, "oldPanel size" ); strictEqual( ui.oldPanel[ 0 ], panels[ 1 ], "oldPanel" ); - equals( ui.newTab.size(), 0, "newTab size" ); - equals( ui.newPanel.size(), 0, "newPanel size" ); + equal( ui.newTab.size(), 0, "newTab size" ); + equal( ui.newPanel.size(), 0, "newPanel size" ); tabs_state( element, 0, 1, 0 ); }); element.tabs( "option", "active", false ); @@ -98,11 +98,11 @@ test( "beforeActivate", function() { // prevent activation element.one( "tabsbeforeactivate", function( event, ui ) { ok( !( "originalEvent" in event ), "originalEvent" ); - equals( ui.oldTab.size(), 0, "oldTab size" ); - equals( ui.oldPanel.size(), 0, "oldTab" ); - equals( ui.newTab.size(), 1, "newTab size" ); + equal( ui.oldTab.size(), 0, "oldTab size" ); + equal( ui.oldPanel.size(), 0, "oldTab" ); + equal( ui.newTab.size(), 1, "newTab size" ); strictEqual( ui.newTab[ 0 ], tabs[ 1 ], "newTab" ); - equals( ui.newPanel.size(), 1, "newPanel size" ); + equal( ui.newPanel.size(), 1, "newPanel size" ); strictEqual( ui.newPanel[ 0 ], panels[ 1 ], "newPanel" ); event.preventDefault(); tabs_state( element, 0, 0, 0 ); @@ -124,11 +124,11 @@ test( "activate", function() { // from collapsed element.one( "tabsactivate", function( event, ui ) { ok( !( "originalEvent" in event ), "originalEvent" ); - equals( ui.oldTab.size(), 0, "oldTab size" ); - equals( ui.oldPanel.size(), 0, "oldPanel size" ); - equals( ui.newTab.size(), 1, "newTab size" ); + equal( ui.oldTab.size(), 0, "oldTab size" ); + equal( ui.oldPanel.size(), 0, "oldPanel size" ); + equal( ui.newTab.size(), 1, "newTab size" ); strictEqual( ui.newTab[ 0 ], tabs[ 0 ], "newTab" ); - equals( ui.newPanel.size(), 1, "newPanel size" ); + equal( ui.newPanel.size(), 1, "newPanel size" ); strictEqual( ui.newPanel[ 0 ], panels[ 0 ], "newPanel" ); tabs_state( element, 1, 0, 0 ); }); @@ -137,14 +137,14 @@ test( "activate", function() { // switching tabs element.one( "tabsactivate", function( event, ui ) { - equals( event.originalEvent.type, "click", "originalEvent" ); - equals( ui.oldTab.size(), 1, "oldTab size" ); + equal( event.originalEvent.type, "click", "originalEvent" ); + equal( ui.oldTab.size(), 1, "oldTab size" ); strictEqual( ui.oldTab[ 0 ], tabs[ 0 ], "oldTab" ); - equals( ui.oldPanel.size(), 1, "oldPanel size" ); + equal( ui.oldPanel.size(), 1, "oldPanel size" ); strictEqual( ui.oldPanel[ 0 ], panels[ 0 ], "oldPanel" ); - equals( ui.newTab.size(), 1, "newTab size" ); + equal( ui.newTab.size(), 1, "newTab size" ); strictEqual( ui.newTab[ 0 ], tabs[ 1 ], "newTab" ); - equals( ui.newPanel.size(), 1, "newPanel size" ); + equal( ui.newPanel.size(), 1, "newPanel size" ); strictEqual( ui.newPanel[ 0 ], panels[ 1 ], "newPanel" ); tabs_state( element, 0, 1, 0 ); }); @@ -154,12 +154,12 @@ test( "activate", function() { // collapsing element.one( "tabsactivate", function( event, ui ) { ok( !( "originalEvent" in event ), "originalEvent" ); - equals( ui.oldTab.size(), 1, "oldTab size" ); + equal( ui.oldTab.size(), 1, "oldTab size" ); strictEqual( ui.oldTab[ 0 ], tabs[ 1 ], "oldTab" ); - equals( ui.oldPanel.size(), 1, "oldPanel size" ); + equal( ui.oldPanel.size(), 1, "oldPanel size" ); strictEqual( ui.oldPanel[ 0 ], panels[ 1 ], "oldPanel" ); - equals( ui.newTab.size(), 0, "newTab size" ); - equals( ui.newPanel.size(), 0, "newPanel size" ); + equal( ui.newTab.size(), 0, "newTab size" ); + equal( ui.newPanel.size(), 0, "newPanel size" ); tabs_state( element, 0, 0, 0 ); }); element.tabs( "option", "active", false ); @@ -191,17 +191,17 @@ test( "beforeLoad", function() { ok( !( "originalEvent" in event ), "originalEvent" ); ok( "abort" in ui.jqXHR, "jqXHR" ); ok( ui.ajaxSettings.url, "data/test.html", "ajaxSettings.url" ); - equals( ui.tab.size(), 1, "tab size" ); + equal( ui.tab.size(), 1, "tab size" ); strictEqual( ui.tab[ 0 ], tab[ 0 ], "tab" ); - equals( ui.panel.size(), 1, "panel size" ); + equal( ui.panel.size(), 1, "panel size" ); strictEqual( ui.panel[ 0 ], panel[ 0 ], "panel" ); - equals( ui.panel.html(), "", "panel html" ); + equal( ui.panel.html(), "", "panel html" ); event.preventDefault(); tabs_state( element, 0, 0, 1, 0, 0 ); }); element.tabs({ active: 2 }); tabs_state( element, 0, 0, 1, 0, 0 ); - equals( panel.html(), "", "panel html after" ); + equal( panel.html(), "", "panel html after" ); element.tabs( "destroy" ); // .option() @@ -213,18 +213,18 @@ test( "beforeLoad", function() { ok( !( "originalEvent" in event ), "originalEvent" ); ok( "abort" in ui.jqXHR, "jqXHR" ); ok( ui.ajaxSettings.url, "data/test.html", "ajaxSettings.url" ); - equals( ui.tab.size(), 1, "tab size" ); + equal( ui.tab.size(), 1, "tab size" ); strictEqual( ui.tab[ 0 ], tab[ 0 ], "tab" ); - equals( ui.panel.size(), 1, "panel size" ); + equal( ui.panel.size(), 1, "panel size" ); strictEqual( ui.panel[ 0 ], panel[ 0 ], "panel" ); - equals( ui.panel.html(), "", "panel html" ); + equal( ui.panel.html(), "", "panel html" ); event.preventDefault(); tabs_state( element, 1, 0, 0, 0, 0 ); }); element.tabs(); element.tabs( "option", "active", 2 ); tabs_state( element, 0, 0, 1, 0, 0 ); - equals( panel.html(), "", "panel html after" ); + equal( panel.html(), "", "panel html after" ); // click, change panel content element.one( "tabsbeforeload", function( event, ui ) { @@ -232,12 +232,12 @@ test( "beforeLoad", function() { panelId = tab.attr( "aria-controls" ); panel = $( "#" + panelId ); - equals( event.originalEvent.type, "click", "originalEvent" ); + equal( event.originalEvent.type, "click", "originalEvent" ); ok( "abort" in ui.jqXHR, "jqXHR" ); ok( ui.ajaxSettings.url, "data/test.html", "ajaxSettings.url" ); - equals( ui.tab.size(), 1, "tab size" ); + equal( ui.tab.size(), 1, "tab size" ); strictEqual( ui.tab[ 0 ], tab[ 0 ], "tab" ); - equals( ui.panel.size(), 1, "panel size" ); + equal( ui.panel.size(), 1, "panel size" ); strictEqual( ui.panel[ 0 ], panel[ 0 ], "panel" ); ui.panel.html( "

        testing

        " ); event.preventDefault(); @@ -246,7 +246,7 @@ test( "beforeLoad", function() { element.find( ".ui-tabs-nav a" ).eq( 3 ).click(); tabs_state( element, 0, 0, 0, 1, 0 ); // .toLowerCase() is needed to convert

        to

        in old IEs - equals( panel.html().toLowerCase(), "

        testing

        ", "panel html after" ); + equal( panel.html().toLowerCase(), "

        testing

        ", "panel html after" ); }); if ( $.uiBackCompat === false ) { @@ -261,13 +261,13 @@ if ( $.uiBackCompat === false ) { tab = element.find( ".ui-tabs-nav a" ).eq( 2 ); panelId = tab.attr( "aria-controls" ); panel = $( "#" + panelId ); - + ok( !( "originalEvent" in event ), "originalEvent" ); - equals( ui.tab.size(), 1, "tab size" ); + equal( ui.tab.size(), 1, "tab size" ); strictEqual( ui.tab[ 0 ], tab[ 0 ], "tab" ); - equals( ui.panel.size(), 1, "panel size" ); + equal( ui.panel.size(), 1, "panel size" ); strictEqual( ui.panel[ 0 ], panel[ 0 ], "panel" ); - equals( ui.panel.find( "p" ).length, 1, "panel html" ); + equal( ui.panel.find( "p" ).length, 1, "panel html" ); tabs_state( element, 0, 0, 1, 0, 0 ); tabsload1(); }); @@ -281,11 +281,11 @@ if ( $.uiBackCompat === false ) { panel = $( "#" + panelId ); ok( !( "originalEvent" in event ), "originalEvent" ); - equals( ui.tab.size(), 1, "tab size" ); + equal( ui.tab.size(), 1, "tab size" ); strictEqual( ui.tab[ 0 ], tab[ 0 ], "tab" ); - equals( ui.panel.size(), 1, "panel size" ); + equal( ui.panel.size(), 1, "panel size" ); strictEqual( ui.panel[ 0 ], panel[ 0 ], "panel" ); - equals( ui.panel.find( "p" ).length, 1, "panel html" ); + equal( ui.panel.find( "p" ).length, 1, "panel html" ); tabs_state( element, 0, 0, 0, 1, 0 ); tabsload2(); }); @@ -299,12 +299,12 @@ if ( $.uiBackCompat === false ) { panelId = tab.attr( "aria-controls" ); panel = $( "#" + panelId ); - equals( event.originalEvent.type, "click", "originalEvent" ); - equals( ui.tab.size(), 1, "tab size" ); + equal( event.originalEvent.type, "click", "originalEvent" ); + equal( ui.tab.size(), 1, "tab size" ); strictEqual( ui.tab[ 0 ], tab[ 0 ], "tab" ); - equals( ui.panel.size(), 1, "panel size" ); + equal( ui.panel.size(), 1, "panel size" ); strictEqual( ui.panel[ 0 ], panel[ 0 ], "panel" ); - equals( ui.panel.find( "p" ).length, 1, "panel html" ); + equal( ui.panel.find( "p" ).length, 1, "panel html" ); tabs_state( element, 0, 0, 0, 0, 1 ); start(); }); diff --git a/tests/unit/tabs/tabs_methods.js b/tests/unit/tabs/tabs_methods.js index b62f7bb3a11..fee87db96b7 100644 --- a/tests/unit/tabs/tabs_methods.js +++ b/tests/unit/tabs/tabs_methods.js @@ -94,14 +94,14 @@ test( "refresh", function() { element.tabs( "refresh" ); tabs_state( element, 1, 0, 0, 0 ); tabs_disabled( element, [ 1 ] ); - equals( element.find( "#" + $( "#newTab a" ).attr( "aria-controls" ) ).length, 1, + equal( element.find( "#" + $( "#newTab a" ).attr( "aria-controls" ) ).length, 1, "panel added for remote tab" ); // remove all tabs element.find( ".ui-tabs-nav li, .ui-tabs-panel" ).remove(); element.tabs( "refresh" ); tabs_state( element ); - equals( element.tabs( "option", "active" ), false, "no active tab" ); + equal( element.tabs( "option", "active" ), false, "no active tab" ); // add tabs element.find( ".ui-tabs-nav" ) @@ -136,7 +136,7 @@ test( "refresh", function() { element.tabs( "refresh" ); tabs_state( element, 0, 1 ); tabs_disabled( element, [ 0 ] ); - + // remove first tab, previously active tab (now first) should stay active element.find( ".ui-tabs-nav li" ).eq( 0 ).remove(); element.find( ".ui-tabs-panel" ).eq( 0 ).remove(); @@ -158,9 +158,9 @@ asyncTest( "load", function() { panel = $( "#" + panelId ); ok( !( "originalEvent" in event ), "originalEvent" ); - equals( ui.tab.size(), 1, "tab size" ); + equal( ui.tab.size(), 1, "tab size" ); strictEqual( ui.tab[ 0 ], tab[ 0 ], "tab" ); - equals( ui.panel.size(), 1, "panel size" ); + equal( ui.panel.size(), 1, "panel size" ); strictEqual( ui.panel[ 0 ], panel[ 0 ], "panel" ); tabs_state( element, 1, 0, 0, 0, 0 ); }); @@ -172,13 +172,13 @@ asyncTest( "load", function() { var tab = element.find( ".ui-tabs-nav a" ).eq( 3 ), panelId = tab.attr( "aria-controls" ), panel = $( "#" + panelId ); - + ok( !( "originalEvent" in event ), "originalEvent" ); - equals( uiTab.size(), 1, "tab size" ); + equal( uiTab.size(), 1, "tab size" ); strictEqual( uiTab[ 0 ], tab[ 0 ], "tab" ); - equals( uiPanel.size(), 1, "panel size" ); + equal( uiPanel.size(), 1, "panel size" ); strictEqual( uiPanel[ 0 ], panel[ 0 ], "panel" ); - equals( uiPanel.find( "p" ).length, 1, "panel html" ); + equal( uiPanel.find( "p" ).length, 1, "panel html" ); tabs_state( element, 1, 0, 0, 0, 0 ); setTimeout( tabsload1, 100 ); }); @@ -206,9 +206,9 @@ asyncTest( "load", function() { panel = $( "#" + panelId ); ok( !( "originalEvent" in event ), "originalEvent" ); - equals( ui.tab.size(), 1, "tab size" ); + equal( ui.tab.size(), 1, "tab size" ); strictEqual( ui.tab[ 0 ], tab[ 0 ], "tab" ); - equals( ui.panel.size(), 1, "panel size" ); + equal( ui.panel.size(), 1, "panel size" ); strictEqual( ui.panel[ 0 ], panel[ 0 ], "panel" ); tabs_state( element, 0, 0, 0, 1, 0 ); }); @@ -220,11 +220,11 @@ asyncTest( "load", function() { var tab = element.find( ".ui-tabs-nav a" ).eq( 3 ), panelId = tab.attr( "aria-controls" ), panel = $( "#" + panelId ); - + ok( !( "originalEvent" in event ), "originalEvent" ); - equals( uiTab.size(), 1, "tab size" ); + equal( uiTab.size(), 1, "tab size" ); strictEqual( uiTab[ 0 ], tab[ 0 ], "tab" ); - equals( uiPanel.size(), 1, "panel size" ); + equal( uiPanel.size(), 1, "panel size" ); strictEqual( uiPanel[ 0 ], panel[ 0 ], "panel" ); tabs_state( element, 0, 0, 0, 1, 0 ); start(); diff --git a/tests/unit/tabs/tabs_options.js b/tests/unit/tabs/tabs_options.js index 8d61c47ef40..e1ebf5efaae 100644 --- a/tests/unit/tabs/tabs_options.js +++ b/tests/unit/tabs/tabs_options.js @@ -6,13 +6,13 @@ test( "{ active: default }", function() { expect( 4 ); var element = $( "#tabs1" ).tabs(); - equals( element.tabs( "option", "active" ), 0, "should be 0 by default" ); + equal( element.tabs( "option", "active" ), 0, "should be 0 by default" ); tabs_state( element, 1, 0, 0 ); element.tabs( "destroy" ); location.hash = "#fragment-3"; element = $( "#tabs1" ).tabs(); - equals( element.tabs( "option", "active" ), 2, "should be 2 based on URL" ); + equal( element.tabs( "option", "active" ), 2, "should be 2 based on URL" ); tabs_state( element, 0, 0, 1 ); element.tabs( "destroy" ); location.hash = "#"; @@ -47,19 +47,19 @@ test( "{ active: Number }", function() { var element = $( "#tabs1" ).tabs({ active: 2 }); - equals( element.tabs( "option", "active" ), 2 ); + equal( element.tabs( "option", "active" ), 2 ); tabs_state( element, 0, 0, 1 ); element.tabs( "option", "active", 0 ); - equals( element.tabs( "option", "active" ), 0 ); + equal( element.tabs( "option", "active" ), 0 ); tabs_state( element, 1, 0, 0 ); element.find( ".ui-tabs-nav a" ).eq( 1 ).click(); - equals( element.tabs( "option", "active" ), 1 ); + equal( element.tabs( "option", "active" ), 1 ); tabs_state( element, 0, 1, 0 ); element.tabs( "option", "active", 10 ); - equals( element.tabs( "option", "active" ), 1 ); + equal( element.tabs( "option", "active" ), 1 ); tabs_state( element, 0, 1, 0 ); }); @@ -68,19 +68,19 @@ if ( $.uiBackCompat === false ) { var element = $( "#tabs1" ).tabs({ active: -1 }); - equals( element.tabs( "option", "active" ), 2 ); + equal( element.tabs( "option", "active" ), 2 ); tabs_state( element, 0, 0, 1 ); element.tabs( "option", "active", -2 ); - equals( element.tabs( "option", "active" ), 1 ); + equal( element.tabs( "option", "active" ), 1 ); tabs_state( element, 0, 1, 0 ); element.tabs( "option", "active", -10 ); - equals( element.tabs( "option", "active" ), 1 ); + equal( element.tabs( "option", "active" ), 1 ); tabs_state( element, 0, 1, 0 ); element.tabs( "option", "active", -3 ); - equals( element.tabs( "option", "active" ), 0 ); + equal( element.tabs( "option", "active" ), 0 ); tabs_state( element, 1, 0, 0 ); }); } @@ -90,7 +90,7 @@ test( "active - mismatched tab/panel order", function() { location.hash = "#tabs7-2"; var element = $( "#tabs7" ).tabs(); - equals( element.tabs( "option", "active" ), 1, "should be 1 based on URL" ); + equal( element.tabs( "option", "active" ), 1, "should be 1 based on URL" ); tabs_state( element, 0, 1 ); element.tabs( "option", "active", 0 ); tabs_state( element, 1, 0 ); diff --git a/tests/unit/testsuite.js b/tests/unit/testsuite.js index c8afcbe79c6..d37e27f7bb7 100644 --- a/tests/unit/testsuite.js +++ b/tests/unit/testsuite.js @@ -10,7 +10,7 @@ function testWidgetDefaults( widget, defaults ) { ok( $.isFunction( pluginDefaults[ key ] ), key ); return; } - same( pluginDefaults[ key ], val, key ); + deepEqual( pluginDefaults[ key ], val, key ); }); }); @@ -67,13 +67,13 @@ window.commonWidgetTests = function( widget, settings ) { /* * Experimental assertion for comparing DOM objects. - * + * * Serializes an element and some attributes and it's children if any, otherwise the text. * Then compares the result using deepEqual. */ window.domEqual = function( selector, modifier, message ) { var attributes = ["class", "role", "id", "tabIndex", "aria-activedescendant"]; - + function extract(value) { if (!value || !value.length) { QUnit.push( false, actual, expected, "domEqual failed, can't extract " + selector + ", message was: " + message ); @@ -97,7 +97,7 @@ window.domEqual = function( selector, modifier, message ) { } var expected = extract($(selector)); modifier($(selector)); - + var actual = extract($(selector)); QUnit.push( QUnit.equiv(actual, expected), actual, expected, message ); } diff --git a/tests/unit/tooltip/tooltip_events.js b/tests/unit/tooltip/tooltip_events.js index bf60c3cdc3d..b1ce92fb2d5 100644 --- a/tests/unit/tooltip/tooltip_events.js +++ b/tests/unit/tooltip/tooltip_events.js @@ -27,12 +27,12 @@ test( "mouse events", function() { var element = $( "#tooltipped1" ).tooltip(); element.one( "tooltipopen", function( event ) { - same( event.originalEvent.type, "mouseover" ); + deepEqual( event.originalEvent.type, "mouseover" ); }); element.trigger( "mouseover" ); element.one( "tooltipclose", function( event ) { - same( event.originalEvent.type, "mouseleave" ); + deepEqual( event.originalEvent.type, "mouseleave" ); }); element.trigger( "mouseleave" ); }); @@ -42,12 +42,12 @@ test( "focus events", function() { var element = $( "#tooltipped1" ).tooltip(); element.one( "tooltipopen", function( event ) { - same( event.originalEvent.type, "focusin" ); + deepEqual( event.originalEvent.type, "focusin" ); }); element.trigger( "focusin" ); element.one( "tooltipclose", function( event ) { - same( event.originalEvent.type, "focusout" ); + deepEqual( event.originalEvent.type, "focusout" ); }); element.trigger( "focusout" ); }); @@ -57,7 +57,7 @@ asyncTest( "mixed events", function() { var element = $( "#tooltipped1" ).tooltip(); element.one( "tooltipopen", function( event ) { - same( event.originalEvent.type, "focusin" ); + deepEqual( event.originalEvent.type, "focusin" ); }); element.simulate( "focus" ); @@ -74,7 +74,7 @@ asyncTest( "mixed events", function() { // blurring is async in IE element.one( "tooltipclose", function( event ) { - same( event.originalEvent.type, "focusout" ); + deepEqual( event.originalEvent.type, "focusout" ); start(); }); element.simulate( "blur" ); diff --git a/tests/unit/tooltip/tooltip_methods.js b/tests/unit/tooltip/tooltip_methods.js index 74fd35d8475..3e8256c50a0 100644 --- a/tests/unit/tooltip/tooltip_methods.js +++ b/tests/unit/tooltip/tooltip_methods.js @@ -59,8 +59,8 @@ TODO currently tooltip doesn't override widget can't return anything useful if no element is kept around and there's no useful reference test("widget", function() { var tooltip = $("#tooltipped1").tooltip(); - same(tooltip.tooltip("widget")[0], $(".ui-tooltip")[0]); - same(tooltip.tooltip("widget").end()[0], tooltip[0]); + deepEqual(tooltip.tooltip("widget")[0], $(".ui-tooltip")[0]); + deepEqual(tooltip.tooltip("widget").end()[0], tooltip[0]); }); */ diff --git a/tests/unit/tooltip/tooltip_options.js b/tests/unit/tooltip/tooltip_options.js index 04bb4c6a4f8..42529e08756 100644 --- a/tests/unit/tooltip/tooltip_options.js +++ b/tests/unit/tooltip/tooltip_options.js @@ -4,7 +4,7 @@ module( "tooltip: options" ); test( "content: default", function() { var element = $( "#tooltipped1" ).tooltip().tooltip( "open" ); - same( $( "#" + element.attr( "aria-describedby" ) ).text(), "anchortitle" ); + deepEqual( $( "#" + element.attr( "aria-describedby" ) ).text(), "anchortitle" ); }); test( "content: return string", function() { @@ -13,7 +13,7 @@ test( "content: return string", function() { return "customstring"; } }).tooltip( "open" ); - same( $( "#" + element.attr( "aria-describedby" ) ).text(), "customstring" ); + deepEqual( $( "#" + element.attr( "aria-describedby" ) ).text(), "customstring" ); }); test( "content: return jQuery", function() { @@ -22,7 +22,7 @@ test( "content: return jQuery", function() { return $( "
        " ).html( "customstring" ); } }).tooltip( "open" ); - same( $( "#" + element.attr( "aria-describedby" ) ).text(), "customstring" ); + deepEqual( $( "#" + element.attr( "aria-describedby" ) ).text(), "customstring" ); }); asyncTest( "content: sync + async callback", function() { @@ -30,11 +30,11 @@ asyncTest( "content: sync + async callback", function() { var element = $( "#tooltipped1" ).tooltip({ content: function( response ) { setTimeout(function() { - same( $( "#" + element.attr("aria-describedby") ).text(), "loading..." ); + deepEqual( $( "#" + element.attr("aria-describedby") ).text(), "loading..." ); response( "customstring2" ); setTimeout(function() { - same( $( "#" + element.attr("aria-describedby") ).text(), "customstring2" ); + deepEqual( $( "#" + element.attr("aria-describedby") ).text(), "customstring2" ); start(); }, 13 ); }, 13 ); @@ -52,12 +52,12 @@ test( "items", function() { var event = $.Event( "mouseenter" ); event.target = $( "#fixture-span" )[ 0 ]; element.tooltip( "open", event ); - same( $( "#" + $( "#fixture-span" ).attr( "aria-describedby" ) ).text(), "title-text" ); + deepEqual( $( "#" + $( "#fixture-span" ).attr( "aria-describedby" ) ).text(), "title-text" ); // make sure default [title] doesn't get used event.target = $( "#tooltipped1" )[ 0 ]; element.tooltip( "open", event ); - same( $( "#tooltipped1" ).attr( "aria-describedby" ), undefined ); + deepEqual( $( "#tooltipped1" ).attr( "aria-describedby" ), undefined ); element.tooltip( "destroy" ); }); diff --git a/tests/unit/widget/widget_core.js b/tests/unit/widget/widget_core.js index 86fa658aaee..c451c4cf6e0 100644 --- a/tests/unit/widget/widget_core.js +++ b/tests/unit/widget/widget_core.js @@ -14,12 +14,12 @@ test( "widget creation", function() { $.widget( "ui.testWidget", myPrototype ); ok( $.isFunction( $.ui.testWidget ), "constructor was created" ); - equals( "object", typeof $.ui.testWidget.prototype, "prototype was created" ); - equals( $.ui.testWidget.prototype._create, myPrototype._create, + equal( "object", typeof $.ui.testWidget.prototype, "prototype was created" ); + equal( $.ui.testWidget.prototype._create, myPrototype._create, "create function is copied over" ); - equals( $.ui.testWidget.prototype.creationTest, myPrototype.creationTest, + equal( $.ui.testWidget.prototype.creationTest, myPrototype.creationTest, "random function is copied over" ); - equals( $.ui.testWidget.prototype.option, $.Widget.prototype.option, + equal( $.ui.testWidget.prototype.option, $.Widget.prototype.option, "option method copied over from base widget" ); }); @@ -32,36 +32,36 @@ test( "element normalization", function() { // workaround for core ticket #8381 this.element.appendTo( "#qunit-fixture" ); ok( this.element.is( "div" ), "generated div" ); - same( this.element.data( "testWidget" ), this, "intance stored in .data()" ); + deepEqual( this.element.data( "testWidget" ), this, "intance stored in .data()" ); }; $.ui.testWidget(); $.ui.testWidget.prototype.defaultElement = ""; $.ui.testWidget.prototype._create = function() { ok( this.element.is( "span[data-test=pass]" ), "generated span with properties" ); - same( this.element.data( "testWidget" ), this, "instace stored in .data()" ); + deepEqual( this.element.data( "testWidget" ), this, "instace stored in .data()" ); }; $.ui.testWidget(); elem = $( "" ); $.ui.testWidget.prototype._create = function() { - same( this.element[ 0 ], elem[ 0 ], "from element" ); - same( elem.data( "testWidget" ), this, "instace stored in .data()" ); + deepEqual( this.element[ 0 ], elem[ 0 ], "from element" ); + deepEqual( elem.data( "testWidget" ), this, "instace stored in .data()" ); }; $.ui.testWidget( {}, elem[ 0 ] ); elem = $( "
        " ); $.ui.testWidget.prototype._create = function() { - same( this.element[ 0 ], elem[ 0 ], "from jQuery object" ); - same( elem.data( "testWidget" ), this, "instace stored in .data()" ); + deepEqual( this.element[ 0 ], elem[ 0 ], "from jQuery object" ); + deepEqual( elem.data( "testWidget" ), this, "instace stored in .data()" ); }; $.ui.testWidget( {}, elem ); elem = $( "
        " ) .appendTo( "#qunit-fixture" ); $.ui.testWidget.prototype._create = function() { - same( this.element[ 0 ], elem[ 0 ], "from selector" ); - same( elem.data( "testWidget" ), this, "instace stored in .data()" ); + deepEqual( this.element[ 0 ], elem[ 0 ], "from selector" ); + deepEqual( elem.data( "testWidget" ), this, "instace stored in .data()" ); }; $.ui.testWidget( {}, "#element-normalization-selector" ); @@ -85,9 +85,9 @@ test( "jQuery usage", function() { }, methodWithParams: function( param1, param2 ) { ok( true, "method called via .pluginName(methodName)" ); - equals( param1, "value1", + equal( param1, "value1", "parameter passed via .pluginName(methodName, param)" ); - equals( param2, "value2", + equal( param2, "value2", "multiple parameters passed via .pluginName(methodName, param, param)" ); return this; @@ -113,16 +113,16 @@ test( "jQuery usage", function() { shouldCreate = false; var instance = elem.data( "testWidget" ); - equals( typeof instance, "object", "instance stored in .data(pluginName)" ); - equals( instance.element[0], elem[0], "element stored on widget" ); + equal( typeof instance, "object", "instance stored in .data(pluginName)" ); + equal( instance.element[0], elem[0], "element stored on widget" ); var ret = elem.testWidget( "methodWithParams", "value1", "value2" ); - equals( ret, elem, "jQuery object returned from method call" ); + equal( ret, elem, "jQuery object returned from method call" ); ret = elem.testWidget( "getterSetterMethod" ); - equals( ret, 5, "getter/setter can act as getter" ); + equal( ret, 5, "getter/setter can act as getter" ); ret = elem.testWidget( "getterSetterMethod", 30 ); - equals( ret, elem, "getter/setter method can be chainable" ); - equals( instance.getterSetterVal, 30, "getter/setter can act as setter" ); + equal( ret, elem, "getter/setter method can be chainable" ); + equal( instance.getterSetterVal, 30, "getter/setter can act as setter" ); ret = elem.testWidget( "jQueryObject" ); equal( ret[ 0 ], document.body, "returned jQuery object" ); equal( ret.end(), elem, "stack preserved" ); @@ -140,8 +140,8 @@ test( "direct usage", function() { }, methodWithParams: function( param1, param2 ) { ok( true, "method called dirctly" ); - equals( param1, "value1", "parameter passed via direct call" ); - equals( param2, "value2", "multiple parameters passed via direct call" ); + equal( param1, "value1", "parameter passed via direct call" ); + equal( param2, "value2", "multiple parameters passed via direct call" ); return this; }, @@ -160,17 +160,17 @@ test( "direct usage", function() { var instance = new $.ui.testWidget( {}, elem ); shouldCreate = false; - equals( $( elem ).data( "testWidget" ), instance, + equal( $( elem ).data( "testWidget" ), instance, "instance stored in .data(pluginName)" ); - equals( instance.element[ 0 ], elem, "element stored on widget" ); + equal( instance.element[ 0 ], elem, "element stored on widget" ); var ret = instance.methodWithParams( "value1", "value2" ); - equals( ret, instance, "plugin returned from method call" ); + equal( ret, instance, "plugin returned from method call" ); ret = instance.getterSetterMethod(); - equals( ret, 5, "getter/setter can act as getter" ); + equal( ret, 5, "getter/setter can act as getter" ); instance.getterSetterMethod( 30 ); - equals( instance.getterSetterVal, 30, "getter/setter can act as setter" ); + equal( instance.getterSetterVal, 30, "getter/setter can act as setter" ); }); test( "error handling", function() { @@ -201,7 +201,7 @@ test( "merge multiple option arguments", function() { expect( 1 ); $.widget( "ui.testWidget", { _create: function() { - same( this.options, { + deepEqual( this.options, { create: null, disabled: false, option1: "value1", @@ -249,7 +249,7 @@ test( "._getCreateOptions()", function() { }; }, _create: function() { - same( this.options, { + deepEqual( this.options, { create: null, disabled: false, option1: "override1", @@ -294,15 +294,15 @@ test( "re-init", function() { actions = []; div.testWidget({ foo: "bar" }); - same( actions, [ "create", "init" ], "correct methods called on init" ); + deepEqual( actions, [ "create", "init" ], "correct methods called on init" ); actions = []; div.testWidget(); - same( actions, [ "init" ], "correct methods call on re-init" ); + deepEqual( actions, [ "init" ], "correct methods call on re-init" ); actions = []; div.testWidget({ foo: "bar" }); - same( actions, [ "optionfoo", "init" ], "correct methods called on re-init with options" ); + deepEqual( actions, [ "optionfoo", "init" ], "correct methods called on re-init with options" ); }); test( "inheritance - options", function() { @@ -326,18 +326,18 @@ test( "inheritance - options", function() { } }); - same( $.ui.testWidgetBase.prototype.options.obj, { + deepEqual( $.ui.testWidgetBase.prototype.options.obj, { key1: "foo", key2: "bar" }, "base class option object not overridden"); - same( $.ui.testWidgetBase.prototype.options.arr, [ "testing" ], + deepEqual( $.ui.testWidgetBase.prototype.options.arr, [ "testing" ], "base class option array not overridden"); - same( $.ui.testWidgetExtension.prototype.options.obj, { + deepEqual( $.ui.testWidgetExtension.prototype.options.obj, { key1: "baz", key2: "bar" }, "extension class option object extends base"); - same( $.ui.testWidgetExtension.prototype.options.arr, [ "alpha", "beta" ], + deepEqual( $.ui.testWidgetExtension.prototype.options.arr, [ "alpha", "beta" ], "extension class option array overwrites base"); delete $.ui.testWidgetBase; @@ -349,28 +349,28 @@ test( "._super()", function() { var instance; $.widget( "ui.testWidget", { method: function( a, b ) { - same( this, instance, "this is correct in testWidget" ); - same( a, 5, "parameter passed to testWidget" ); - same( b, 20, "second parameter passed to testWidget" ); + deepEqual( this, instance, "this is correct in testWidget" ); + deepEqual( a, 5, "parameter passed to testWidget" ); + deepEqual( b, 20, "second parameter passed to testWidget" ); return a + b; } }); $.widget( "ui.testWidget2", $.ui.testWidget, { method: function( a, b ) { - same( this, instance, "this is correct in testWidget2" ); - same( a, 5, "parameter passed to testWidget2" ); - same( b, 10, "parameter passed to testWidget2" ); + deepEqual( this, instance, "this is correct in testWidget2" ); + deepEqual( a, 5, "parameter passed to testWidget2" ); + deepEqual( b, 10, "parameter passed to testWidget2" ); return this._super( a, b*2 ); } }); $.widget( "ui.testWidget3", $.ui.testWidget2, { method: function( a ) { - same( this, instance, "this is correct in testWidget3" ); - same( a, 5, "parameter passed to testWidget3" ); + deepEqual( this, instance, "this is correct in testWidget3" ); + deepEqual( a, 5, "parameter passed to testWidget3" ); var ret = this._super( a, a*2 ); - same( ret, 25, "super returned value" ); + deepEqual( ret, 25, "super returned value" ); } }); @@ -385,29 +385,29 @@ test( "._superApply()", function() { var instance; $.widget( "ui.testWidget", { method: function( a, b ) { - same( this, instance, "this is correct in testWidget" ); - same( a, 5, "parameter passed to testWidget" ); - same( b, 10, "second parameter passed to testWidget" ); + deepEqual( this, instance, "this is correct in testWidget" ); + deepEqual( a, 5, "parameter passed to testWidget" ); + deepEqual( b, 10, "second parameter passed to testWidget" ); return a + b; } }); $.widget( "ui.testWidget2", $.ui.testWidget, { method: function( a, b ) { - same( this, instance, "this is correct in testWidget2" ); - same( a, 5, "parameter passed to testWidget2" ); - same( b, 10, "second parameter passed to testWidget2" ); + deepEqual( this, instance, "this is correct in testWidget2" ); + deepEqual( a, 5, "parameter passed to testWidget2" ); + deepEqual( b, 10, "second parameter passed to testWidget2" ); return this._superApply( arguments ); } }); $.widget( "ui.testWidget3", $.ui.testWidget2, { method: function( a, b ) { - same( this, instance, "this is correct in testWidget3" ); - same( a, 5, "parameter passed to testWidget3" ); - same( b, 10, "second parameter passed to testWidget3" ); + deepEqual( this, instance, "this is correct in testWidget3" ); + deepEqual( a, 5, "parameter passed to testWidget3" ); + deepEqual( b, 10, "second parameter passed to testWidget3" ); var ret = this._superApply( arguments ); - same( ret, 15, "super returned value" ); + deepEqual( ret, 15, "super returned value" ); } }); @@ -428,14 +428,14 @@ test( ".option() - getter", function() { qux: [ "quux", "quuux" ] }); - same( div.testWidget( "option", "x" ), null, "non-existent option" ); - same( div.testWidget( "option", "foo"), "bar", "single option - string" ); - same( div.testWidget( "option", "baz"), 5, "single option - number" ); - same( div.testWidget( "option", "qux"), [ "quux", "quuux" ], + deepEqual( div.testWidget( "option", "x" ), null, "non-existent option" ); + deepEqual( div.testWidget( "option", "foo"), "bar", "single option - string" ); + deepEqual( div.testWidget( "option", "baz"), 5, "single option - number" ); + deepEqual( div.testWidget( "option", "qux"), [ "quux", "quuux" ], "single option - array" ); var options = div.testWidget( "option" ); - same( options, { + deepEqual( options, { create: null, disabled: false, foo: "bar", @@ -443,7 +443,7 @@ test( ".option() - getter", function() { qux: [ "quux", "quuux" ] }, "full options hash returned" ); options.foo = "notbar"; - same( div.testWidget( "option", "foo"), "bar", + deepEqual( div.testWidget( "option", "foo"), "bar", "modifying returned options hash does not modify plugin instance" ); }); @@ -477,14 +477,14 @@ test( ".option() - delegate to ._setOptions()", function() { calls = []; div.testWidget( "option", "foo", "bar" ); - same( calls, [{ foo: "bar" }], "_setOptions called for single option" ); + deepEqual( calls, [{ foo: "bar" }], "_setOptions called for single option" ); calls = []; div.testWidget( "option", { bar: "qux", quux: "quuux" }); - same( calls, [{ bar: "qux", quux: "quuux" }], + deepEqual( calls, [{ bar: "qux", quux: "quuux" }], "_setOptions called with multiple options" ); }); @@ -503,7 +503,7 @@ test( ".option() - delegate to ._setOption()", function() { calls = []; div.testWidget( "option", "foo", "bar" ); - same( calls, [{ key: "foo", val: "bar" }], + deepEqual( calls, [{ key: "foo", val: "bar" }], "_setOption called for single option" ); calls = []; @@ -511,7 +511,7 @@ test( ".option() - delegate to ._setOption()", function() { bar: "qux", quux: "quuux" }); - same( calls, [ + deepEqual( calls, [ { key: "bar", val: "qux" }, { key: "quux", val: "quuux" } ], "_setOption called with multiple options" ); @@ -523,8 +523,8 @@ test( ".option() - deep option setter", function() { function deepOption( from, to, msg ) { div.data( "testWidget" ).options.foo = from; $.ui.testWidget.prototype._setOption = function( key, value ) { - same( key, "foo", msg + ": key" ); - same( value, to, msg + ": value" ); + deepEqual( key, "foo", msg + ": key" ); + deepEqual( value, to, msg + ": value" ); }; } @@ -546,8 +546,8 @@ test( ".enable()", function() { $.widget( "ui.testWidget", { _create: function() {}, _setOption: function( key, val ) { - same( key, "disabled", "_setOption called with disabled option" ); - same( val, false, "disabled set to false" ); + deepEqual( key, "disabled", "_setOption called with disabled option" ); + deepEqual( val, false, "disabled set to false" ); } }); $( "
        " ).testWidget().testWidget( "enable" ); @@ -558,8 +558,8 @@ test( ".disable()", function() { $.widget( "ui.testWidget", { _create: function() {}, _setOption: function( key, val ) { - same( key, "disabled", "_setOption called with disabled option" ); - same( val, true, "disabled set to true" ); + deepEqual( key, "disabled", "_setOption called with disabled option" ); + deepEqual( val, true, "disabled set to true" ); } }); $( "
        " ).testWidget().testWidget( "disable" ); @@ -570,7 +570,7 @@ test( ".widget() - base", function() { _create: function() {} }); var div = $( "
        " ).testWidget(); - same( div[0], div.testWidget( "widget" )[0]); + deepEqual( div[0], div.testWidget( "widget" )[0]); }); test( ".widget() - overriden", function() { @@ -581,7 +581,7 @@ test( ".widget() - overriden", function() { return wrapper; } }); - same( wrapper[0], $( "
        " ).testWidget().testWidget( "widget" )[0] ); + deepEqual( wrapper[0], $( "
        " ).testWidget().testWidget( "widget" )[0] ); }); test( "._bind() to element (default)", function() { @@ -596,14 +596,14 @@ test( "._bind() to element (default)", function() { }); }, keyup: function( event ) { - equals( that, this ); - equals( that.element[0], event.currentTarget ); - equals( "keyup", event.type ); + equal( that, this ); + equal( that.element[0], event.currentTarget ); + equal( "keyup", event.type ); }, keydown: function( event ) { - equals( that, this ); - equals( that.element[0], event.currentTarget ); - equals( "keydown", event.type ); + equal( that, this ); + equal( that.element[0], event.currentTarget ); + equal( "keydown", event.type ); } }); var widget = $( "
        " ) @@ -636,14 +636,14 @@ test( "._bind() to descendent", function() { }); }, keyup: function( event ) { - equals( that, this ); - equals( that.element.find( "strong" )[0], event.currentTarget ); - equals( "keyup", event.type ); + equal( that, this ); + equal( that.element.find( "strong" )[0], event.currentTarget ); + equal( "keyup", event.type ); }, keydown: function(event) { - equals( that, this ); - equals( that.element.find( "strong" )[0], event.currentTarget ); - equals( "keydown", event.type ); + equal( that, this ); + equal( that.element.find( "strong" )[0], event.currentTarget ); + equal( "keydown", event.type ); } }); // trigger events on both widget and descendent to ensure that only descendent receives them @@ -794,19 +794,19 @@ test( "._trigger() - no event, no ui", function() { $( "#widget" ).testWidget({ foo: function( event, ui ) { - same( event.type, "testwidgetfoo", "correct event type in callback" ); - same( ui, {}, "empty ui hash passed" ); + deepEqual( event.type, "testwidgetfoo", "correct event type in callback" ); + deepEqual( ui, {}, "empty ui hash passed" ); handlers.push( "callback" ); } }); $( document ).add( "#widget-wrapper" ).add( "#widget" ) .bind( "testwidgetfoo", function( event, ui ) { - same( ui, {}, "empty ui hash passed" ); + deepEqual( ui, {}, "empty ui hash passed" ); handlers.push( this ); }); - same( $( "#widget" ).data( "testWidget" )._trigger( "foo" ), true, + deepEqual( $( "#widget" ).data( "testWidget" )._trigger( "foo" ), true, "_trigger returns true when event is not cancelled" ); - same( handlers, [ + deepEqual( handlers, [ $( "#widget" )[ 0 ], $( "#widget-wrapper" )[ 0 ], document, @@ -832,7 +832,7 @@ test( "._trigger() - cancelled event", function() { ok( true, "event was triggered" ); return false; }); - same( $( "#widget" ).data( "testWidget" )._trigger( "foo" ), false, + deepEqual( $( "#widget" ).data( "testWidget" )._trigger( "foo" ), false, "_trigger returns false when event is cancelled" ); }); @@ -846,7 +846,7 @@ test( "._trigger() - cancelled callback", function() { return false; } }); - same( $( "#widget" ).data( "testWidget" )._trigger( "foo" ), false, + deepEqual( $( "#widget" ).data( "testWidget" )._trigger( "foo" ), false, "_trigger returns false when callback returns false" ); }); @@ -865,7 +865,7 @@ test( "._trigger() - provide event and ui", function() { } }; this._trigger( "foo", originalEvent, ui ); - same( ui, { + deepEqual( ui, { foo: "notbar", baz: { qux: 10, @@ -876,7 +876,7 @@ test( "._trigger() - provide event and ui", function() { }); $( "#widget" ).bind( "testwidgetfoo", function( event, ui ) { equal( event.originalEvent, originalEvent, "original event object passed" ); - same( ui, { + deepEqual( ui, { foo: "bar", baz: { qux: 5, @@ -887,7 +887,7 @@ test( "._trigger() - provide event and ui", function() { }); $( "#widget-wrapper" ).bind( "testwidgetfoo", function( event, ui ) { equal( event.originalEvent, originalEvent, "original event object passed" ); - same( ui, { + deepEqual( ui, { foo: "notbar", baz: { qux: 5, @@ -899,7 +899,7 @@ test( "._trigger() - provide event and ui", function() { $( "#widget" ).testWidget({ foo: function( event, ui ) { equal( event.originalEvent, originalEvent, "original event object passed" ); - same( ui, { + deepEqual( ui, { foo: "notbar", baz: { qux: 10, @@ -933,27 +933,27 @@ test( "._trigger() - array as ui", function() { } }); $( "#widget" ).bind( "testwidgetfoo", function( event, ui, extra ) { - same( ui, { + deepEqual( ui, { foo: "bar", baz: { qux: 5, quux: 20 } }, "event: ui hash passed" ); - same( extra, { + deepEqual( extra, { bar: 5 }, "event: extra argument passed" ); }); $( "#widget" ).testWidget({ foo: function( event, ui, extra ) { - same( ui, { + deepEqual( ui, { foo: "bar", baz: { qux: 5, quux: 20 } }, "callback: ui hash passed" ); - same( extra, { + deepEqual( extra, { bar: 5 }, "callback: extra argument passed" ); } @@ -973,12 +973,12 @@ test( "._trigger() - instance as element", function() { var instance = $.ui.testWidget({ foo: function( event, ui ) { equal( event.type, "testwidgetfoo", "event object passed to callback" ); - same( ui, { foo: "bar" }, "ui object passed to callback" ); + deepEqual( ui, { foo: "bar" }, "ui object passed to callback" ); } }); $( instance ).bind( "testwidgetfoo", function( event, ui ) { equal( event.type, "testwidgetfoo", "event object passed to event handler" ); - same( ui, { foo: "bar" }, "ui object passed to event handler" ); + deepEqual( ui, { foo: "bar" }, "ui object passed to event handler" ); }); instance.testEvent(); }); From 09732dace8156a10065e29d9cb0e4007fa079d8f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=CC=88rn=20Zaefferer?= Date: Wed, 29 Feb 2012 18:15:42 +0100 Subject: [PATCH 17/18] Update QUnit to latest, reverting the bad reset 'patch' --- external/qunit.css | 2 +- external/qunit.js | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/external/qunit.css b/external/qunit.css index 3334e21de9e..58101ea34ce 100644 --- a/external/qunit.css +++ b/external/qunit.css @@ -1,5 +1,5 @@ /** - * QUnit v1.3.0 - A JavaScript Unit Testing Framework + * QUnit v1.4.0pre - A JavaScript Unit Testing Framework * * http://docs.jquery.com/QUnit * diff --git a/external/qunit.js b/external/qunit.js index cd5631d86ab..1d609f61a29 100644 --- a/external/qunit.js +++ b/external/qunit.js @@ -1,5 +1,5 @@ /** - * QUnit v1.3.0 - A JavaScript Unit Testing Framework + * QUnit v1.4.0pre - A JavaScript Unit Testing Framework * * http://docs.jquery.com/QUnit * @@ -579,15 +579,15 @@ extend(QUnit, { /** * Resets the test setup. Useful for tests that modify the DOM. * - * If jQuery is available, uses jQuery's replaceWith(), otherwise use replaceChild + * If jQuery is available, uses jQuery's html(), otherwise just innerHTML. */ reset: function() { - var main = id( 'qunit-fixture' ); - if ( main ) { - if ( window.jQuery ) { - jQuery( main ).replaceWith( config.fixture.cloneNode(true) ); - } else { - main.parentNode.replaceChild(config.fixture.cloneNode(true), main); + if ( window.jQuery ) { + jQuery( "#qunit-fixture" ).html( config.fixture ); + } else { + var main = id( 'qunit-fixture' ); + if ( main ) { + main.innerHTML = config.fixture; } } }, @@ -798,7 +798,7 @@ QUnit.load = function() { var main = id('qunit-fixture'); if ( main ) { - config.fixture = main.cloneNode(true); + config.fixture = main.innerHTML; } if (config.autostart) { From 63215a68757c4fa78079a48488d9a91f0ec8cf50 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Scott=20Gonz=C3=A1lez?= Date: Wed, 29 Feb 2012 22:08:47 -0500 Subject: [PATCH 18/18] Tests: Cleaned up simulate. Still more work to do. --- tests/jquery.simulate.js | 240 ++++++++++++++++++++------------------- 1 file changed, 121 insertions(+), 119 deletions(-) diff --git a/tests/jquery.simulate.js b/tests/jquery.simulate.js index 43614dd0a04..8ecd60fa7a7 100644 --- a/tests/jquery.simulate.js +++ b/tests/jquery.simulate.js @@ -4,57 +4,60 @@ * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) * Dual licensed under the MIT or GPL Version 2 licenses. * http://jquery.org/license - * */ ;(function( $ ) { -$.fn.extend({ - simulate: function( type, options ) { - return this.each(function() { - var opt = $.extend( {}, $.simulate.defaults, options ); - new $.simulate( this, type, opt ); - }); - } -}); +var rkeyEvent = /^key/, + rmouseEvent = /^(?:mouse|contextmenu)|click/; -$.simulate = function( el, type, options ) { - this.target = el; +$.fn.simulate = function( type, options ) { + return this.each(function() { + new $.simulate( this, type, options ); + }); +}; + +$.simulate = function( elem, type, options ) { + var method = $.camelCase( "simulate-" + type ); + + this.target = elem; this.options = options; - if ( type === "drag" ) { - this[ type ].apply( this, [ this.target, options ] ); - } else if ( type === "focus" || type === "blur" ) { - this[ type ](); + if ( this[ method ] ) { + this[ method ](); } else { - this.simulateEvent( el, type, options ); + this.simulateEvent( elem, type, options ); } }; $.extend( $.simulate.prototype, { - simulateEvent: function( el, type, options ) { - var evt = this.createEvent( type, options ); - this.dispatchEvent( el, type, evt, options ); - return evt; + simulateEvent: function( elem, type, options ) { + var event = this.createEvent( type, options ); + this.dispatchEvent( elem, type, event, options ); }, + createEvent: function( type, options ) { - if ( /^mouse(over|out|down|up|move)|(dbl)?click$/.test( type ) ) { + if ( rkeyEvent.test( type ) ) { + return this.keyEvent( type, options ); + } + + if ( rmouseEvent.test( type ) ) { return this.mouseEvent( type, options ); - } else if ( /^key(up|down|press)$/.test( type ) ) { - return this.keyboardEvent( type, options ); } }, + mouseEvent: function( type, options ) { - var evt, eventDoc, doc, body; - var e = $.extend({ + var event, eventDoc, doc, body; + options = $.extend({ bubbles: true, cancelable: (type !== "mousemove"), view: window, detail: 0, screenX: 0, screenY: 0, - clientX: 0, - clientY: 0, + // TODO: default clientX/Y to a position within the target element + clientX: 1, + clientY: 1, ctrlKey: false, altKey: false, shiftKey: false, @@ -63,49 +66,50 @@ $.extend( $.simulate.prototype, { relatedTarget: undefined }, options ); - var relatedTarget = $( e.relatedTarget )[0]; + if ( document.createEvent ) { + event = document.createEvent( "MouseEvents" ); + event.initMouseEvent( type, options.bubbles, options.cancelable, + options.view, options.detail, + options.screenX, options.screenY, options.clientX, options.clientY, + options.ctrlKey, options.altKey, options.shiftKey, options.metaKey, + options.button, options.relatedTarget || document.body.parentNode ); - if ( $.isFunction( document.createEvent ) ) { - evt = document.createEvent( "MouseEvents" ); - evt.initMouseEvent( type, e.bubbles, e.cancelable, e.view, e.detail, - e.screenX, e.screenY, e.clientX, e.clientY, - e.ctrlKey, e.altKey, e.shiftKey, e.metaKey, - e.button, e.relatedTarget || document.body.parentNode ); - // IE 9+ creates events with pageX and pageY set to 0. // Trying to modify the properties throws an error, // so we define getters to return the correct values. - if ( evt.pageX === 0 && evt.pageY === 0 && Object.defineProperty ) { - eventDoc = evt.relatedTarget.ownerDocument || document; + if ( event.pageX === 0 && event.pageY === 0 && Object.defineProperty ) { + eventDoc = event.relatedTarget.ownerDocument || document; doc = eventDoc.documentElement; body = eventDoc.body; - Object.defineProperty( evt, "pageX", { + Object.defineProperty( event, "pageX", { get: function() { - return e.clientX + + return options.clientX + ( doc && doc.scrollLeft || body && body.scrollLeft || 0 ) - ( doc && doc.clientLeft || body && body.clientLeft || 0 ); } }); - Object.defineProperty( evt, "pageY", { + Object.defineProperty( event, "pageY", { get: function() { - return e.clientY + + return options.clientY + ( doc && doc.scrollTop || body && body.scrollTop || 0 ) - ( doc && doc.clientTop || body && body.clientTop || 0 ); } }); } } else if ( document.createEventObject ) { - evt = document.createEventObject(); - $.extend( evt, e ); - evt.button = { 0:1, 1:4, 2:2 }[evt.button] || evt.button; + event = document.createEventObject(); + $.extend( event, options ); + // TODO: what is this mapping for? + event.button = { 0:1, 1:4, 2:2 }[ event.button ] || event.button; } - return evt; + + return event; }, - keyboardEvent: function( type, options ) { - var evt; - var e = $.extend({ + keyEvent: function( type, options ) { + var event; + options = $.extend({ bubbles: true, cancelable: true, view: window, @@ -117,74 +121,51 @@ $.extend( $.simulate.prototype, { charCode: undefined }, options ); - if ( $.isFunction( document.createEvent ) ) { + if ( document.createEvent ) { try { - evt = document.createEvent( "KeyEvents" ); - evt.initKeyEvent( type, e.bubbles, e.cancelable, e.view, - e.ctrlKey, e.altKey, e.shiftKey, e.metaKey, - e.keyCode, e.charCode ); + event = document.createEvent( "KeyEvents" ); + event.initKeyEvent( type, options.bubbles, options.cancelable, options.view, + options.ctrlKey, options.altKey, options.shiftKey, options.metaKey, + options.keyCode, options.charCode ); + // TODO: what is this supporting? } catch( err ) { - evt = document.createEvent( "Events" ); - evt.initEvent( type, e.bubbles, e.cancelable ); - $.extend(evt, { - view: e.view, - ctrlKey: e.ctrlKey, - altKey: e.altKey, - shiftKey: e.shiftKey, - metaKey: e.metaKey, - keyCode: e.keyCode, - charCode: e.charCode + event = document.createEvent( "Events" ); + event.initEvent( type, options.bubbles, options.cancelable ); + $.extend( event, { + view: options.view, + ctrlKey: options.ctrlKey, + altKey: options.altKey, + shiftKey: options.shiftKey, + metaKey: options.metaKey, + keyCode: options.keyCode, + charCode: options.charCode }); } } else if ( document.createEventObject ) { - evt = document.createEventObject(); - $.extend( evt, e ); + event = document.createEventObject(); + $.extend( event, options ); } + + // TODO: can we hook into core's logic? if ( $.browser.msie || $.browser.opera ) { - evt.keyCode = (e.charCode > 0) ? e.charCode : e.keyCode; - evt.charCode = undefined; + // TODO: is charCode ever <0 ? Can we just use charCode || keyCode? + event.keyCode = (options.charCode > 0) ? options.charCode : options.keyCode; + event.charCode = undefined; } - return evt; - }, - dispatchEvent: function( el, type, evt ) { - if ( el.dispatchEvent ) { - el.dispatchEvent( evt ); - } else if ( el.fireEvent ) { - el.fireEvent( "on" + type, evt ); - } - return evt; + return event; }, - drag: function( el ) { - var center = this.findCenter(this.target), - options = this.options, - x = Math.floor( center.x ), - y = Math.floor( center.y ), - dx = options.dx || 0, - dy = options.dy || 0, - target = this.target, - coord = { clientX: x, clientY: y }; - this.simulateEvent( target, "mousedown", coord ); - coord = { clientX: x + 1, clientY: y + 1 }; - this.simulateEvent( document, "mousemove", coord ); - coord = { clientX: x + dx, clientY: y + dy }; - this.simulateEvent( document, "mousemove", coord ); - this.simulateEvent( document, "mousemove", coord ); - this.simulateEvent( target, "mouseup", coord ); - this.simulateEvent( target, "click", coord ); - }, - findCenter: function( el ) { - var el = $( this.target ), - o = el.offset(), - d = $( document ); - return { - x: o.left + el.outerWidth() / 2 - d.scrollLeft(), - y: o.top + el.outerHeight() / 2 - d.scrollTop() - }; + // TODO: does this need type? Can't we just check event.type? + dispatchEvent: function( elem, type, event ) { + if ( elem.dispatchEvent ) { + elem.dispatchEvent( event ); + } else if ( elem.fireEvent ) { + elem.fireEvent( "on" + type, event ); + } }, - focus: function() { + simulateFocus: function() { var focusinEvent, triggered = false, element = $( this.target ); @@ -205,7 +186,7 @@ $.extend( $.simulate.prototype, { element.unbind( "focus", trigger ); }, - blur: function() { + simulateBlur: function() { var focusoutEvent, triggered = false, element = $( this.target ); @@ -237,21 +218,42 @@ $.extend( $.simulate.prototype, { } }); -$.extend( $.simulate, { - defaults: { - speed: "sync" - }, - VK_TAB: 9, - VK_ENTER: 13, - VK_ESC: 27, - VK_PGUP: 33, - VK_PGDN: 34, - VK_END: 35, - VK_HOME: 36, - VK_LEFT: 37, - VK_UP: 38, - VK_RIGHT: 39, - VK_DOWN: 40 + + +/** complex events **/ + +function findCenter( elem ) { + var offset, + document = $( elem.ownerDocument ); + elem = $( elem ); + offset = elem.offset(); + + return { + x: offset.left + elem.outerWidth() / 2 - document.scrollLeft(), + y: offset.top + elem.outerHeight() / 2 - document.scrollTop() + }; +} + +$.extend( $.simulate.prototype, { + simulateDrag: function() { + var target = this.target, + options = this.options, + center = findCenter( target ), + x = Math.floor( center.x ), + y = Math.floor( center.y ), + dx = options.dx || 0, + dy = options.dy || 0, + target = this.target, + coord = { clientX: x, clientY: y }; + this.simulateEvent( target, "mousedown", coord ); + coord = { clientX: x + 1, clientY: y + 1 }; + this.simulateEvent( document, "mousemove", coord ); + coord = { clientX: x + dx, clientY: y + dy }; + this.simulateEvent( document, "mousemove", coord ); + this.simulateEvent( document, "mousemove", coord ); + this.simulateEvent( target, "mouseup", coord ); + this.simulateEvent( target, "click", coord ); + } }); })( jQuery );