Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge branch 'master' into interactions

Conflicts:
	demos/draggable/cursor-style.html
	ui/jquery.ui.draggable.js
  • Loading branch information...
commit adaf034f6dd87542f5fc23969d63e6c36f74373d 2 parents a065d35 + ec062c1
@scottgonzalez scottgonzalez authored
Showing with 3,359 additions and 6,167 deletions.
  1. +1 −1  MIT-LICENSE.txt
  2. +4 −4 demos/accordion/collapsible.html
  3. +4 −4 demos/accordion/custom-icons.html
  4. +4 −4 demos/accordion/default.html
  5. +4 −4 demos/accordion/fillspace.html
  6. +6 −6 demos/accordion/hoverintent.html
  7. +0 −1  demos/accordion/index.html
  8. +0 −57 demos/accordion/mouseover.html
  9. +3 −4 demos/accordion/no-auto-height.html
  10. +16 −18 demos/accordion/sortable.html
  11. +1 −1  demos/addClass/default.html
  12. +2 −2 demos/autocomplete/categories.html
  13. +2 −2 demos/autocomplete/combobox.html
  14. +4 −0 demos/datepicker/localization.html
  15. +18 −17 demos/effect/easing.html
  16. +2 −0  demos/index.html
  17. +15 −12 demos/position/cycler.html
  18. +1 −1  demos/sortable/connect-lists.html
  19. +9 −2 external/qunit.css
  20. +647 −440 external/qunit.js
  21. +122 −121 tests/jquery.simulate.js
  22. +0 −17 tests/static/slider/default.html
  23. +0 −17 tests/static/slider/default_vertical.html
  24. +0 −17 tests/static/slider/slider_horizontal.html
  25. +0 −17 tests/static/slider/slider_horizontal_range.html
  26. +0 −17 tests/static/slider/slider_horizontal_range_max.html
  27. +0 −17 tests/static/slider/slider_horizontal_range_min.html
  28. +0 −17 tests/static/slider/slider_vertical.html
  29. +0 −17 tests/static/slider/slider_vertical_range.html
  30. +0 −17 tests/static/slider/slider_vertical_range_max.html
  31. +0 −17 tests/static/slider/slider_vertical_range_min.html
  32. +6 −6 tests/unit/accordion/accordion.html
  33. +0 −7 tests/unit/accordion/accordion_core.js
  34. +1 −1  tests/unit/accordion/accordion_defaults.js
  35. +1 −0  tests/unit/accordion/accordion_defaults_deprecated.js
  36. +6 −6 tests/unit/accordion/accordion_deprecated.html
  37. +6 −6 tests/unit/accordion/accordion_events.js
  38. +3 −3 tests/unit/accordion/accordion_test_helpers.js
  39. +72 −0 tests/unit/all-active.html
  40. +0 −39 tests/unit/autocomplete/autocomplete_core.js
  41. +4 −1 tests/unit/autocomplete/autocomplete_events.js
  42. +54 −0 tests/unit/autocomplete/autocomplete_options.js
  43. +12 −12 tests/unit/button/button_core.js
  44. +19 −19 tests/unit/button/button_options.js
  45. +35 −35 tests/unit/core/core.js
  46. +35 −35 tests/unit/datepicker/datepicker_core.js
  47. +25 −25 tests/unit/datepicker/datepicker_events.js
  48. +155 −155 tests/unit/datepicker/datepicker_options.js
  49. +8 −8 tests/unit/datepicker/datepicker_tickets.js
  50. +9 −9 tests/unit/dialog/dialog_core.js
  51. +42 −42 tests/unit/dialog/dialog_events.js
  52. +15 −15 tests/unit/dialog/dialog_methods.js
  53. +77 −77 tests/unit/dialog/dialog_options.js
  54. +8 −8 tests/unit/dialog/dialog_tickets.js
  55. +1 −1  tests/unit/draggable/draggable_core.js
  56. +9 −9 tests/unit/draggable/draggable_events.js
  57. +9 −9 tests/unit/draggable/draggable_methods.js
  58. +74 −74 tests/unit/draggable/draggable_options.js
  59. +10 −10 tests/unit/droppable/droppable_methods.js
  60. +2 −2 tests/unit/droppable/droppable_options.js
  61. +6 −6 tests/unit/menu/menu_core.js
  62. +4 −1 tests/unit/menu/menu_defaults.js
  63. +198 −169 tests/unit/menu/menu_events.js
  64. +4 −4 tests/unit/menu/menu_methods.js
  65. +2 −2 tests/unit/menu/menu_options.js
  66. +35 −35 tests/unit/position/position_core.js
  67. +28 −28 tests/unit/position/position_core_within.js
  68. +3 −3 tests/unit/position/position_deprecated.js
  69. +7 −7 tests/unit/progressbar/progressbar_core.js
  70. +5 −5 tests/unit/progressbar/progressbar_events.js
  71. +5 −5 tests/unit/progressbar/progressbar_methods.js
  72. +5 −5 tests/unit/progressbar/progressbar_options.js
  73. +25 −25 tests/unit/resizable/resizable_core.js
  74. +3 −3 tests/unit/resizable/resizable_methods.js
  75. +52 −52 tests/unit/resizable/resizable_options.js
  76. +2 −2 tests/unit/selectable/selectable_events.js
  77. +9 −9 tests/unit/selectable/selectable_methods.js
  78. +4 −4 tests/unit/selectable/selectable_options.js
  79. +34 −34 tests/unit/slider/slider_core.js
  80. +11 −11 tests/unit/slider/slider_events.js
  81. +14 −14 tests/unit/slider/slider_methods.js
  82. +13 −13 tests/unit/slider/slider_options.js
  83. +9 −9 tests/unit/sortable/sortable_methods.js
  84. +2 −2 tests/unit/sortable/sortable_tickets.js
  85. +29 −29 tests/unit/spinner/spinner_methods.js
  86. +18 −18 tests/unit/spinner/spinner_options.js
  87. +3 −3 tests/unit/tabs/tabs.html
  88. +5 −4 tests/unit/tabs/tabs_core.js
  89. +3 −3 tests/unit/tabs/tabs_deprecated.html
  90. +65 −65 tests/unit/tabs/tabs_deprecated.js
  91. +59 −59 tests/unit/tabs/tabs_events.js
  92. +14 −14 tests/unit/tabs/tabs_methods.js
  93. +11 −11 tests/unit/tabs/tabs_options.js
  94. +4 −4 tests/unit/testsuite.js
  95. +1 −0  tests/unit/tooltip/tooltip_core.js
  96. +7 −7 tests/unit/tooltip/tooltip_events.js
  97. +2 −2 tests/unit/tooltip/tooltip_methods.js
  98. +7 −7 tests/unit/tooltip/tooltip_options.js
  99. +168 −108 tests/unit/widget/widget_core.js
  100. +95 −0 tests/visual/accordion/accordion.html
  101. +50 −2,942 tests/visual/dialog/dialog_on_page_with_large_dom.html
  102. +7 −7 tests/visual/menu/drilldown.html
  103. +6 −5 tests/visual/menu/menu.html
  104. +22 −15 tests/visual/tooltip/tooltip.html
  105. +6 −11 themes/base/jquery.ui.accordion.css
  106. +1 −1  themes/base/jquery.ui.all.css
  107. +1 −1  themes/base/jquery.ui.autocomplete.css
  108. +1 −1  themes/base/jquery.ui.base.css
  109. +1 −1  themes/base/jquery.ui.button.css
  110. +1 −1  themes/base/jquery.ui.core.css
  111. +1 −1  themes/base/jquery.ui.datepicker.css
  112. +1 −1  themes/base/jquery.ui.dialog.css
  113. +2 −2 themes/base/jquery.ui.menu.css
  114. +1 −1  themes/base/jquery.ui.progressbar.css
  115. +1 −1  themes/base/jquery.ui.resizable.css
  116. +1 −1  themes/base/jquery.ui.selectable.css
  117. +1 −1  themes/base/jquery.ui.slider.css
  118. +1 −1  themes/base/jquery.ui.spinner.css
  119. +1 −1  themes/base/jquery.ui.tabs.css
  120. +1 −1  themes/base/jquery.ui.theme.css
  121. +1 −1  themes/base/jquery.ui.tooltip.css
  122. +15 −15 ui/i18n/jquery.ui.datepicker-bg.js
  123. +1 −1  ui/i18n/jquery.ui.datepicker-cs.js
  124. +8 −8 ui/i18n/jquery.ui.datepicker-da.js
  125. +1 −1  ui/i18n/jquery.ui.datepicker-et.js
  126. +7 −7 ui/i18n/jquery.ui.datepicker-fi.js
  127. +2 −2 ui/i18n/jquery.ui.datepicker-fr.js
  128. +2 −2 ui/i18n/jquery.ui.datepicker-he.js
  129. +23 −0 ui/i18n/jquery.ui.datepicker-hi.js
  130. +23 −0 ui/i18n/jquery.ui.datepicker-km.js
  131. +18 −18 ui/i18n/jquery.ui.datepicker-no.js
  132. +8 −8 ui/i18n/jquery.ui.datepicker-sv.js
  133. +2 −2 ui/jquery.effects.blind.js
  134. +1 −1  ui/jquery.effects.bounce.js
  135. +1 −1  ui/jquery.effects.clip.js
  136. +38 −218 ui/jquery.effects.core.js
  137. +1 −1  ui/jquery.effects.drop.js
  138. +1 −1  ui/jquery.effects.explode.js
  139. +1 −1  ui/jquery.effects.fade.js
  140. +1 −1  ui/jquery.effects.fold.js
  141. +1 −1  ui/jquery.effects.highlight.js
  142. +1 −1  ui/jquery.effects.pulsate.js
  143. +1 −1  ui/jquery.effects.scale.js
  144. +1 −1  ui/jquery.effects.shake.js
  145. +1 −1  ui/jquery.effects.slide.js
  146. +1 −1  ui/jquery.effects.transfer.js
  147. +152 −205 ui/jquery.ui.accordion.js
  148. +40 −20 ui/jquery.ui.autocomplete.js
  149. +9 −9 ui/jquery.ui.button.js
  150. +9 −19 ui/jquery.ui.core.js
  151. +15 −16 ui/jquery.ui.datepicker.js
  152. +1 −1  ui/jquery.ui.dialog.js
  153. +1 −1  ui/jquery.ui.droppable.js
  154. +41 −34 ui/jquery.ui.menu.js
  155. +10 −10 ui/jquery.ui.mouse.js
  156. +6 −6 ui/jquery.ui.position.js
  157. +1 −1  ui/jquery.ui.progressbar.js
  158. +32 −66 ui/jquery.ui.resizable.js
  159. +1 −1  ui/jquery.ui.selectable.js
  160. +19 −23 ui/jquery.ui.slider.js
  161. +3 −3 ui/jquery.ui.sortable.js
  162. +1 −1  ui/jquery.ui.spinner.js
  163. +128 −148 ui/jquery.ui.tabs.js
  164. +21 −11 ui/jquery.ui.tooltip.js
  165. +67 −34 ui/jquery.ui.widget.js
