Skip to content
Browse files

Merge branch 'master' into selectmenu

  • Loading branch information...
2 parents d1350f9 + 747d853 commit f6372bd7eac41ae2c022ef510ec414d016e820ed @fnagel fnagel committed Dec 12, 2012
Showing with 1,991 additions and 1,395 deletions.
  1. +1 −1 build/tasks/testswarm.js
  2. +7 −7 demos/button/toolbar.html
  3. +6 −0 demos/datepicker/localization.html
  4. +0 −34 demos/progressbar/animated.html
  5. +8 −8 demos/progressbar/indeterminate.html
  6. +1 −2 demos/progressbar/index.html
  7. +58 −0 demos/progressbar/label.html
  8. +0 −33 demos/progressbar/resize.html
  9. +2 −2 package.json
  10. +71 −18 tests/jquery.simulate.js
  11. +5 −1 tests/unit/autocomplete/autocomplete_options.js
  12. +70 −2 tests/unit/button/button_core.js
  13. +15 −5 tests/unit/button/button_events.js
  14. +11 −0 tests/unit/button/button_options.js
  15. +0 −75 tests/unit/button/button_tickets.js
  16. +4 −5 tests/unit/core/core.js
  17. +144 −109 tests/unit/datepicker/datepicker_core.js
  18. +123 −68 tests/unit/datepicker/datepicker_options.js
  19. +4 −0 tests/unit/dialog/dialog.html
  20. +4 −3 tests/unit/dialog/dialog_common.js
  21. +82 −28 tests/unit/dialog/dialog_core.js
  22. +2 −0 tests/unit/dialog/dialog_deprecated.html
  23. +14 −0 tests/unit/dialog/dialog_events.js
  24. +60 −1 tests/unit/dialog/dialog_methods.js
  25. +72 −0 tests/unit/dialog/dialog_options.js
  26. +3 −4 tests/unit/dialog/dialog_test_helpers.js
  27. +0 −132 tests/unit/dialog/dialog_tickets.js
  28. +11 −14 tests/unit/draggable/draggable_core.js
  29. +16 −4 tests/unit/draggable/draggable_events.js
  30. +96 −48 tests/unit/draggable/draggable_options.js
  31. +4 −7 tests/unit/draggable/draggable_test_helpers.js
  32. +108 −91 tests/unit/menu/menu_events.js
  33. +3 −1 tests/unit/progressbar/progressbar_common.js
  34. +9 −1 tests/unit/progressbar/progressbar_core.js
  35. +16 −10 tests/unit/progressbar/progressbar_events.js
  36. +1 −1 tests/unit/progressbar/progressbar_methods.js
  37. +17 −25 tests/unit/progressbar/progressbar_options.js
  38. +16 −10 tests/unit/resizable/resizable.html
  39. +25 −21 tests/unit/resizable/resizable_events.js
  40. +55 −0 tests/unit/resizable/resizable_options.js
  41. +7 −11 tests/unit/resizable/resizable_test_helpers.js
  42. +18 −12 tests/unit/selectable/selectable_events.js
  43. +17 −4 tests/unit/selectable/selectable_methods.js
  44. +18 −4 tests/unit/selectable/selectable_options.js
  45. +0 −8 tests/unit/selectable/selectable_test_helpers.js
  46. +119 −24 tests/unit/sortable/sortable_events.js
  47. +5 −5 tests/unit/sortable/sortable_test_helpers.js
  48. +0 −69 tests/unit/sortable/sortable_tickets.js
  49. +100 −71 tests/unit/spinner/spinner_events.js
  50. +3 −3 tests/unit/tabs/tabs_core.js
  51. +3 −4 tests/unit/testsuite.js
  52. +42 −9 tests/unit/widget/widget_core.js
  53. +6 −1 tests/visual/dialog/complex-dialogs.html
  54. +1 −2 themes/base/jquery.ui.accordion.css
  55. +6 −4 themes/base/jquery.ui.button.css
  56. +1 −1 themes/base/jquery.ui.core.css
  57. +9 −6 themes/base/jquery.ui.dialog.css
  58. +1 −2 themes/base/jquery.ui.menu.css
  59. +0 −1 themes/base/jquery.ui.tabs.css
  60. +3 −2 themes/base/jquery.ui.theme.css
  61. +23 −0 ui/i18n/jquery.ui.datepicker-be.js
  62. +22 −0 ui/i18n/jquery.ui.datepicker-nb.js
  63. +22 −0 ui/i18n/jquery.ui.datepicker-nn.js
  64. +1 −0 ui/jquery.ui.accordion.js
  65. +2 −1 ui/jquery.ui.autocomplete.js
  66. +0 −12 ui/jquery.ui.core.js
  67. +7 −0 ui/jquery.ui.datepicker.js
  68. +183 −177 ui/jquery.ui.dialog.js
  69. +5 −1 ui/jquery.ui.droppable.js
  70. +1 −0 ui/jquery.ui.menu.js
  71. +37 −17 ui/jquery.ui.position.js
  72. +47 −48 ui/jquery.ui.progressbar.js
  73. +61 −61 ui/jquery.ui.resizable.js
  74. +1 −0 ui/jquery.ui.slider.js
  75. +8 −4 ui/jquery.ui.sortable.js
  76. +38 −35 ui/jquery.ui.tabs.js
  77. +30 −25 ui/jquery.ui.widget.js