View
2  MIT-LICENSE.txt
@@ -1,4 +1,4 @@
-Copyright (c) 2011 Paul Bakaus, http://jqueryui.com/
+Copyright (c) 2012 Paul Bakaus, http://jqueryui.com/
This software consists of voluntary contributions made by many
individuals (AUTHORS.txt, http://jqueryui.com/about) For exact
View
8 demos/accordion/collapsible.html
@@ -22,15 +22,15 @@
<div class="demo">
<div id="accordion">
- <h3><a href="#">Section 1</a></h3>
+ <h3>Section 1</h3>
<div>
<p>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.</p>
</div>
- <h3><a href="#">Section 2</a></h3>
+ <h3>Section 2</h3>
<div>
<p>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. </p>
</div>
- <h3><a href="#">Section 3</a></h3>
+ <h3>Section 3</h3>
<div>
<p>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. </p>
<ul>
@@ -39,7 +39,7 @@
<li>List item three</li>
</ul>
</div>
- <h3><a href="#">Section 4</a></h3>
+ <h3>Section 4</h3>
<div>
<p>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. </p><p>Suspendisse eu nisl. Nullam ut libero. Integer dignissim consequat lectus. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. </p>
</div>
View
8 demos/accordion/custom-icons.html
@@ -32,15 +32,15 @@
<div class="demo">
<div id="accordion">
- <h3><a href="#">Section 1</a></h3>
+ <h3>Section 1</h3>
<div>
<p>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.</p>
</div>
- <h3><a href="#">Section 2</a></h3>
+ <h3>Section 2</h3>
<div>
<p>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. </p>
</div>
- <h3><a href="#">Section 3</a></h3>
+ <h3>Section 3</h3>
<div>
<p>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. </p>
<ul>
@@ -49,7 +49,7 @@
<li>List item three</li>
</ul>
</div>
- <h3><a href="#">Section 4</a></h3>
+ <h3>Section 4</h3>
<div>
<p>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. </p><p>Suspendisse eu nisl. Nullam ut libero. Integer dignissim consequat lectus. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. </p>
</div>
View
8 demos/accordion/default.html
@@ -20,7 +20,7 @@
<div class="demo">
<div id="accordion">
- <h3><a href="#">Section 1</a></h3>
+ <h3>Section 1</h3>
<div>
<p>
Mauris mauris ante, blandit et, ultrices a, suscipit eget, quam. Integer
@@ -29,7 +29,7 @@
odio. Curabitur malesuada. Vestibulum a velit eu ante scelerisque vulputate.
</p>
</div>
- <h3><a href="#">Section 2</a></h3>
+ <h3>Section 2</h3>
<div>
<p>
Sed non urna. Donec et ante. Phasellus eu ligula. Vestibulum sit amet
@@ -38,7 +38,7 @@
suscipit faucibus urna.
</p>
</div>
- <h3><a href="#">Section 3</a></h3>
+ <h3>Section 3</h3>
<div>
<p>
Nam enim risus, molestie et, porta ac, aliquam ac, risus. Quisque lobortis.
@@ -52,7 +52,7 @@
<li>List item three</li>
</ul>
</div>
- <h3><a href="#">Section 4</a></h3>
+ <h3>Section 4</h3>
<div>
<p>
Cras dictum. Pellentesque habitant morbi tristique senectus et netus
View
8 demos/accordion/fillspace.html
@@ -37,15 +37,15 @@ <h3 class="docs">Resize the outer container:</h3>
<div id="accordionResizer" style="padding:10px; width:350px; height:220px;" class="ui-widget-content">
<div id="accordion">
- <h3><a href="#">Section 1</a></h3>
+ <h3>Section 1</h3>
<div>
<p>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.</p>
</div>
- <h3><a href="#">Section 2</a></h3>
+ <h3>Section 2</h3>
<div>
<p>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. </p>
</div>
- <h3><a href="#">Section 3</a></h3>
+ <h3>Section 3</h3>
<div>
<p>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. </p>
<ul>
@@ -54,7 +54,7 @@ <h3 class="docs">Resize the outer container:</h3>
<li>List item three</li>
</ul>
</div>
- <h3><a href="#">Section 4</a></h3>
+ <h3>Section 4</h3>
<div>
<p>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. </p><p>Suspendisse eu nisl. Nullam ut libero. Integer dignissim consequat lectus. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. </p>
</div>
View
12 demos/accordion/hoverintent.html
@@ -29,7 +29,7 @@
$( this ).unbind( "mouseover", jQuery.event.special.hoverintent.handler );
},
handler: function( event ) {
- var self = this,
+ var that = this,
args = arguments,
target = $( event.target ),
cX, cY, pX, pY;
@@ -54,7 +54,7 @@
// is fired asynchronously and the old event is no longer
// usable (#6028)
event.originalEvent = {};
- jQuery.event.handle.apply( self, args );
+ jQuery.event.handle.apply( that, args );
} else {
pX = cX;
pY = cY;
@@ -73,7 +73,7 @@
<div class="demo">
<div id="accordion">
- <h3><a href="#">Section 1</a></h3>
+ <h3>Section 1</h3>
<div>
<p>
Mauris mauris ante, blandit et, ultrices a, suscipit eget, quam. Integer
@@ -82,7 +82,7 @@
odio. Curabitur malesuada. Vestibulum a velit eu ante scelerisque vulputate.
</p>
</div>
- <h3><a href="#">Section 2</a></h3>
+ <h3>Section 2</h3>
<div>
<p>
Sed non urna. Donec et ante. Phasellus eu ligula. Vestibulum sit amet
@@ -91,7 +91,7 @@
suscipit faucibus urna.
</p>
</div>
- <h3><a href="#">Section 3</a></h3>
+ <h3>Section 3</h3>
<div>
<p>
Nam enim risus, molestie et, porta ac, aliquam ac, risus. Quisque lobortis.
@@ -105,7 +105,7 @@
<li>List item three</li>
</ul>
</div>
- <h3><a href="#">Section 4</a></h3>
+ <h3>Section 4</h3>
<div>
<p>
Cras dictum. Pellentesque habitant morbi tristique senectus et netus
View
1  demos/accordion/index.html
@@ -14,7 +14,6 @@
<li><a href="fillspace.html">Fill space</a></li>
<li><a href="no-auto-height.html">No auto height</a></li>
<li><a href="collapsible.html">Collapse content</a></li>
- <li><a href="mouseover.html">Open on mouseover</a></li>
<li><a href="hoverintent.html">Open on hoverintent</a></li>
<li><a href="custom-icons.html">Customize icons</a></li>
<li><a href="sortable.html">Sortable</a></li>
View
57 demos/accordion/mouseover.html
@@ -1,57 +0,0 @@
-<!DOCTYPE html>
-<html lang="en">
-<head>
- <meta charset="utf-8">
- <title>jQuery UI Accordion - Open on mouseover</title>
- <link rel="stylesheet" href="../../themes/base/jquery.ui.all.css">
- <script src="../../jquery-1.7.1.js"></script>
- <script src="../../ui/jquery.ui.core.js"></script>
- <script src="../../ui/jquery.ui.widget.js"></script>
- <script src="../../ui/jquery.ui.accordion.js"></script>
- <link rel="stylesheet" href="../demos.css">
- <script>
- $(function() {
- $( "#accordion" ).accordion({
- event: "mouseover"
- });
- });
- </script>
-</head>
-<body>
-
-<div class="demo">
-
-<div id="accordion">
- <h3><a href="#">Section 1</a></h3>
- <div>
- <p>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.</p>
- </div>
- <h3><a href="#">Section 2</a></h3>
- <div>
- <p>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. </p>
- </div>
- <h3><a href="#">Section 3</a></h3>
- <div>
- <p>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. </p>
- <ul>
- <li>List item one</li>
- <li>List item two</li>
- <li>List item three</li>
- </ul>
- </div>
- <h3><a href="#">Section 4</a></h3>
- <div>
- <p>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. </p><p>Suspendisse eu nisl. Nullam ut libero. Integer dignissim consequat lectus. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. </p>
- </div>
-</div>
-
-</div><!-- End demo -->
-
-
-
-<div class="demo-description">
-<p>Toggle sections open/closed on mouseover with the <code>event</code> option. The default value for event is "click."</p>
-</div><!-- End demo-description -->
-
-</body>
-</html>
View
7 demos/accordion/no-auto-height.html
@@ -22,15 +22,15 @@
<div class="demo">
<div id="accordion">
- <h3><a href="#section1">Section 1</a></h3>
+ <h3>Section 1</h3>
<div>
<p>Mauris mauris ante, blandit et, ultrices a, susceros. Nam mi. Proin viverra leo ut odio. Curabitur malesuada. Vestibulum a velit eu ante scelerisque vulputate.</p>
</div>
- <h3><a href="#section2">Section 2</a></h3>
+ <h3>Section 2</h3>
<div>
<p>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. </p>
</div>
- <h3><a href="#section3">Section 3</a></h3>
+ <h3>Section 3</h3>
<div>
<p>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. </p>
<ul>
@@ -42,7 +42,6 @@
<li>List item</li>
<li>List item</li>
</ul>
- <a href="#othercontent">Link to other content</a>
</div>
</div>
View
34 demos/accordion/sortable.html
@@ -11,16 +11,12 @@
<script src="../../ui/jquery.ui.sortable.js"></script>
<script src="../../ui/jquery.ui.accordion.js"></script>
<link rel="stylesheet" href="../demos.css">
+ <style>
+ /* IE has layout issues when sorting (see #5413) */
+ .group { zoom: 1 }
+ </style>
<script>
$(function() {
- var stop = false;
- $( "#accordion h3" ).click(function( event ) {
- if ( stop ) {
- event.stopImmediatePropagation();
- event.preventDefault();
- stop = false;
- }
- });
$( "#accordion" )
.accordion({
header: "> div > h3"
@@ -28,8 +24,10 @@
.sortable({
axis: "y",
handle: "h3",
- stop: function() {
- stop = true;
+ stop: function( event, ui ) {
+ // IE doesn't register the blur when sorting
+ // so trigger focusout handlers to remove .ui-state-focus
+ ui.item.children( "h3" ).triggerHandler( "focusout" );
}
});
});
@@ -40,20 +38,20 @@
<div class="demo">
<div id="accordion">
- <div>
- <h3><a href="#">Section 1</a></h3>
+ <div class="group">
+ <h3>Section 1</h3>
<div>
<p>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.</p>
</div>
</div>
- <div>
- <h3><a href="#">Section 2</a></h3>
+ <div class="group">
+ <h3>Section 2</h3>
<div>
<p>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. </p>
</div>
</div>
- <div>
- <h3><a href="#">Section 3</a></h3>
+ <div class="group">
+ <h3>Section 3</h3>
<div>
<p>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. </p>
<ul>
@@ -63,8 +61,8 @@
</ul>
</div>
</div>
- <div>
- <h3><a href="#">Section 4</a></h3>
+ <div class="group">
+ <h3>Section 4</h3>
<div>
<p>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. </p><p>Suspendisse eu nisl. Nullam ut libero. Integer dignissim consequat lectus. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. </p>
</div>
View
2  demos/addClass/default.html
@@ -33,7 +33,7 @@
<div class="demo">
<div class="toggler">
- <div id="effect" class=" ui-corner-all">
+ <div id="effect" class="ui-corner-all">
Etiam libero neque, luctus a, eleifend nec, semper at, lorem. Sed pede.
</div>
</div>
View
4 demos/autocomplete/categories.html
@@ -22,14 +22,14 @@
<script>
$.widget( "custom.catcomplete", $.ui.autocomplete, {
_renderMenu: function( ul, items ) {
- var self = this,
+ var that = this,
currentCategory = "";
$.each( items, function( index, item ) {
if ( item.category != currentCategory ) {
ul.append( "<li class='ui-autocomplete-category'>" + item.category + "</li>" );
currentCategory = item.category;
}
- self._renderItem( ul, item );
+ that._renderItem( ul, item );
});
}
});
View
4 demos/autocomplete/combobox.html
@@ -29,7 +29,7 @@
(function( $ ) {
$.widget( "ui.combobox", {
_create: function() {
- var self = this,
+ var that = this,
select = this.element.hide(),
selected = select.children( ":selected" ),
value = selected.val() ? selected.text() : "";
@@ -85,7 +85,7 @@
},
select: function( event, ui ) {
ui.item.option.selected = true;
- self._trigger( "selected", event, {
+ that._trigger( "selected", event, {
item: ui.item.option
});
},
View
4 demos/datepicker/localization.html
@@ -34,6 +34,7 @@
<script src="../../ui/i18n/jquery.ui.datepicker-fr-CH.js"></script>
<script src="../../ui/i18n/jquery.ui.datepicker-gl.js"></script>
<script src="../../ui/i18n/jquery.ui.datepicker-he.js"></script>
+ <script src="../../ui/i18n/jquery.ui.datepicker-hi.js"></script>
<script src="../../ui/i18n/jquery.ui.datepicker-hr.js"></script>
<script src="../../ui/i18n/jquery.ui.datepicker-hu.js"></script>
<script src="../../ui/i18n/jquery.ui.datepicker-hy.js"></script>
@@ -42,6 +43,7 @@
<script src="../../ui/i18n/jquery.ui.datepicker-it.js"></script>
<script src="../../ui/i18n/jquery.ui.datepicker-ja.js"></script>
<script src="../../ui/i18n/jquery.ui.datepicker-kk.js"></script>
+ <script src="../../ui/i18n/jquery.ui.datepicker-km.js"></script>
<script src="../../ui/i18n/jquery.ui.datepicker-ko.js"></script>
<script src="../../ui/i18n/jquery.ui.datepicker-lb.js"></script>
<script src="../../ui/i18n/jquery.ui.datepicker-lt.js"></script>
@@ -123,12 +125,14 @@
<option value="de">German (Deutsch)</option>
<option value="el">Greek (&#917;&#955;&#955;&#951;&#957;&#953;&#954;&#940;)</option>
<option value="he">Hebrew (&#8235;(&#1506;&#1489;&#1512;&#1497;&#1514;</option>
+ <option value="hi">Hindi (&#2361;&#2367;&#2306;&#2342;&#2368;)</option>
<option value="hu">Hungarian (Magyar)</option>
<option value="is">Icelandic (&Otilde;slenska)</option>
<option value="id">Indonesian (Bahasa Indonesia)</option>
<option value="it">Italian (Italiano)</option>
<option value="ja">Japanese (&#26085;&#26412;&#35486;)</option>
<option value="kk">Kazakhstan (Kazakh)</option>
+ <option value="km">Khmer</option>
<option value="ko">Korean (&#54620;&#44397;&#50612;)</option>
<option value="lv">Latvian (Latvie&ouml;u Valoda)</option>
<option value="lt">Lithuanian (lietuviu kalba)</option>
View
35 demos/effect/easing.html
@@ -15,10 +15,9 @@
</style>
<script>
$(function() {
- if ( !$( "<canvas/>" )[0].getContext ) {
- $( "<div/>" ).text(
- "Your browser doesn't support canvas, which is required for this demo. " +
- "Give Firefox 3 a try!"
+ if ( !$( "<canvas>" )[0].getContext ) {
+ $( "<div>" ).text(
+ "Your browser doesn't support canvas, which is required for this demo."
).appendTo( "#graphs" );
return;
}
@@ -26,15 +25,13 @@
var i = 0,
width = 100,
height = 100;
+
$.each( $.easing, function( name, impl ) {
- // skip linear/jswing and any non functioning implementation
- if ( !$.isFunction( impl ) || /jswing/.test( name ) ) {
- return;
- }
- var graph = $( "<div/>" ).addClass( "graph" ).appendTo( "#graphs" ),
- text = $( "<div/>" ).text( ++i + ". " + name ).appendTo( graph ),
- wrap = $( "<div/>" ).appendTo( graph ).css( 'overflow', 'hidden' ),
- canvas = $( "<canvas/>" ).appendTo( wrap )[ 0 ];
+ var graph = $( "<div>" ).addClass( "graph" ).appendTo( "#graphs" ),
+ text = $( "<div>" ).text( ++i + ". " + name ).appendTo( graph ),
+ wrap = $( "<div>" ).appendTo( graph ).css( 'overflow', 'hidden' ),
+ canvas = $( "<canvas>" ).appendTo( wrap )[ 0 ];
+
canvas.width = width;
canvas.height = height;
var drawHeight = height * 0.8,
@@ -42,6 +39,7 @@
ctx = canvas.getContext( "2d" );
ctx.fillStyle = "black";
+ // draw background
ctx.beginPath();
ctx.moveTo( cradius, 0 );
ctx.quadraticCurveTo( 0, 0, 0, cradius );
@@ -53,31 +51,34 @@
ctx.lineTo( cradius, 0 );
ctx.fill();
+ // draw bottom line
ctx.strokeStyle = "#555";
ctx.beginPath();
ctx.moveTo( width * 0.1, drawHeight + .5 );
ctx.lineTo( width * 0.9, drawHeight + .5 );
ctx.stroke();
+ // draw top line
ctx.strokeStyle = "#555";
ctx.beginPath();
ctx.moveTo( width * 0.1, drawHeight * .3 - .5 );
ctx.lineTo( width * 0.9, drawHeight * .3 - .5 );
ctx.stroke();
-
+
+ // plot easing
ctx.strokeStyle = "white";
ctx.beginPath();
ctx.lineWidth = 2;
ctx.moveTo( width * 0.1, drawHeight );
$.each( new Array( width ), function( position ) {
- var val = impl( 0, position, 0, 1, height );
- if ( /linear|jswing/.test( name ) ) {
- val = position / width;
- }
+ var state = position / width,
+ val = impl( state, position, 0, 1, width );
ctx.lineTo( position * 0.8 + width * 0.1,
drawHeight - drawHeight * val * 0.7 );
});
ctx.stroke();
+
+ // animate on click
graph.click(function() {
wrap
.animate( { height: "hide" }, 2000, name )
View
2  demos/index.html
@@ -69,6 +69,7 @@
<script src="../ui/i18n/jquery.ui.datepicker-fr-CH.js"></script>
<script src="../ui/i18n/jquery.ui.datepicker-gl.js"></script>
<script src="../ui/i18n/jquery.ui.datepicker-he.js"></script>
+ <script src="../ui/i18n/jquery.ui.datepicker-hi.js"></script>
<script src="../ui/i18n/jquery.ui.datepicker-hr.js"></script>
<script src="../ui/i18n/jquery.ui.datepicker-hu.js"></script>
<script src="../ui/i18n/jquery.ui.datepicker-hy.js"></script>
@@ -77,6 +78,7 @@
<script src="../ui/i18n/jquery.ui.datepicker-it.js"></script>
<script src="../ui/i18n/jquery.ui.datepicker-ja.js"></script>
<script src="../ui/i18n/jquery.ui.datepicker-kk.js"></script>
+ <script src="../ui/i18n/jquery.ui.datepicker-km.js"></script>
<script src="../ui/i18n/jquery.ui.datepicker-ko.js"></script>
<script src="../ui/i18n/jquery.ui.datepicker-lb.js"></script>
<script src="../ui/i18n/jquery.ui.datepicker-lt.js"></script>
View
27 demos/position/cycler.html
@@ -17,6 +17,7 @@
</style>
<script>
$(function() {
+ // TODO refactor into a widget and get rid of these plugin methods
$.fn.position2 = function( options ) {
return this.position( $.extend({
of: window,
@@ -52,10 +53,6 @@
});
};
- $( "img:eq(0)" ).left();
- $( "img:eq(1)" ).center();
- $( "img:eq(2)" ).right();
-
$( "body" ).css({
overflow: "hidden"
})
@@ -66,15 +63,21 @@
position: "absolute",
});
+ $( "img:eq(0)" ).left();
+ $( "img:eq(1)" ).center();
+ $( "img:eq(2)" ).right();
+
function animate( to ) {
- $(this).animate( to );
+ $(this).stop( true, false ).animate( to );
}
- function next() {
+ function next( event ) {
+ event.preventDefault();
$( "img:eq(2)" ).center( animate );
$( "img:eq(1)" ).left( animate )
$( "img:eq(0)" ).right().appendTo( ".demo" );
}
- function previous() {
+ function previous( event ) {
+ event.preventDefault();
$( "img:eq(0)" ).center( animate );
$( "img:eq(1)" ).right( animate );
$( "img:eq(2)" ).left().prependTo( ".demo" );
@@ -82,8 +85,8 @@
$( "#previous" ).click( previous );
$( "#next" ).click( next );
- $( ".demo img" ).click(function() {
- $( ".demo img" ).index( this ) === 0 ? previous() : next();
+ $( ".demo img" ).click(function( event ) {
+ $( ".demo img" ).index( this ) === 0 ? previous( event ) : next( event );
});
$( window ).resize(function() {
@@ -98,9 +101,9 @@
<div class="demo">
-<img src="images/earth.jpg" />
-<img src="images/flight.jpg" />
-<img src="images/rocket.jpg" />
+<img src="images/earth.jpg" width="458" height="308" />
+<img src="images/flight.jpg" width="512" height="307" />
+<img src="images/rocket.jpg" width="300" height="353" />
<a id="previous" href="#">Previous</a>
<a id="next" href="#">Next</a>
View
2  demos/sortable/connect-lists.html
@@ -11,7 +11,7 @@
<script src="../../ui/jquery.ui.sortable.js"></script>
<link rel="stylesheet" href="../demos.css">
<style>
- #sortable1, #sortable2 { list-style-type: none; margin: 0; padding: 0; float: left; margin-right: 10px; }
+ #sortable1, #sortable2 { list-style-type: none; margin: 0; padding: 0 0 2.5em; float: left; margin-right: 10px; }
#sortable1 li, #sortable2 li { margin: 0 5px 5px 5px; padding: 5px; font-size: 1.2em; width: 120px; }
</style>
<script>
View
11 external/qunit.css
@@ -1,9 +1,9 @@
/**
- * QUnit - A JavaScript Unit Testing Framework
+ * QUnit v1.4.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;
}
View
1,087 external/qunit.js
@@ -1,9 +1,9 @@
/**
- * QUnit - A JavaScript Unit Testing Framework
+ * QUnit v1.4.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,29 +75,31 @@ 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??
QUnit.current_testEnvironment = this.testEnvironment;
+ if ( !config.pollution ) {
+ saveGlobal();
+ }
+ if ( config.notrycatch ) {
+ this.testEnvironment.setup.call(this.testEnvironment);
+ return;
+ }
try {
- if ( !config.pollution ) {
- saveGlobal();
- }
-
this.testEnvironment.setup.call(this.testEnvironment);
} catch(e) {
- QUnit.ok( false, "Setup failed on " + this.testName + ": " + e.message );
+ QUnit.pushFailure( "Setup failed on " + this.testName + ": " + e.message, extractStacktrace( e, 1 ) );
}
},
run: function() {
+ config.current = this;
if ( this.async ) {
QUnit.stop();
}
@@ -101,43 +111,52 @@ Test.prototype = {
try {
this.callback.call(this.testEnvironment);
} catch(e) {
- fail("Test " + this.testName + " died, exception and test follows", e, this.callback);
- QUnit.ok( false, "Died on test #" + (this.assertions.length + 1) + ": " + e.message + " - " + QUnit.jsDump.parse(e) );
+ QUnit.pushFailure( "Died on test #" + (this.assertions.length + 1) + ": " + e.message, extractStacktrace( e, 1 ) );
// else next test will carry the responsibility
saveGlobal();
// Restart the tests if they're blocking
if ( config.blocking ) {
- start();
+ QUnit.start();
}
}
},
teardown: function() {
- try {
+ config.current = this;
+ if ( config.notrycatch ) {
this.testEnvironment.teardown.call(this.testEnvironment);
- checkPollution();
- } catch(e) {
- QUnit.ok( false, "Teardown failed on " + this.testName + ": " + e.message );
+ return;
+ } else {
+ try {
+ this.testEnvironment.teardown.call(this.testEnvironment);
+ } catch(e) {
+ QUnit.pushFailure( "Teardown failed on " + this.testName + ": " + e.message, extractStacktrace( e, 1 ) );
+ }
}
+ checkPollution();
},
finish: function() {
- if ( this.expected && this.expected != this.assertions.length ) {
- QUnit.ok( false, "Expected " + this.expected + " assertions, but " + this.assertions.length + " were run" );
+ config.current = this;
+ if ( this.expected != null && this.expected != this.assertions.length ) {
+ QUnit.pushFailure( "Expected " + this.expected + " assertions, but " + this.assertions.length + " were run" );
+ } else if ( this.expected == null && !this.assertions.length ) {
+ QUnit.pushFailure( "Expected at least one assertion, but none were run - call expect(0) to accept zero assertions." );
}
var good = 0, bad = 0,
+ li, i,
tests = id("qunit-tests");
config.stats.all += this.assertions.length;
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++ ) {
+ for ( i = 0; i < this.assertions.length; i++ ) {
var assertion = this.assertions[i];
- var li = document.createElement("li");
+ li = document.createElement("li");
li.className = assertion.result ? "pass" : "fail";
li.innerHTML = assertion.message || (assertion.result ? "okay" : "failed");
ol.appendChild( li );
@@ -154,13 +173,13 @@ Test.prototype = {
// store result when possible
if ( QUnit.config.reorder && defined.sessionStorage ) {
if (bad) {
- sessionStorage.setItem("qunit-" + this.module + "-" + this.testName, bad);
+ sessionStorage.setItem("qunit-test-" + this.module + "-" + this.testName, bad);
} else {
- sessionStorage.removeItem("qunit-" + this.module + "-" + this.testName);
+ sessionStorage.removeItem("qunit-test-" + this.module + "-" + this.testName);
}
}
- if (bad == 0) {
+ if (bad === 0) {
ol.style.display = "none";
}
@@ -187,7 +206,7 @@ Test.prototype = {
}
});
- var li = id(this.id);
+ li = id(this.id);
li.className = bad ? "fail" : "pass";
li.removeChild( li.firstChild );
li.appendChild( b );
@@ -195,7 +214,7 @@ Test.prototype = {
li.appendChild( ol );
} else {
- for ( var i = 0; i < this.assertions.length; i++ ) {
+ for ( i = 0; i < this.assertions.length; i++ ) {
if ( !this.assertions[i].result ) {
bad++;
config.stats.bad++;
@@ -204,14 +223,11 @@ Test.prototype = {
}
}
- try {
- QUnit.reset();
- } catch(e) {
- fail("reset() failed, following Test " + this.testName + ", exception and reset fn follows", e, QUnit.reset);
- }
+ QUnit.reset();
- QUnit.testDone( {
+ runLoggingCallbacks( 'testDone', QUnit, {
name: this.testName,
+ module: this.module,
failed: bad,
passed: this.assertions.length - bad,
total: this.assertions.length
@@ -239,12 +255,12 @@ Test.prototype = {
});
}
// defer when previous test run passed, if storage is available
- var bad = QUnit.config.reorder && defined.sessionStorage && +sessionStorage.getItem("qunit-" + this.module + "-" + this.testName);
+ var bad = QUnit.config.reorder && defined.sessionStorage && +sessionStorage.getItem("qunit-test-" + this.module + "-" + this.testName);
if (bad) {
run();
} else {
- synchronize(run);
- };
+ synchronize(run, true);
+ }
}
};
@@ -260,24 +276,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 = '<span class="test-name">' + testName + '</span>', testEnvironmentArg;
+ var name = '<span class="test-name">' + escapeInnerText(testName) + '</span>';
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 = '<span class="module-name">' + config.currentModule + "</span>: " + name;
@@ -287,49 +298,45 @@ 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();
},
- /**
- * Specify the number of expected assertions to gurantee that failed test (no assertions are run at all) don't slip through.
- */
+ // Specify the number of expected assertions to gurantee that failed test (no assertions are run at all) don't slip through.
expect: function(asserts) {
config.current.expected = asserts;
},
- /**
- * Asserts true.
- * @example ok( "asdfasdf".length > 5, "There must be at least 5 chars" );
- */
- ok: function(a, msg) {
- a = !!a;
+ // Asserts true.
+ // @example ok( "asdfasdf".length > 5, "There must be at least 5 chars" );
+ ok: function(result, msg) {
+ if (!config.current) {
+ throw new Error("ok() assertion outside test context, was " + sourceFromStacktrace(2));
+ }
+ result = !!result;
var details = {
- result: a,
+ result: result,
message: msg
};
- msg = escapeHtml(msg);
- QUnit.log(details);
+ msg = escapeInnerText(msg || (result ? "okay" : "failed"));
+ if ( !result ) {
+ var source = sourceFromStacktrace(2);
+ if (source) {
+ details.source = source;
+ msg += '<table><tr class="test-source"><th>Source: </th><td><pre>' + escapeInnerText(source) + '</pre></td></tr></table>';
+ }
+ }
+ runLoggingCallbacks( 'log', QUnit, details );
config.current.assertions.push({
- result: a,
+ result: result,
message: msg
});
},
- /**
- * Checks that the first two arguments are equal, with an optional message.
- * Prints out both actual and expected values.
- *
- * Prefered to ok( actual == expected, message )
- *
- * @example equal( format("Received {0} bytes.", 2), "Received 2 bytes." );
- *
- * @param Object actual
- * @param Object expected
- * @param String message (optional)
- */
+ // Checks that the first two arguments are equal, with an optional message. Prints out both actual and expected values.
+ // @example equal( format("Received {0} bytes.", 2), "Received 2 bytes." );
equal: function(actual, expected, message) {
QUnit.push(expected == actual, actual, expected, message);
},
@@ -387,8 +394,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 +407,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() {
+ QUnit.push(false, false, false, "QUnit.equals has been deprecated since 2009 (e88049a0), use QUnit.equal instead");
+};
+QUnit.same = function() {
+ QUnit.push(false, false, false, "QUnit.same has been deprecated since 2009 (e88049a0), use QUnit.deepEqual instead");
+};
// Maintain internal state
var config = {
@@ -439,12 +464,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 +502,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 ];
- }
}
}
@@ -472,17 +509,14 @@ var config = {
config.filter = urlParams.filter;
// Figure out if we're running the tests from a server or not
- QUnit.isLocal = !!(location.protocol === 'file:');
-})();
+ QUnit.isLocal = location.protocol === 'file:';
+}());
// Expose the API as global variables, unless an 'exports'
-// object exists, in that case we assume we're in CommonJS
+// object exists, in that case we assume we're in CommonJS - export everything at the end
if ( typeof exports === "undefined" || typeof require === "undefined" ) {
extend(window, QUnit);
window.QUnit = QUnit;
-} else {
- extend(exports, QUnit);
- exports.QUnit = QUnit;
}
// define these after exposing globals to keep them in these QUnit namespace only
@@ -494,7 +528,7 @@ extend(QUnit, {
extend(config, {
stats: { all: 0, bad: 0 },
moduleStats: { all: 0, bad: 0 },
- started: +new Date,
+ started: +new Date(),
updateRate: 1000,
blocking: false,
autostart: true,
@@ -504,6 +538,16 @@ extend(QUnit, {
semaphore: 0
});
+ var qunit = id( "qunit" );
+ if ( qunit ) {
+ qunit.innerHTML =
+ '<h1 id="qunit-header">' + escapeInnerText( document.title ) + '</h1>' +
+ '<h2 id="qunit-banner"></h2>' +
+ '<div id="qunit-testrunner-toolbar"></div>' +
+ '<h2 id="qunit-userAgent"></h2>' +
+ '<ol id="qunit-tests"></ol>';
+ }
+
var tests = id( "qunit-tests" ),
banner = id( "qunit-banner" ),
result = id( "qunit-testresult" );
@@ -529,11 +573,8 @@ extend(QUnit, {
}
},
- /**
- * Resets the test setup. Useful for tests that modify the DOM.
- *
- * If jQuery is available, uses jQuery's html(), otherwise just innerHTML.
- */
+ // Resets the test setup. Useful for tests that modify the DOM.
+ // If jQuery is available, uses jQuery's html(), otherwise just innerHTML.
reset: function() {
if ( window.jQuery ) {
jQuery( "#qunit-fixture" ).html( config.fixture );
@@ -545,14 +586,8 @@ extend(QUnit, {
}
},
- /**
- * Trigger an event on an element.
- *
- * @example triggerEvent( document.body, "click" );
- *
- * @param DOMElement elem
- * @param String type
- */
+ // Trigger an event on an element.
+ // @example triggerEvent( document.body, "click" );
triggerEvent: function( elem, type, event ) {
if ( document.createEvent ) {
event = document.createEvent("MouseEvents");
@@ -580,23 +615,21 @@ 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':
- if (isNaN(obj)) {
- return "nan";
- } else {
- return "number";
- }
- case 'String':
- case 'Boolean':
- case 'Array':
- case 'Date':
- case 'RegExp':
- case 'Function':
- return type.toLowerCase();
+ case 'Number':
+ if (isNaN(obj)) {
+ return "nan";
+ }
+ return "number";
+ case 'String':
+ case 'Boolean':
+ case 'Array':
+ case 'Date':
+ case 'RegExp':
+ case 'Function':
+ return type.toLowerCase();
}
if (typeof obj === "object") {
return "object";
@@ -605,6 +638,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 +648,26 @@ extend(QUnit, {
expected: expected
};
- message = escapeHtml(message) || (result ? "okay" : "failed");
+ message = escapeInnerText(message) || (result ? "okay" : "failed");
message = '<span class="test-message">' + message + "</span>";
- expected = escapeHtml(QUnit.jsDump.parse(expected));
- actual = escapeHtml(QUnit.jsDump.parse(actual));
- var output = message + '<table><tr class="test-expected"><th>Expected: </th><td><pre>' + expected + '</pre></td></tr>';
- if (actual != expected) {
- output += '<tr class="test-actual"><th>Result: </th><td><pre>' + actual + '</pre></td></tr>';
- output += '<tr class="test-diff"><th>Diff: </th><td><pre>' + QUnit.diff(expected, actual) +'</pre></td></tr>';
- }
+ var output = message;
if (!result) {
+ expected = escapeInnerText(QUnit.jsDump.parse(expected));
+ actual = escapeInnerText(QUnit.jsDump.parse(actual));
+ output += '<table><tr class="test-expected"><th>Expected: </th><td><pre>' + expected + '</pre></td></tr>';
+ if (actual != expected) {
+ output += '<tr class="test-actual"><th>Result: </th><td><pre>' + actual + '</pre></td></tr>';
+ output += '<tr class="test-diff"><th>Diff: </th><td><pre>' + QUnit.diff(expected, actual) +'</pre></td></tr>';
+ }
var source = sourceFromStacktrace();
if (source) {
details.source = source;
- output += '<tr class="test-source"><th>Source: </th><td><pre>' + escapeHtml(source) + '</pre></td></tr>';
+ output += '<tr class="test-source"><th>Source: </th><td><pre>' + escapeInnerText(source) + '</pre></td></tr>';
}
+ output += "</table>";
}
- output += "</table>";
- QUnit.log(details);
+ runLoggingCallbacks( 'log', QUnit, details );
config.current.assertions.push({
result: !!result,
@@ -638,11 +675,31 @@ extend(QUnit, {
});
},
+ pushFailure: function(message, source) {
+ var details = {
+ result: false,
+ message: message
+ };
+ var output = escapeInnerText(message);
+ if (source) {
+ details.source = source;
+ output += '<table><tr class="test-source"><th>Source: </th><td><pre>' + escapeInnerText(source) + '</pre></td></tr></table>';
+ }
+ runLoggingCallbacks( 'log', QUnit, details );
+ config.current.assertions.push({
+ result: false,
+ message: output
+ });
+ },
+
url: function( params ) {
params = extend( extend( {}, QUnit.urlParams ), params );
var querystring = "?",
key;
for ( key in params ) {
+ if ( !hasOwn.call( params, key ) ) {
+ continue;
+ }
querystring += encodeURIComponent( key ) + "=" +
encodeURIComponent( params[ key ] ) + "&";
}
@@ -651,31 +708,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 +746,20 @@ addEvent(window, "load", function() {
config.blocking = false;
+ var urlConfigHtml = '', len = config.urlConfig.length;
+ for ( var i = 0, val; i < len; i++ ) {
+ val = config.urlConfig[i];
+ config[val] = QUnit.urlParams[val];
+ urlConfigHtml += '<label><input name="' + val + '" type="checkbox"' + ( config[val] ? ' checked="checked"' : '' ) + '>' + val + '</label>';
+ }
+
var userAgent = id("qunit-userAgent");
if ( userAgent ) {
userAgent.innerHTML = navigator.userAgent;
}
var banner = id("qunit-header");
if ( banner ) {
- banner.innerHTML = '<a href="' + QUnit.url({ filter: undefined }) + '"> ' + banner.innerHTML + '</a> ' +
- '<label><input name="noglobals" type="checkbox"' + ( config.noglobals ? ' checked="checked"' : '' ) + '>noglobals</label>' +
- '<label><input name="notrycatch" type="checkbox"' + ( config.notrycatch ? ' checked="checked"' : '' ) + '>notrycatch</label>';
+ banner.innerHTML = '<a href="' + QUnit.url({ filter: undefined }) + '"> ' + banner.innerHTML + '</a> ' + urlConfigHtml;
addEvent( banner, "change", function( event ) {
var params = {};
params[ event.target.name ] = event.target.checked ? true : undefined;
@@ -715,13 +782,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";
@@ -742,14 +809,27 @@ addEvent(window, "load", function() {
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 ) {
+ QUnit.pushFailure( message, file + ":" + line );
+ } else {
+ QUnit.test( "global failure", function() {
+ QUnit.pushFailure( 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,
@@ -759,7 +839,7 @@ function done() {
var banner = id("qunit-banner"),
tests = id("qunit-tests"),
- runtime = +new Date - config.started,
+ runtime = +new Date() - config.started,
passed = config.stats.all - config.stats.bad,
html = [
'Tests completed in ',
@@ -782,13 +862,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-test-") === 0 ) {
+ sessionStorage.removeItem(key);
+ }
+ }
}
- QUnit.done( {
+ runLoggingCallbacks( 'done', QUnit, {
failed: config.stats.bad,
passed: passed,
total: config.stats.all,
@@ -822,30 +914,45 @@ 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 extractStacktrace( e, offset ) {
+ offset = offset || 3;
+ if (e.stacktrace) {
+ // Opera
+ return e.stacktrace.split("\n")[offset + 3];
+ } else if (e.stack) {
+ // Firefox, Chrome
+ var stack = e.stack.split("\n");
+ if (/^error$/i.test(stack[0])) {
+ stack.shift();
+ }
+ return stack[offset];
+ } else if (e.sourceURL) {
+ // Safari, PhantomJS
+ // hopefully one day Safari provides actual stacktraces
+ // exclude useless self-reference for generated Error objects
+ if ( /qunit.js$/.test( e.sourceURL ) ) {
+ return;
+ }
+ // for actual exceptions, this is useful
+ return e.sourceURL + ":" + e.line;
+ }
+}
+function sourceFromStacktrace(offset) {
try {
throw new Error();
} catch ( e ) {
- if (e.stacktrace) {
- // Opera
- return e.stacktrace.split("\n")[6];
- } else if (e.stack) {
- // Firefox, Chrome
- return e.stack.split("\n")[4];
- }
+ return extractStacktrace( e, offset );
}
}
-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 "&amp;";
- case "\\": return "\\\\";
- case '"': return '\"';
case "<": return "&lt;";
case ">": return "&gt;";
default: return s;
@@ -853,28 +960,33 @@ 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 ) {
+ function next() {
+ 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( next, 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 +994,9 @@ function saveGlobal() {
if ( config.noglobals ) {
for ( var key in window ) {
+ if ( !hasOwn.call( window, key ) ) {
+ continue;
+ }
config.pollution.push( key );
}
}
@@ -893,12 +1008,12 @@ function checkPollution( name ) {
var newGlobals = diff( config.pollution, old );
if ( newGlobals.length > 0 ) {
- ok( false, "Introduced global variable(s): " + newGlobals.join(", ") );
+ QUnit.pushFailure( "Introduced global variable(s): " + newGlobals.join(", ") );
}
var deletedGlobals = diff( old, config.pollution );
if ( deletedGlobals.length > 0 ) {
- ok( false, "Deleted global variable(s): " + deletedGlobals.join(", ") );
+ QUnit.pushFailure( "Deleted global variable(s): " + deletedGlobals.join(", ") );
}
}
@@ -917,22 +1032,13 @@ function diff( a, b ) {
return result;
}
-function fail(message, exception, callback) {
- if ( typeof console !== "undefined" && console.error && console.warn ) {
- console.error(message);
- console.error(exception);
- console.warn(callback.toString());
-
- } else if ( window.opera && opera.postError ) {
- opera.postError(message, exception, callback.toString);
- }
-}
-
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 +1061,214 @@ 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é <prathe@gmail.com>
-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;