View
2 build/tasks/testswarm.js
@@ -56,7 +56,7 @@ function submit( commit, tests, configFile, version, done ) {
runMax: config.runMax,
"runNames[]": Object.keys( tests ),
"runUrls[]": testUrls,
- "browserSets[]": [ "popular-no-ie6" ]
+ "browserSets[]": config.browserSets
});
}
View
14 demos/button/toolbar.html
@@ -11,12 +11,12 @@
<link rel="stylesheet" href="../demos.css">
<style>
#toolbar {
- padding: 11px 4px 9px 4px;
+ padding: 4px;
+ display: inline-block;
}
-
/* support: IE7 */
- *:first-child+html #toolbar {
- padding: 4px 0px 4px 5px;
+ *+html #toolbar {
+ display: inline;
}
</style>
<script>
@@ -91,7 +91,7 @@
</head>
<body>
-<span id="toolbar" class="ui-widget-header ui-corner-all">
+<div id="toolbar" class="ui-widget-header ui-corner-all">
<button id="beginning">go to beginning</button>
<button id="rewind">rewind</button>
<button id="play">play</button>
@@ -106,12 +106,12 @@
<input type="radio" id="repeat1" name="repeat" /><label for="repeat1">Once</label>
<input type="radio" id="repeatall" name="repeat" /><label for="repeatall">All</label>
</span>
-</span>
+</div>
<div class="demo-description">
<p>
A mediaplayer toolbar. Take a look at the underlying markup: A few button elements,
- an input of type checkbox for the Shuffle button, and three inputs of type radio for the Repeat options.
+ an input of type checkbox for the Shuffle button, and three inputs of type radio for the Repeat options.
</p>
</div>
</body>
View
6 demos/datepicker/localization.html
@@ -12,6 +12,7 @@
<script src="../../ui/i18n/jquery.ui.datepicker-ar.js"></script>
<script src="../../ui/i18n/jquery.ui.datepicker-ar-DZ.js"></script>
<script src="../../ui/i18n/jquery.ui.datepicker-az.js"></script>
+ <script src="../../ui/i18n/jquery.ui.datepicker-be.js"></script>
<script src="../../ui/i18n/jquery.ui.datepicker-bg.js"></script>
<script src="../../ui/i18n/jquery.ui.datepicker-bs.js"></script>
<script src="../../ui/i18n/jquery.ui.datepicker-ca.js"></script>
@@ -53,8 +54,10 @@
<script src="../../ui/i18n/jquery.ui.datepicker-mk.js"></script>
<script src="../../ui/i18n/jquery.ui.datepicker-ml.js"></script>
<script src="../../ui/i18n/jquery.ui.datepicker-ms.js"></script>
+ <script src="../../ui/i18n/jquery.ui.datepicker-nb.js"></script>
<script src="../../ui/i18n/jquery.ui.datepicker-nl.js"></script>
<script src="../../ui/i18n/jquery.ui.datepicker-nl-BE.js"></script>
+ <script src="../../ui/i18n/jquery.ui.datepicker-nn.js"></script>
<script src="../../ui/i18n/jquery.ui.datepicker-no.js"></script>
<script src="../../ui/i18n/jquery.ui.datepicker-pl.js"></script>
<script src="../../ui/i18n/jquery.ui.datepicker-pt.js"></script>
@@ -100,6 +103,7 @@
<option value="hy">Armenian (&#1344;&#1377;&#1397;&#1381;&#1408;&#1381;&#1398;)</option>
<option value="az">Azerbaijani (Az&#601;rbaycan dili)</option>
<option value="eu">Basque (Euskara)</option>
+ <option value="be">Belarusian</option>
<option value="bs">Bosnian (Bosanski)</option>
<option value="bg">Bulgarian (&#1073;&#1098;&#1083;&#1075;&#1072;&#1088;&#1089;&#1082;&#1080; &#1077;&#1079;&#1080;&#1082;)</option>
<option value="ca">Catalan (Catal&agrave;)</option>
@@ -142,7 +146,9 @@
<option value="mk">Macedonian</option>
<option value="ml">Malayalam</option>
<option value="ms">Malaysian (Bahasa Malaysia)</option>
+ <option value="nb">Norwegian (Bokmål)</option>
<option value="no">Norwegian (Norsk)</option>
+ <option value="nn">Norwegian (Nynorsk)</option>
<option value="pl">Polish (Polski)</option>
<option value="pt">Portuguese (Portugu&ecirc;s)</option>
<option value="pt-BR">Portuguese/Brazilian (Portugu&ecirc;s)</option>
View
34 demos/progressbar/animated.html
@@ -1,34 +0,0 @@
-<!doctype html>
-<html lang="en">
-<head>
- <meta charset="utf-8">
- <title>jQuery UI Progressbar - Animated</title>
- <link rel="stylesheet" href="../../themes/base/jquery.ui.all.css">
- <script src="../../jquery-1.8.3.js"></script>
- <script src="../../ui/jquery.ui.core.js"></script>
- <script src="../../ui/jquery.ui.widget.js"></script>
- <script src="../../ui/jquery.ui.progressbar.js"></script>
- <link rel="stylesheet" href="../demos.css">
- <script>
- $(function() {
- $( "#progressbar" ).progressbar({
- value: 59
- }).find( ".ui-progressbar-value div" ).addClass( "ui-progressbar-overlay" );
- });
- </script>
-</head>
-<body>
-
-<div id="progressbar"></div>
-
-<div class="demo-description">
-<p>
-This progressbar has an animated fill by setting the
-<code>ui-progressbar-overlay</code> class
-on the
-<code>.ui-progressbar-value</code>
-element's overlay div.
-</p>
-</div>
-</body>
-</html>
View
16 demos/progressbar/indeterminate.html
@@ -16,27 +16,27 @@
});
$( "button" ).on( "click", function( event ) {
var target = $( event.target ),
- pbar = $( "#progressbar" ),
- pbarValue = pbar.find( ".ui-progressbar-value" );
+ progressbar = $( "#progressbar" ),
+ progressbarValue = progressbar.find( ".ui-progressbar-value" );
if ( target.is( "#numButton" ) ) {
- pbar.progressbar( "option", {
+ progressbar.progressbar( "option", {
value: Math.floor( Math.random() * 100 )
});
} else if ( target.is( "#colorButton" ) ) {
- pbarValue.css({
+ progressbarValue.css({
"background": '#' + Math.floor( Math.random() * 16777215 ).toString( 16 )
});
} else if ( target.is( "#falseButton" ) ) {
- pbar.progressbar( "option", "value", false );
+ progressbar.progressbar( "option", "value", false );
}
});
});
</script>
<style>
- #progressbar .ui-progressbar-value {
- background-color: #CCCCCC;
- }
+ #progressbar .ui-progressbar-value {
+ background-color: #ccc;
+ }
</style>
</head>
<body>
View
3 demos/progressbar/index.html
@@ -8,9 +8,8 @@
<ul>
<li><a href="default.html">Default functionality</a></li>
- <li><a href="animated.html">Animated</a></li>
- <li><a href="resize.html">Resizable progressbar</a></li>
<li><a href="indeterminate.html">Indeterminate</a></li>
+ <li><a href="label.html">Custom Labels</a></li>
</ul>
</body>
View
58 demos/progressbar/label.html
@@ -0,0 +1,58 @@
+<!doctype html>
+<html lang="en">
+<head>
+ <meta charset="utf-8">
+ <title>jQuery UI Progressbar - Custom Label</title>
+ <link rel="stylesheet" href="../../themes/base/jquery.ui.all.css">
+ <script src="../../jquery-1.8.3.js"></script>
+ <script src="../../ui/jquery.ui.core.js"></script>
+ <script src="../../ui/jquery.ui.widget.js"></script>
+ <script src="../../ui/jquery.ui.progressbar.js"></script>
+ <link rel="stylesheet" href="../demos.css">
+ <style>
+ .progress-label {
+ float: left;
+ margin-left: 50%;
+ margin-top: 5px;
+ font-weight: bold;
+ text-shadow: 1px 1px 0 #fff;
+ }
+ </style>
+ <script>
+ $(function() {
+ var progressbar = $( "#progressbar" ),
+ progressLabel = $( ".progress-label" );
+
+ progressbar.progressbar({
+ value: false,
+ change: function() {
+ progressLabel.text( progressbar.progressbar( "value" ) + "%" );
+ },
+ complete: function() {
+ progressLabel.text( "Complete!" );
+ }
+ });
+
+ function progress() {
+ var val = progressbar.progressbar( "value" ) || 0;
+
+ progressbar.progressbar( "value", val + 1 );
+
+ if ( val < 99 ) {
+ setTimeout( progress, 100 );
+ }
+ }
+
+ setTimeout( progress, 3000 );
+ });
+ </script>
+</head>
+<body>
+
+<div id="progressbar"><div class="progress-label">Loading...</div></div>
+
+<div class="demo-description">
+<p>Custom updated label demo.</p>
+</div>
+</body>
+</html>
View
33 demos/progressbar/resize.html
@@ -1,33 +0,0 @@
-<!doctype html>
-<html lang="en">
-<head>
- <meta charset="utf-8">
- <title>jQuery UI Progressbar - Resizable</title>
- <link rel="stylesheet" href="../../themes/base/jquery.ui.all.css">
- <script src="../../jquery-1.8.3.js"></script>
- <script src="../../ui/jquery.ui.core.js"></script>
- <script src="../../ui/jquery.ui.widget.js"></script>
- <script src="../../ui/jquery.ui.mouse.js"></script>
- <script src="../../ui/jquery.ui.progressbar.js"></script>
- <script src="../../ui/jquery.ui.resizable.js"></script>
- <link rel="stylesheet" href="../demos.css">
- <script>
- $(function() {
- $( "#progressbar" ).progressbar({
- value: 37
- });
- $( "#progressbarWrapper" ).resizable();
- });
- </script>
-</head>
-<body>
-
-<div id="progressbarWrapper" style="height:30px; " class="ui-widget-default">
- <div id="progressbar" style="height:100%;"></div>
-</div>
-
-<div class="demo-description">
-<p>The progress bar's widths are specified in percentages for flexible sizing so it will resize to fit its container. Try resizing the height and width of this bar to see how it maintains the correct proportions. (This is not necessarily a real-world example, but it's a good illustration of how flexibly all the plugins are coded.)</p>
-</div>
-</body>
-</html>
View
4 package.json
@@ -47,10 +47,10 @@
"grunt-css": "0.2.0",
"grunt-compare-size": "0.1.4",
"grunt-html": "0.1.1",
- "grunt-junit": "0.1.4",
+ "grunt-junit": "0.1.5",
"grunt-git-authors": "1.0.0",
"rimraf": "2.0.1",
- "testswarm": "0.2.3"
+ "testswarm": "0.3.0"
},
"keywords": []
}
View
89 tests/jquery.simulate.js
@@ -1,13 +1,15 @@
-/*
- * jquery.simulate - simulate browser mouse and keyboard events
- * http://jqueryui.com
+ /*!
+ * jQuery Simulate v0.0.1 - simulate browser mouse and keyboard events
+ * https://github.com/jquery/jquery-simulate
*
* Copyright 2012 jQuery Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
+ *
+ * Date: Sun Dec 9 12:15:33 2012 -0500
*/
-;(function( $ ) {
+;(function( $, undefined ) {
var rkeyEvent = /^key/,
rmouseEvent = /^(?:mouse|contextmenu)|click/;
@@ -31,7 +33,42 @@ $.simulate = function( elem, type, options ) {
}
};
+$.extend( $.simulate, {
+
+ keyCode: {
+ BACKSPACE: 8,
+ COMMA: 188,
+ DELETE: 46,
+ DOWN: 40,
+ END: 35,
+ ENTER: 13,
+ ESCAPE: 27,
+ HOME: 36,
+ LEFT: 37,
+ NUMPAD_ADD: 107,
+ NUMPAD_DECIMAL: 110,
+ NUMPAD_DIVIDE: 111,
+ NUMPAD_ENTER: 108,
+ NUMPAD_MULTIPLY: 106,
+ NUMPAD_SUBTRACT: 109,
+ PAGE_DOWN: 34,
+ PAGE_UP: 33,
+ PERIOD: 190,
+ RIGHT: 39,
+ SPACE: 32,
+ TAB: 9,
+ UP: 38
+ },
+
+ buttonCode: {
+ LEFT: 0,
+ MIDDLE: 1,
+ RIGHT: 2
+ }
+});
+
$.extend( $.simulate.prototype, {
+
simulateEvent: function( elem, type, options ) {
var event = this.createEvent( type, options );
this.dispatchEvent( elem, type, event, options );
@@ -56,7 +93,6 @@ $.extend( $.simulate.prototype, {
detail: 0,
screenX: 0,
screenY: 0,
- // TODO: default clientX/Y to a position within the target element
clientX: 1,
clientY: 1,
ctrlKey: false,
@@ -101,8 +137,14 @@ $.extend( $.simulate.prototype, {
} else if ( document.createEventObject ) {
event = document.createEventObject();
$.extend( event, options );
- // TODO: what is this mapping for?
- event.button = { 0:1, 1:4, 2:2 }[ event.button ] || event.button;
+ // standards event.button uses constants defined here: http://msdn.microsoft.com/en-us/library/ie/ff974877(v=vs.85).aspx
+ // old IE event.button uses constants defined here: http://msdn.microsoft.com/en-us/library/ie/ms533544(v=vs.85).aspx
+ // so we actually need to map the standard back to oldIE
+ event.button = {
+ 0: 1,
+ 1: 4,
+ 2: 2
+ }[ event.button ] || event.button;
}
return event;
@@ -128,7 +170,10 @@ $.extend( $.simulate.prototype, {
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?
+ // initKeyEvent throws an exception in WebKit
+ // see: http://stackoverflow.com/questions/6406784/initkeyevent-keypress-only-works-in-firefox-need-a-cross-browser-solution
+ // and also https://bugs.webkit.org/show_bug.cgi?id=13368
+ // fall back to a generic event until we decide to implement initKeyboardEvent
} catch( err ) {
event = document.createEvent( "Events" );
event.initEvent( type, options.bubbles, options.cancelable );
@@ -147,17 +192,14 @@ $.extend( $.simulate.prototype, {
$.extend( event, options );
}
- // TODO: can we hook into core's logic?
- if ( $.ui.ie || (({}).toString.call( window.opera ) === "[object Opera]") ) {
- // TODO: is charCode ever <0 ? Can we just use charCode || keyCode?
+ if ( !!/msie [\w.]+/.exec( navigator.userAgent.toLowerCase() ) || (({}).toString.call( window.opera ) === "[object Opera]") ) {
event.keyCode = (options.charCode > 0) ? options.charCode : options.keyCode;
event.charCode = undefined;
}
return event;
},
- // TODO: does this need type? Can't we just check event.type?
dispatchEvent: function( elem, type, event ) {
if ( elem.dispatchEvent ) {
elem.dispatchEvent( event );
@@ -237,20 +279,31 @@ function findCenter( elem ) {
$.extend( $.simulate.prototype, {
simulateDrag: function() {
- var target = this.target,
+ var i = 0,
+ 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,
+ moves = options.moves || 3,
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 );
+
+ for ( ; i < moves ; i++ ) {
+ x += dx / moves;
+ y += dy / moves;
+
+ coord = {
+ clientX: Math.round( x ),
+ clientY: Math.round( y )
+ };
+
+ this.simulateEvent( document, "mousemove", coord );
+ }
+
this.simulateEvent( target, "mouseup", coord );
this.simulateEvent( target, "click", coord );
}
View
6 tests/unit/autocomplete/autocomplete_options.js
@@ -5,7 +5,7 @@ module( "autocomplete: options" );
var data = [ "c++", "java", "php", "coldfusion", "javascript", "asp", "ruby", "python", "c", "scala", "groovy", "haskell", "perl" ];
test( "appendTo", function() {
- expect( 7 );
+ expect( 8 );
var detached = $( "<div>" ),
element = $( "#autocomplete" ).autocomplete();
equal( element.autocomplete( "widget" ).parent()[0], document.body, "defaults to body" );
@@ -39,6 +39,10 @@ test( "appendTo", function() {
});
equal( element.autocomplete( "widget" ).parent()[0], detached[0], "detached DOM element" );
element.autocomplete( "destroy" );
+
+ element.autocomplete().autocomplete( "option", "appendTo", detached );
+ equal( element.autocomplete( "widget" ).parent()[0], detached[0], "detached DOM element via option()" );
+ element.autocomplete( "destroy" );
});
function autoFocusTest( afValue, focusedLength ) {
View
72 tests/unit/button/button_core.js
@@ -92,16 +92,84 @@ test("buttonset (rtl)", function() {
// remove this when simulate properly simulates this
// see http://yuilibrary.com/projects/yui2/ticket/2528826 fore more info
if ( !$.ui.ie || ( document.documentMode && document.documentMode > 8 ) ) {
- test( "ensure checked and aria after single click on checkbox label button, see #5518", function() {
+ asyncTest( "ensure checked and aria after single click on checkbox label button, see #5518", function() {
expect( 3 );
$("#check2").button().change( function() {
var lbl = $( this ).button("widget");
ok( this.checked, "checked ok" );
ok( lbl.attr("aria-pressed") === "true", "aria ok" );
ok( lbl.hasClass("ui-state-active"), "ui-state-active ok" );
- }).button("widget").simulate("mousedown").simulate("click").simulate("mouseup");
+ });
+
+ // support: Opera
+ // Opera doesn't trigger a change event when this is done synchronously.
+ // This seems to be a side effect of another test, but until that can be
+ // tracked down, this delay will have to do.
+ setTimeout(function() {
+ $("#check2").button("widget").simulate("click");
+ start();
+ }, 1 );
});
}
+test( "#7092 - button creation that requires a matching label does not find label in all cases", function() {
+ expect( 5 );
+ var group = $( "<span><label for='t7092a'></label><input type='checkbox' id='t7092a'></span>" );
+ group.find( "input[type=checkbox]" ).button();
+ ok( group.find( "label" ).is( ".ui-button" ) );
+
+ group = $( "<input type='checkbox' id='t7092b'><label for='t7092b'></label>" );
+ group.filter( "input[type=checkbox]" ).button();
+ ok( group.filter( "label" ).is( ".ui-button" ) );
+
+ group = $( "<span><input type='checkbox' id='t7092c'></span><label for='t7092c'></label>" );
+ group.find( "input[type=checkbox]" ).button();
+ ok( group.filter( "label" ).is( ".ui-button" ) );
+
+ group = $( "<span><input type='checkbox' id='t7092d'></span><span><label for='t7092d'></label></span>" );
+ group.find( "input[type=checkbox]" ).button();
+ ok( group.find( "label" ).is( ".ui-button" ) );
+
+ group = $( "<input type='checkbox' id='t7092e'><span><label for='t7092e'></label></span>" );
+ group.filter( "input[type=checkbox]" ).button();
+ ok( group.find( "label" ).is( ".ui-button" ) );
+});
+
+test( "#5946 - buttonset should ignore buttons that are not :visible", function() {
+ expect( 2 );
+ $( "#radio01" ).next().andSelf().hide();
+ var set = $( "#radio0" ).buttonset({ items: "input[type=radio]:visible" });
+ ok( set.find( "label:eq(0)" ).is( ":not(.ui-button):not(.ui-corner-left)" ) );
+ ok( set.find( "label:eq(1)" ).is( ".ui-button.ui-corner-left" ) );
+});
+
+test( "#6262 - buttonset not applying ui-corner to invisible elements", function() {
+ expect( 3 );
+ $( "#radio0" ).hide();
+ var set = $( "#radio0" ).buttonset();
+ ok( set.find( "label:eq(0)" ).is( ".ui-button.ui-corner-left" ) );
+ ok( set.find( "label:eq(1)" ).is( ".ui-button" ) );
+ ok( set.find( "label:eq(2)" ).is( ".ui-button.ui-corner-right" ) );
+});
+
+asyncTest( "#6711 Checkbox/Radiobutton do not Show Focused State when using Keyboard Navigation", function() {
+ expect( 2 );
+ var check = $( "#check" ).button(),
+ label = $( "label[for='check']" );
+ ok( !label.is( ".ui-state-focus" ) );
+ check.focus();
+ setTimeout(function() {
+ ok( label.is( ".ui-state-focus" ) );
+ start();
+ });
+});
+
+test( "#7534 - Button label selector works for ids with \":\"", function() {
+ expect( 1 );
+ var group = $( "<span><input type='checkbox' id='check:7534'><label for='check:7534'>Label</label></span>" );
+ group.find( "input" ).button();
+ ok( group.find( "label" ).is( ".ui-button" ), "Found an id with a :" );
+});
+
})(jQuery);
View
20 tests/unit/button/button_events.js
@@ -13,14 +13,24 @@ test("buttonset works with single-quote named elements (#7505)", function() {
}).click();
});
-test( "when button loses focus, ensure active state is removed (#8559)", function() {
+asyncTest( "when button loses focus, ensure active state is removed (#8559)", function() {
expect( 1 );
- $("#button").button().keypress( function() {
- $("#button").one( "blur", function() {
- ok( !$("#button").is(".ui-state-active"), "button loses active state appropriately" );
+ var element = $( "#button" ).button();
+
+ element.one( "keypress", function() {
+ element.one( "blur", function() {
+ ok( !element.is(".ui-state-active"), "button loses active state appropriately" );
+ start();
}).blur();
- }).focus().simulate( "keydown", { keyCode: $.ui.keyCode.ENTER } ).simulate( "keypress", { keyCode: $.ui.keyCode.ENTER } );
+ });
+
+ element.focus();
+ setTimeout(function() {
+ element
+ .simulate( "keydown", { keyCode: $.ui.keyCode.ENTER } )
+ .simulate( "keypress", { keyCode: $.ui.keyCode.ENTER } );
+ });
});
})(jQuery);
View
11 tests/unit/button/button_options.js
@@ -103,4 +103,15 @@ test("icons", function() {
$("#button").button("destroy");
});
+test( "#5295 - button does not remove hoverstate if disabled" , function() {
+ expect( 1 );
+ var btn = $("#button").button();
+ btn.hover( function() {
+ btn.button( "disable" );
+ });
+ btn.trigger( "mouseenter" );
+ btn.trigger( "mouseleave" );
+ ok( !btn.is( ".ui-state-hover") );
+});
+
})(jQuery);
View
75 tests/unit/button/button_tickets.js
@@ -1,75 +0,0 @@
-/*
- * button_tickets.js
- */
-(function( $ ) {
-
-module( "button: tickets" );
-
-test( "#5295 - button does not remove hoverstate if disabled" , function() {
- expect( 1 );
- var btn = $("#button").button();
- btn.hover( function() {
- btn.button( "disable" );
- });
- btn.trigger( "mouseenter" );
- btn.trigger( "mouseleave" );
- ok( !btn.is( ".ui-state-hover") );
-});
-
-test( "#5946 - buttonset should ignore buttons that are not :visible", function() {
- expect( 2 );
- $( "#radio01" ).next().andSelf().hide();
- var set = $( "#radio0" ).buttonset({ items: "input[type=radio]:visible" });
- ok( set.find( "label:eq(0)" ).is( ":not(.ui-button):not(.ui-corner-left)" ) );
- ok( set.find( "label:eq(1)" ).is( ".ui-button.ui-corner-left" ) );
-});
-
-test( "#6262 - buttonset not applying ui-corner to invisible elements", function() {
- expect( 3 );
- $( "#radio0" ).hide();
- var set = $( "#radio0" ).buttonset();
- ok( set.find( "label:eq(0)" ).is( ".ui-button.ui-corner-left" ) );
- ok( set.find( "label:eq(1)" ).is( ".ui-button" ) );
- ok( set.find( "label:eq(2)" ).is( ".ui-button.ui-corner-right" ) );
-});
-
-test( "#6711 Checkbox/Radiobutton do not Show Focused State when using Keyboard Navigation", function() {
- expect( 2 );
- var check = $( "#check" ).button(),
- label = $( "label[for='check']" );
- ok( !label.is( ".ui-state-focus" ) );
- check.focus();
- ok( label.is( ".ui-state-focus" ) );
-});
-
-test( "#7092 - button creation that requires a matching label does not find label in all cases", function() {
- expect( 5 );
- var group = $( "<span><label for='t7092a'></label><input type='checkbox' id='t7092a'></span>" );
- group.find( "input[type=checkbox]" ).button();
- ok( group.find( "label" ).is( ".ui-button" ) );
-
- group = $( "<input type='checkbox' id='t7092b'><label for='t7092b'></label>" );
- group.filter( "input[type=checkbox]" ).button();
- ok( group.filter( "label" ).is( ".ui-button" ) );
-
- group = $( "<span><input type='checkbox' id='t7092c'></span><label for='t7092c'></label>" );
- group.find( "input[type=checkbox]" ).button();
- ok( group.filter( "label" ).is( ".ui-button" ) );
-
- group = $( "<span><input type='checkbox' id='t7092d'></span><span><label for='t7092d'></label></span>" );
- group.find( "input[type=checkbox]" ).button();
- ok( group.find( "label" ).is( ".ui-button" ) );
-
- group = $( "<input type='checkbox' id='t7092e'><span><label for='t7092e'></label></span>" );
- group.filter( "input[type=checkbox]" ).button();
- ok( group.find( "label" ).is( ".ui-button" ) );
-});
-
-test( "#7534 - Button label selector works for ids with \":\"", function() {
- expect( 1 );
- var group = $( "<span><input type='checkbox' id='check:7534'><label for='check:7534'>Label</label></span>" );
- group.find( "input" ).button();
- ok( group.find( "label" ).is( ".ui-button" ), "Found an id with a :" );
-});
-
-})( jQuery );
View
9 tests/unit/core/core.js
@@ -4,24 +4,23 @@ module( "core - jQuery extensions" );
TestHelpers.testJshint( "core" );
-test( "focus - original functionality", function() {
+asyncTest( "focus - original functionality", function() {
expect( 1 );
$( "#inputTabindex0" )
- .focus(function() {
+ .one( "focus", function() {
ok( true, "event triggered" );
+ start();
})
.focus();
});
asyncTest( "focus", function() {
expect( 2 );
$( "#inputTabindex0" )
- .focus(function() {
+ .one( "focus", function() {
ok( true, "event triggered" );
})
.focus( 500, function() {
- // prevent double focus event in IE
- $( this ).unbind( "focus" );
ok( true, "callback triggered" );
start();
});
View
253 tests/unit/datepicker/datepicker_core.js
@@ -6,6 +6,8 @@
module("datepicker: core");
+TestHelpers.testJshint( "datepicker" );
+
test("initialization - Reinitialization after body had been emptied.", function() {
expect( 1 );
var bodyContent = $('body').children(), inp = $("#inp");
@@ -28,126 +30,159 @@ test("widget method", function() {
deepEqual($("body > #ui-datepicker-div:last-child")[0], actual);
});
-test('baseStructure', function() {
+asyncTest('baseStructure', function() {
expect( 58 );
var header, title, table, thead, week, panel, inl, child,
- inp = TestHelpers.datepicker.init('#inp').focus(),
+ inp = TestHelpers.datepicker.init('#inp'),
dp = $('#ui-datepicker-div');
- 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');
- equal(dp.children().length, 2, 'Structure - child count');
- header = dp.children(':first');
- ok(header.is('div.ui-datepicker-header'), 'Structure - header division');
- 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');
-
- title = header.children(':last');
- ok(title.is('div.ui-datepicker-title') && title.html() !== '','Structure - title division');
- 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');
-
- 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');
- thead = table.children(':first').children(':first');
- ok(thead.is('tr'), 'Structure - month table title row');
- 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');
- week = table.children(':eq(1)').children(':first');
- ok(week.is('tr'), 'Structure - month table week row');
- 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');
- inp.datepicker('hide').datepicker('destroy');
+ function step1() {
+ inp[0].focus();
+ setTimeout(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');
+ equal(dp.children().length, 2, 'Structure - child count');
- // Editable month/year and button panel
- inp = TestHelpers.datepicker.init('#inp', {changeMonth: true, changeYear: true, showButtonPanel: true});
- inp.focus();
+ header = dp.children(':first');
+ ok(header.is('div.ui-datepicker-header'), 'Structure - header division');
+ 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');
- 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');
+ title = header.children(':last');
+ ok(title.is('div.ui-datepicker-title') && title.html() !== '','Structure - title division');
+ 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');
- panel = dp.children(':last');
- ok(panel.is('div.ui-datepicker-buttonpane'), 'Structure - button panel division');
- 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');
+ 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');
+ thead = table.children(':first').children(':first');
+ ok(thead.is('tr'), 'Structure - month table title row');
+ 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');
+ week = table.children(':eq(1)').children(':first');
+ ok(week.is('tr'), 'Structure - month table week row');
+ 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');
+ inp.datepicker('hide').datepicker('destroy');
- // Multi-month 2
- inp = TestHelpers.datepicker.init('#inp', {numberOfMonths: 2});
- inp.focus();
- ok(dp.is('.ui-datepicker-multi'), 'Structure multi [2] - multi-month');
- equal(dp.children().length, 3, 'Structure multi [2] - child count');
- 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)');
- ok(child.is('div.ui-datepicker-group') && child.is('div.ui-datepicker-group-last'), 'Structure multi [2] - second month division');
- child = dp.children(':eq(2)');
- 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');
+ step2();
+ });
+ }
- // Multi-month 3
- inp = TestHelpers.datepicker.init('#inp', {numberOfMonths: 3});
- inp.focus();
- ok(dp.is('.ui-datepicker-multi-3'), 'Structure multi [3] - multi-3');
- ok(! dp.is('.ui-datepicker-multi-2'), 'Structure multi [3] - Trac #6704');
- inp.datepicker('hide').datepicker('destroy');
+ function step2() {
+ // Editable month/year and button panel
+ inp = TestHelpers.datepicker.init('#inp', {changeMonth: true, changeYear: true, showButtonPanel: true});
+ inp.focus();
+ setTimeout(function() {
+ 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');
- // Multi-month [2, 2]
- inp = TestHelpers.datepicker.init('#inp', {numberOfMonths: [2, 2]});
- inp.focus();
- ok(dp.is('.ui-datepicker-multi'), 'Structure multi - multi-month');
- equal(dp.children().length, 6, '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)');
- ok(child.is('div.ui-datepicker-group') && child.is('div.ui-datepicker-group-last'), 'Structure multi [2,2] - second month division');
- child = dp.children(':eq(2)');
- ok(child.is('div.ui-datepicker-row-break'), 'Structure multi [2,2] - row break');
- child = dp.children(':eq(3)');
- ok(child.is('div.ui-datepicker-group') && child.is('div.ui-datepicker-group-first'), 'Structure multi [2,2] - third month division');
- child = dp.children(':eq(4)');
- ok(child.is('div.ui-datepicker-group') && child.is('div.ui-datepicker-group-last'), 'Structure multi [2,2] - fourth month division');
- child = dp.children(':eq(5)');
- ok(child.is('div.ui-datepicker-row-break'), 'Structure multi [2,2] - row break');
- inp.datepicker('hide').datepicker('destroy');
+ panel = dp.children(':last');
+ ok(panel.is('div.ui-datepicker-buttonpane'), 'Structure - button panel division');
+ 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');
- // Inline
- inl = TestHelpers.datepicker.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');
- equal(dp.children().length, 2, 'Structure inline - child count');
- header = dp.children(':first');
- ok(header.is('div.ui-datepicker-header'), 'Structure inline - header division');
- equal(header.children().length, 3, 'Structure inline - header child count');
- 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 = TestHelpers.datepicker.init('#inl', {numberOfMonths: 2});
- dp = inl.children();
- ok(dp.is('.ui-datepicker-inline') && dp.is('.ui-datepicker-multi'), 'Structure inline multi - main div');
- equal(dp.children().length, 3, '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)');
- ok(child.is('div.ui-datepicker-group') && child.is('div.ui-datepicker-group-last'), 'Structure inline multi - second month division');
- child = dp.children(':eq(2)');
- ok(child.is('div.ui-datepicker-row-break'), 'Structure inline multi - row break');
- inl.datepicker('destroy');
+ step3();
+ });
+ }
+
+ function step3() {
+ // Multi-month 2
+ inp = TestHelpers.datepicker.init('#inp', {numberOfMonths: 2});
+ inp.focus();
+ setTimeout(function() {
+ ok(dp.is('.ui-datepicker-multi'), 'Structure multi [2] - multi-month');
+ equal(dp.children().length, 3, 'Structure multi [2] - child count');
+ 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)');
+ ok(child.is('div.ui-datepicker-group') && child.is('div.ui-datepicker-group-last'), 'Structure multi [2] - second month division');
+ child = dp.children(':eq(2)');
+ 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');
+
+ step4();
+ });
+ }
+
+ function step4() {
+ // Multi-month 3
+ inp = TestHelpers.datepicker.init('#inp', {numberOfMonths: 3});
+ inp.focus();
+ setTimeout(function() {
+ ok(dp.is('.ui-datepicker-multi-3'), 'Structure multi [3] - multi-3');
+ ok(! dp.is('.ui-datepicker-multi-2'), 'Structure multi [3] - Trac #6704');
+ inp.datepicker('hide').datepicker('destroy');
+
+ step5();
+ });
+ }
+
+ function step5() {
+ // Multi-month [2, 2]
+ inp = TestHelpers.datepicker.init('#inp', {numberOfMonths: [2, 2]});
+ inp.focus();
+ setTimeout(function() {
+ ok(dp.is('.ui-datepicker-multi'), 'Structure multi - multi-month');
+ equal(dp.children().length, 6, '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)');
+ ok(child.is('div.ui-datepicker-group') && child.is('div.ui-datepicker-group-last'), 'Structure multi [2,2] - second month division');
+ child = dp.children(':eq(2)');
+ ok(child.is('div.ui-datepicker-row-break'), 'Structure multi [2,2] - row break');
+ child = dp.children(':eq(3)');
+ ok(child.is('div.ui-datepicker-group') && child.is('div.ui-datepicker-group-first'), 'Structure multi [2,2] - third month division');
+ child = dp.children(':eq(4)');
+ ok(child.is('div.ui-datepicker-group') && child.is('div.ui-datepicker-group-last'), 'Structure multi [2,2] - fourth month division');
+ 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
+ inl = TestHelpers.datepicker.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');
+ equal(dp.children().length, 2, 'Structure inline - child count');
+ header = dp.children(':first');
+ ok(header.is('div.ui-datepicker-header'), 'Structure inline - header division');
+ equal(header.children().length, 3, 'Structure inline - header child count');
+ 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 = TestHelpers.datepicker.init('#inl', {numberOfMonths: 2});
+ dp = inl.children();
+ ok(dp.is('.ui-datepicker-inline') && dp.is('.ui-datepicker-multi'), 'Structure inline multi - main div');
+ equal(dp.children().length, 3, '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)');
+ ok(child.is('div.ui-datepicker-group') && child.is('div.ui-datepicker-group-last'), 'Structure inline multi - second month division');
+ child = dp.children(':eq(2)');
+ ok(child.is('div.ui-datepicker-row-break'), 'Structure inline multi - row break');
+ inl.datepicker('destroy');
+
+ start();
+ });
+ }
+
+ step1();
});
test('customStructure', function() {
View
191 tests/unit/datepicker/datepicker_options.js
@@ -48,6 +48,24 @@ test('option', function() {
'Get default settings');
});
+test( "disabled", function() {
+ expect(8);
+ var inp = TestHelpers.datepicker.init('#inp');
+ ok(!inp.datepicker('isDisabled'), 'Initially marked as enabled');
+ ok(!inp[0].disabled, 'Field initially enabled');
+ inp.datepicker('option', 'disabled', true);
+ ok(inp.datepicker('isDisabled'), 'Marked as disabled');
+ ok(inp[0].disabled, 'Field now disabled');
+ inp.datepicker('option', 'disabled', false);
+ ok(!inp.datepicker('isDisabled'), 'Marked as enabled');
+ ok(!inp[0].disabled, 'Field now enabled');
+ inp.datepicker('destroy');
+
+ inp = TestHelpers.datepicker.init('#inp', { disabled: true });
+ ok(inp.datepicker('isDisabled'), 'Initially marked as disabled');
+ ok(inp[0].disabled, 'Field initially disabled');
+});
+
test('change', function() {
expect( 12 );
var inp = TestHelpers.datepicker.init('#inp'),
@@ -69,76 +87,114 @@ test('change', function() {
equal($.datepicker._defaults.showOn, 'focus', 'Retain default showOn');
});
-test('invocation', function() {
+asyncTest('invocation', function() {
expect( 29 );
var button, image,
inp = TestHelpers.datepicker.init('#inp'),
dp = $('#ui-datepicker-div'),
body = $('body');
- // On focus
- button = inp.siblings('button');
- ok(button.length === 0, 'Focus - button absent');
- image = inp.siblings('img');
- ok(image.length === 0, 'Focus - image absent');
- inp.focus();
- ok(dp.is(':visible'), 'Focus - rendered on focus');
- inp.simulate('keydown', {keyCode: $.ui.keyCode.ESCAPE});
- ok(!dp.is(':visible'), 'Focus - hidden on exit');
- inp.focus();
- ok(dp.is(':visible'), 'Focus - rendered on focus');
- body.simulate('mousedown', {});
- ok(!dp.is(':visible'), 'Focus - hidden on external click');
- inp.datepicker('hide').datepicker('destroy');
- // On button
- inp = TestHelpers.datepicker.init('#inp', {showOn: 'button', buttonText: 'Popup'});
- ok(!dp.is(':visible'), 'Button - initially hidden');
- button = inp.siblings('button');
- image = inp.siblings('img');
- ok(button.length === 1, 'Button - button present');
- ok(image.length === 0, 'Button - image absent');
- equal(button.text(), 'Popup', 'Button - button text');
- inp.focus();
- ok(!dp.is(':visible'), 'Button - not rendered on focus');
- button.click();
- ok(dp.is(':visible'), 'Button - rendered on button click');
- button.click();
- ok(!dp.is(':visible'), 'Button - hidden on second button click');
- inp.datepicker('hide').datepicker('destroy');
- // On image button
- inp = TestHelpers.datepicker.init('#inp', {showOn: 'button', buttonImageOnly: true,
- buttonImage: 'img/calendar.gif', buttonText: 'Cal'});
- ok(!dp.is(':visible'), 'Image button - initially hidden');
- button = inp.siblings('button');
- ok(button.length === 0, 'Image button - button absent');
- image = inp.siblings('img');
- ok(image.length === 1, 'Image button - image present');
- 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();
- ok(dp.is(':visible'), 'Image button - rendered on image click');
- image.click();
- ok(!dp.is(':visible'), 'Image button - hidden on second image click');
- inp.datepicker('hide').datepicker('destroy');
- // On both
- inp = TestHelpers.datepicker.init('#inp', {showOn: 'both', buttonImage: 'img/calendar.gif'});
- ok(!dp.is(':visible'), 'Both - initially hidden');
- button = inp.siblings('button');
- ok(button.length === 1, 'Both - button present');
- image = inp.siblings('img');
- ok(image.length === 0, 'Both - image absent');
- image = button.children('img');
- ok(image.length === 1, 'Both - button image present');
- inp.focus();
- ok(dp.is(':visible'), 'Both - rendered on focus');
- body.simulate('mousedown', {});
- ok(!dp.is(':visible'), 'Both - hidden on external click');
- button.click();
- ok(dp.is(':visible'), 'Both - rendered on button click');
- button.click();
- ok(!dp.is(':visible'), 'Both - hidden on second button click');
- inp.datepicker('hide').datepicker('destroy');
+
+ function step1() {
+ // On focus
+ button = inp.siblings('button');
+ ok(button.length === 0, 'Focus - button absent');
+ image = inp.siblings('img');
+ ok(image.length === 0, 'Focus - image absent');
+ inp[0].focus();
+ setTimeout(function() {
+ ok(dp.is(':visible'), 'Focus - rendered on focus');
+ inp.simulate('keydown', {keyCode: $.ui.keyCode.ESCAPE});
+ ok(!dp.is(':visible'), 'Focus - hidden on exit');
+ inp[0].blur();
+ setTimeout(function() {
+ inp[0].focus();
+ setTimeout(function() {
+ ok(dp.is(':visible'), 'Focus - rendered on focus');
+ body.simulate('mousedown', {});
+ ok(!dp.is(':visible'), 'Focus - hidden on external click');
+ inp.datepicker('hide').datepicker('destroy');
+
+ step2();
+ });
+ });
+ });
+ }
+
+ function step2() {
+ // On button
+ inp = TestHelpers.datepicker.init('#inp', {showOn: 'button', buttonText: 'Popup'});
+ ok(!dp.is(':visible'), 'Button - initially hidden');
+ button = inp.siblings('button');
+ image = inp.siblings('img');
+ ok(button.length === 1, 'Button - button present');
+ ok(image.length === 0, 'Button - image absent');
+ equal(button.text(), 'Popup', 'Button - button text');
+ inp[0].focus();
+ setTimeout(function() {
+ ok(!dp.is(':visible'), 'Button - not rendered on focus');
+ button.click();
+ ok(dp.is(':visible'), 'Button - rendered on button click');
+ button.click();
+ ok(!dp.is(':visible'), 'Button - hidden on second button click');
+ inp.datepicker('hide').datepicker('destroy');
+
+ step3();
+ });
+ }
+
+ function step3() {
+ // On image button
+ inp = TestHelpers.datepicker.init('#inp', {showOn: 'button', buttonImageOnly: true,
+ buttonImage: 'img/calendar.gif', buttonText: 'Cal'});
+ ok(!dp.is(':visible'), 'Image button - initially hidden');
+ button = inp.siblings('button');
+ ok(button.length === 0, 'Image button - button absent');
+ image = inp.siblings('img');
+ ok(image.length === 1, 'Image button - image present');
+ equal(image.attr('src'), 'img/calendar.gif', 'Image button - image source');
+ equal(image.attr('title'), 'Cal', 'Image button - image text');
+ inp[0].focus();
+ setTimeout(function() {
+ ok(!dp.is(':visible'), 'Image button - not rendered on focus');
+ image.click();
+ ok(dp.is(':visible'), 'Image button - rendered on image click');
+ image.click();
+ ok(!dp.is(':visible'), 'Image button - hidden on second image click');
+ inp.datepicker('hide').datepicker('destroy');
+
+ step4();
+ });
+ }
+
+ function step4() {
+ // On both
+ inp = TestHelpers.datepicker.init('#inp', {showOn: 'both', buttonImage: 'img/calendar.gif'});
+ ok(!dp.is(':visible'), 'Both - initially hidden');
+ button = inp.siblings('button');
+ ok(button.length === 1, 'Both - button present');
+ image = inp.siblings('img');
+ ok(image.length === 0, 'Both - image absent');
+ image = button.children('img');
+ ok(image.length === 1, 'Both - button image present');
+ inp[0].blur();
+ setTimeout(function() {
+ inp[0].focus();
+ setTimeout(function() {
+ ok(dp.is(':visible'), 'Both - rendered on focus');
+ body.simulate('mousedown', {});
+ ok(!dp.is(':visible'), 'Both - hidden on external click');
+ button.click();
+ ok(dp.is(':visible'), 'Both - rendered on button click');
+ button.click();
+ ok(!dp.is(':visible'), 'Both - hidden on second button click');
+ inp.datepicker('hide').datepicker('destroy');
+
+ start();
+ });
+ });
+ }
+
+ step1();
});
test('otherMonths', function() {
@@ -538,10 +594,9 @@ test('altField', function() {
});
test('autoSize', function() {
- expect( 14 );
+ expect( 15 );
var inp = TestHelpers.datepicker.init('#inp');
- // todo: figure out why this test fails in Opera 11.6
- //equal(inp.prop('size'), 20, 'Auto size - default');
+ equal(inp.prop('size'), 20, 'Auto size - default');
inp.datepicker('option', 'autoSize', true);
equal(inp.prop('size'), 10, 'Auto size - mm/dd/yy');
inp.datepicker('option', 'dateFormat', 'm/d/yy');
View
4 tests/unit/dialog/dialog.html
@@ -23,6 +23,8 @@
"ui/jquery.ui.draggable.js",
"ui/jquery.ui.resizable.js",
"ui/jquery.ui.button.js",
+ "ui/jquery.ui.effect.js",
+ "ui/jquery.ui.effect-clip.js",
"ui/jquery.ui.dialog.js"
]
});
@@ -59,6 +61,8 @@ <h2 id="qunit-userAgent"></h2>
<label for="favorite-food">Favorite food</label><input id="favorite-food">
</div>
</div>
+ <div class="wrap" id="wrap1"></div>
+ <div class="wrap" id="wrap2"></div>
</div>
</body>
</html>
View
7 tests/unit/dialog/dialog_common.js
@@ -1,16 +1,17 @@
TestHelpers.commonWidgetTests( "dialog", {
defaults: {
+ appendTo: "body",
autoOpen: true,
- buttons: {},
+ buttons: [],
closeOnEscape: true,
closeText: 'close',
disabled: false,
dialogClass: '',
draggable: true,
height: 'auto',
hide: null,
- maxHeight: false,
- maxWidth: false,
+ maxHeight: null,
+ maxWidth: null,
minHeight: 150,
minWidth: 150,
modal: false,
View
110 tests/unit/dialog/dialog_core.js
@@ -34,11 +34,12 @@ test( "ARIA", function() {
test("widget method", function() {
expect( 1 );
- var dialog = $("<div>").appendTo("#main").dialog();
+ var dialog = $("<div>").appendTo("#qunit-fixture").dialog();
deepEqual(dialog.parent()[0], dialog.dialog("widget")[0]);
+ dialog.remove();
});
-test( "focus tabbable", function() {
+asyncTest( "focus tabbable", function() {
expect( 5 );
var el,
options = {
@@ -48,40 +49,62 @@ test( "focus tabbable", function() {
}]
};
- el = $( "<div><input><input autofocus></div>" ).dialog( options );
- equal( document.activeElement, el.find( "input" )[ 1 ], "1. first element inside the dialog matching [autofocus]" );
- el.remove();
-
- // IE8 fails to focus the input, <body> ends up being the activeElement
- // so wait for that stupid browser
- stop();
- setTimeout(function() {
- el = $( "<div><input><input></div>" ).dialog( options );
- equal( document.activeElement, el.find( "input" )[ 0 ], "2. tabbable element inside the content element" );
- el.remove();
-
- el = $( "<div>text</div>" ).dialog( options );
- equal( document.activeElement, el.dialog( "widget" ).find( ".ui-dialog-buttonpane button" )[ 0 ], "3. tabbable element inside the buttonpane" );
- el.remove();
-
- el = $( "<div>text</div>" ).dialog();
- equal( document.activeElement, el.dialog( "widget" ).find( ".ui-dialog-titlebar .ui-dialog-titlebar-close" )[ 0 ], "4. the close button" );
- el.remove();
-
+ function checkFocus( markup, options, testFn, next ) {
+ el = $( markup ).dialog( options );
+ setTimeout(function() {
+ testFn();
+ el.remove();
+ setTimeout( next );
+ });
+ }
+
+ function step1() {
+ checkFocus( "<div><input><input autofocus></div>", options, function() {
+ equal( document.activeElement, el.find( "input" )[ 1 ],
+ "1. first element inside the dialog matching [autofocus]" );
+ }, step2 );
+ }
+
+ function step2() {
+ checkFocus( "<div><input><input></div>", options, function() {
+ equal( document.activeElement, el.find( "input" )[ 0 ],
+ "2. tabbable element inside the content element" );
+ }, step3 );
+ }
+
+ function step3() {
+ checkFocus( "<div>text</div>", options, function() {
+ equal( document.activeElement,
+ el.dialog( "widget" ).find( ".ui-dialog-buttonpane button" )[ 0 ],
+ "3. tabbable element inside the buttonpane" );
+ }, step4 );
+ }
+
+ function step4() {
+ checkFocus( "<div>text</div>", {}, function() {
+ equal( document.activeElement,
+ el.dialog( "widget" ).find( ".ui-dialog-titlebar .ui-dialog-titlebar-close" )[ 0 ],
+ "4. the close button" );
+ }, step5 );
+ }
+
+ function step5() {
el = $( "<div>text</div>" ).dialog({
autoOpen: false
});
el.dialog( "widget" ).find( ".ui-dialog-titlebar-close" ).hide();
el.dialog( "open" );
- equal( document.activeElement, el.parent()[ 0 ], "5. the dialog itself" );
- el.remove();
+ setTimeout(function() {
+ equal( document.activeElement, el.parent()[ 0 ], "5. the dialog itself" );
+ el.remove();
+ start();
+ });
+ }
- start();
- }, 13);
+ step1();
});
-// #7960
-test( "resizable handles below modal overlays", function() {
+test( "#7960: resizable handles below modal overlays", function() {
expect( 1 );
var resizable = $( "<div>" ).resizable(),
@@ -93,4 +116,35 @@ test( "resizable handles below modal overlays", function() {
dialog.dialog( "destroy" );
});
+asyncTest( "Prevent tabbing out of dialogs", function() {
+ expect( 3 );
+
+ var el = $( "<div><input><input></div>" ).dialog(),
+ inputs = el.find( "input" ),
+ widget = el.dialog( "widget" )[ 0 ];
+
+ function checkTab() {
+ ok( $.contains( widget, document.activeElement ), "Tab key event moved focus within the modal" );
+
+ // check shift tab
+ $( document.activeElement ).simulate( "keydown", { keyCode: $.ui.keyCode.TAB, shiftKey: true });
+ setTimeout( checkShiftTab );
+ }
+
+ function checkShiftTab() {
+ ok( $.contains( widget, document.activeElement ), "Shift-Tab key event moved focus within the modal" );
+
+ el.remove();
+ setTimeout( start );
+ }
+
+ inputs[1].focus();
+ setTimeout(function() {
+ equal( document.activeElement, inputs[1], "Focus set on second input" );
+ inputs.eq( 1 ).simulate( "keydown", { keyCode: $.ui.keyCode.TAB });
+
+ setTimeout( checkTab );
+ });
+});
+
})(jQuery);
View
2 tests/unit/dialog/dialog_deprecated.html
@@ -57,6 +57,8 @@ <h2 id="qunit-userAgent"></h2>
<label for="favorite-food">Favorite food</label><input id="favorite-food">
</div>
</div>
+ <div class="wrap" id="wrap1"></div>
+ <div class="wrap" id="wrap2"></div>
</div>
</body>
</html>
View
14 tests/unit/dialog/dialog_events.js
@@ -341,4 +341,18 @@ asyncTest("ensure dialog's container doesn't scroll on resize and focus", functi
}, 500);
});
+test("#5184: isOpen in dialogclose event is true", function() {
+ expect( 3 );
+
+ var el = $( "<div></div>" ).dialog({
+ close: function() {
+ ok( !el.dialog("isOpen"), "dialog is not open during close" );
+ }
+ });
+ ok( el.dialog("isOpen"), "dialog is open after init" );
+ el.dialog( "close" );
+ ok( !el.dialog("isOpen"), "dialog is not open after close" );
+ el.remove();
+});
+
})(jQuery);
View
61 tests/unit/dialog/dialog_methods.js
@@ -34,7 +34,9 @@ test("init", function() {
});
test("destroy", function() {
- expect( 6 );
+ expect( 7 );
+
+ $( "#dialog1, #form-dialog" ).hide();
domEqual( "#dialog1", function() {
var dialog = $( "#dialog1" ).dialog().dialog( "destroy" );
equal( dialog.parent()[ 0 ], $( "#qunit-fixture" )[ 0 ] );
@@ -45,6 +47,26 @@ test("destroy", function() {
equal( dialog.parent()[ 0 ], $( "#qunit-fixture" )[ 0 ] );
equal( dialog.index(), 2 );
});
+
+ // Ensure dimensions are restored (#8119)
+ $( "#dialog1" ).show().css({
+ width: "400px",
+ minHeight: "100px",
+ height: "200px"
+ });
+ domEqual( "#dialog1", function() {
+ $( "#dialog1" ).dialog().dialog( "destroy" );
+ });
+});
+
+test("#4980: Destroy should place element back in original DOM position", function(){
+ expect( 2 );
+ var container = $('<div id="container"><div id="modal">Content</div></div>'),
+ modal = container.find('#modal');
+ modal.dialog();
+ ok(!$.contains(container[0], modal[0]), 'dialog should move modal element to outside container element');
+ modal.dialog('destroy');
+ ok($.contains(container[0], modal[0]), 'dialog(destroy) should place element back in original DOM position');
});
test( "enable/disable disabled", function() {
@@ -125,4 +147,41 @@ test("open", function() {
ok(el.dialog('widget').is(':visible') && !el.dialog('widget').is(':hidden'), 'dialog visible after open method called');
});
+test("#6137: dialog('open') causes form elements to reset on IE7", function() {
+ expect(2);
+
+ var d1 = $('<form><input type="radio" name="radio" id="a" value="a" checked="checked"></input>' +
+ '<input type="radio" name="radio" id="b" value="b">b</input></form>').appendTo( "body" ).dialog({autoOpen: false});
+
+ d1.find('#b').prop( "checked", true );
+ equal(d1.find('input:checked').val(), 'b', "checkbox b is checked");
+
+ d1.dialog('open');
+ equal(d1.find('input:checked').val(), 'b', "checkbox b is checked");
+
+ d1.remove();
+});
+
+test("#5531: dialog width should be at least minWidth on creation", function () {
+ expect( 4 );
+ var el = $('<div></div>').dialog({
+ width: 200,
+ minWidth: 300
+ });
+
+ equal(el.dialog('option', 'width'), 300, "width is minWidth");
+ el.dialog('option', 'width', 200);
+ equal(el.dialog('option', 'width'), 300, "width unchanged when set to < minWidth");
+ el.dialog('option', 'width', 320);
+ equal(el.dialog('option', 'width'), 320, "width changed if set to > minWidth");
+ el.remove();
+
+ el = $('<div></div>').dialog({
+ minWidth: 300
+ });
+ ok(el.dialog('option', 'width') >= 300, "width is at least 300");
+ el.remove();
+
+});
+
})(jQuery);
View
72 tests/unit/dialog/dialog_options.js
@@ -5,6 +5,47 @@
module("dialog: options");
+test( "appendTo", function() {
+ expect( 8 );
+ var detached = $( "<div>" ),
+ element = $( "#dialog1" ).dialog();
+ equal( element.dialog( "widget" ).parent()[0], document.body, "defaults to body" );
+ element.dialog( "destroy" );
+
+ element.dialog({
+ appendTo: ".wrap"
+ });
+ equal( element.dialog( "widget" ).parent()[0], $( "#wrap1" )[0], "first found element" );
+ equal( $( "#wrap2 .ui-dialog" ).length, 0, "only appends to one element" );
+ element.dialog( "destroy" );
+
+ element.dialog({
+ appendTo: null
+ });
+ equal( element.dialog( "widget" ).parent()[0], document.body, "null" );
+ element.dialog( "destroy" );
+
+ element.dialog({ autoOpen: false }).dialog( "option", "appendTo", "#wrap1" ).dialog( "open" );
+ equal( element.dialog( "widget" ).parent()[0], $( "#wrap1" )[0], "modified after init" );
+ element.dialog( "destroy" );
+
+ element.dialog({
+ appendTo: detached
+ });
+ equal( element.dialog( "widget" ).parent()[0], detached[0], "detached jQuery object" );
+ element.dialog( "destroy" );
+
+ element.dialog({
+ appendTo: detached[0]
+ });
+ equal( element.dialog( "widget" ).parent()[0], detached[0], "detached DOM element" );
+ element.dialog( "destroy" );
+
+ element.dialog({ autoOpen: false }).dialog( "option", "appendTo", detached );
+ equal( element.dialog( "widget" ).parent()[0], detached[0], "detached DOM element via option()" );
+ element.dialog( "destroy" );
+});
+
test("autoOpen", function() {
expect(2);
@@ -212,6 +253,15 @@ test("height", function() {
el.remove();
});
+asyncTest( "hide, #5860 - don't leave effects wrapper behind", function() {
+ expect( 1 );
+ $( "#dialog1" ).dialog({ hide: "clip" }).dialog( "close" ).dialog( "destroy" );
+ setTimeout(function() {
+ equal( $( ".ui-effects-wrapper" ).length, 0 );
+ start();
+ }, 500);
+});
+
test("maxHeight", function() {
expect(3);
@@ -428,4 +478,26 @@ test("width", function() {
el.remove();
});
+test("#4826: setting resizable false toggles resizable on dialog", function() {
+ expect(6);
+ var i,
+ el = $('<div></div>').dialog({ resizable: false });
+
+ TestHelpers.dialog.shouldResize(el, 0, 0, "[default]");
+ for (i=0; i<2; i++) {
+ el.dialog('close').dialog('open');
+ TestHelpers.dialog.shouldResize(el, 0, 0, 'initialized with resizable false toggle ('+ (i+1) +')');
+ }
+ el.remove();
+
+ el = $('<div></div>').dialog({ resizable: true });
+ TestHelpers.dialog.shouldResize(el, 50, 50, "[default]");
+ for (i=0; i<2; i++) {
+ el.dialog('close').dialog('option', 'resizable', false).dialog('open');
+ TestHelpers.dialog.shouldResize(el, 0, 0, 'set option resizable false toggle ('+ (i+1) +')');
+ }
+ el.remove();
+
+});
+
})(jQuery);
View
7 tests/unit/dialog/dialog_test_helpers.js
@@ -3,10 +3,9 @@ TestHelpers.dialog = {
var d = el.dialog('widget');
//this mouseover is to work around a limitation in resizable
//TODO: fix resizable so handle doesn't require mouseover in order to be used
- $(handle, d).simulate("mouseover");
- $(handle, d).simulate("drag", {
- dx: dx || 0,
- dy: dy || 0
+ $( handle, d ).simulate("mouseover").simulate( "drag", {
+ dx: dx,
+ dy: dy
});
},
testDrag: function(el, dx, dy, expectedDX, expectedDY, msg) {
View
132 tests/unit/dialog/dialog_tickets.js
@@ -1,132 +0,0 @@
-/*
- * dialog_tickets.js
- */
-(function($) {
-
-module( "dialog: tickets" );
-
-asyncTest( "#3123: Prevent tabbing out of modal dialogs", function() {
- expect( 3 );
-
- var el = $( "<div><input id='t3123-first'><input id='t3123-last'></div>" ).dialog({ modal: true }),
- inputs = el.find( "input" ),
- widget = el.dialog( "widget" )[ 0 ];
-
- function checkTab() {
- ok( $.contains( widget, document.activeElement ), "Tab key event moved focus within the modal" );
-
- // check shift tab
- $( document.activeElement ).simulate( "keydown", { keyCode: $.ui.keyCode.TAB, shiftKey: true });
- setTimeout( checkShiftTab, 2 );
- }
-
- function checkShiftTab() {
- ok( $.contains( widget, document.activeElement ), "Shift-Tab key event moved focus within the modal" );
-
- el.remove();
- start();
- }
-
- inputs.eq( 1 ).focus();
- equal( document.activeElement, inputs[1], "Focus set on second input" );
- inputs.eq( 1 ).simulate( "keydown", { keyCode: $.ui.keyCode.TAB });
-
- setTimeout( checkTab, 2 );
-});
-
-test("#4826: setting resizable false toggles resizable on dialog", function() {
- expect(6);
- var i,
- el = $('<div></div>').dialog({ resizable: false });
-
- TestHelpers.dialog.shouldResize(el, 0, 0, "[default]");
- for (i=0; i<2; i++) {
- el.dialog('close').dialog('open');
- TestHelpers.dialog.shouldResize(el, 0, 0, 'initialized with resizable false toggle ('+ (i+1) +')');
- }
- el.remove();
-
- el = $('<div></div>').dialog({ resizable: true });
- TestHelpers.dialog.shouldResize(el, 50, 50, "[default]");
- for (i=0; i<2; i++) {
- el.dialog('close').dialog('option', 'resizable', false).dialog('open');
- TestHelpers.dialog.shouldResize(el, 0, 0, 'set option resizable false toggle ('+ (i+1) +')');
- }
- el.remove();
-
-});
-
-test("#5184: isOpen in dialogclose event is true", function() {
- expect( 3 );
-
- var el = $( "<div></div>" ).dialog({
- close: function() {
- ok( !el.dialog("isOpen"), "dialog is not open during close" );
- }
- });
- ok( el.dialog("isOpen"), "dialog is open after init" );
- el.dialog( "close" );
- ok( !el.dialog("isOpen"), "dialog is not open after close" );
- el.remove();
-});
-
-test("#5531: dialog width should be at least minWidth on creation", function () {
- expect( 4 );
- var el = $('<div></div>').dialog({
- width: 200,
- minWidth: 300
- });
-
- equal(el.dialog('option', 'width'), 300, "width is minWidth");
- el.dialog('option', 'width', 200);
- equal(el.dialog('option', 'width'), 300, "width unchanged when set to < minWidth");
- el.dialog('option', 'width', 320);
- equal(el.dialog('option', 'width'), 320, "width changed if set to > minWidth");
- el.remove();
-
- el = $('<div></div>').dialog({
- minWidth: 300
- });
- ok(el.dialog('option', 'width') >= 300, "width is at least 300");
- el.remove();
-
-});
-
-test("#6137: dialog('open') causes form elements to reset on IE7", function() {
- expect(2);
-
- var d1 = $('<form><input type="radio" name="radio" id="a" value="a" checked="checked"></input>' +
- '<input type="radio" name="radio" id="b" value="b">b</input></form>').appendTo( "body" ).dialog({autoOpen: false});
-
- d1.find('#b').prop( "checked", true );
- equal(d1.find('input:checked').val(), 'b', "checkbox b is checked");
-
- d1.dialog('open');
- equal(d1.find('input:checked').val(), 'b', "checkbox b is checked");
-
- d1.remove();
-});
-
-test("#6645: Missing element not found check in overlay", function(){
- expect(2);
- var d1 = $('<div title="dialog 1">Dialog 1</div>').dialog({modal: true}),
- d2 = $('<div title="dialog 2">Dialog 2</div>').dialog({modal: true, close: function(){ d2.remove(); }});
-
</