diff --git a/build/tasks/testswarm.js b/build/tasks/testswarm.js
index 37eb552810..838751fc70 100644
--- a/build/tasks/testswarm.js
+++ b/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
});
}
diff --git a/demos/button/toolbar.html b/demos/button/toolbar.html
index 5be3668f62..62c1ca83a4 100644
--- a/demos/button/toolbar.html
+++ b/demos/button/toolbar.html
@@ -11,12 +11,12 @@
+
@@ -53,8 +54,10 @@
+
+
@@ -100,6 +103,7 @@
Armenian (Հայերեն)
Azerbaijani (Azərbaycan dili)
Basque (Euskara)
+ Belarusian
Bosnian (Bosanski)
Bulgarian (български език)
Catalan (Català)
@@ -142,7 +146,9 @@
Macedonian
Malayalam
Malaysian (Bahasa Malaysia)
+ Norwegian (Bokmål)
Norwegian (Norsk)
+ Norwegian (Nynorsk)
Polish (Polski)
Portuguese (Português)
Portuguese/Brazilian (Português)
diff --git a/demos/progressbar/animated.html b/demos/progressbar/animated.html
deleted file mode 100644
index 5cb1872edb..0000000000
--- a/demos/progressbar/animated.html
+++ /dev/null
@@ -1,34 +0,0 @@
-
-
-
-
- jQuery UI Progressbar - Animated
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-This progressbar has an animated fill by setting the
-ui-progressbar-overlay class
-on the
-.ui-progressbar-value
-element's overlay div.
-
-
-
-
diff --git a/demos/progressbar/indeterminate.html b/demos/progressbar/indeterminate.html
index 34ce6da47b..b07211496e 100644
--- a/demos/progressbar/indeterminate.html
+++ b/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 );
}
});
});
diff --git a/demos/progressbar/index.html b/demos/progressbar/index.html
index df34838165..cfc054aeaa 100644
--- a/demos/progressbar/index.html
+++ b/demos/progressbar/index.html
@@ -8,9 +8,8 @@
diff --git a/demos/progressbar/label.html b/demos/progressbar/label.html
new file mode 100644
index 0000000000..25394b205a
--- /dev/null
+++ b/demos/progressbar/label.html
@@ -0,0 +1,58 @@
+
+
+
+
+ jQuery UI Progressbar - Custom Label
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Custom updated label demo.
+
+
+
diff --git a/demos/progressbar/resize.html b/demos/progressbar/resize.html
deleted file mode 100644
index eac40c0c07..0000000000
--- a/demos/progressbar/resize.html
+++ /dev/null
@@ -1,33 +0,0 @@
-
-
-
-
- jQuery UI Progressbar - Resizable
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
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.)
-
-
-
diff --git a/package.json b/package.json
index 6c3e73531c..df0885b332 100644
--- a/package.json
+++ b/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": []
}
diff --git a/tests/jquery.simulate.js b/tests/jquery.simulate.js
index 08cbaafda2..0ae88c20fe 100644
--- a/tests/jquery.simulate.js
+++ b/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,9 +192,7 @@ $.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;
}
@@ -157,7 +200,6 @@ $.extend( $.simulate.prototype, {
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 );
}
diff --git a/tests/unit/autocomplete/autocomplete_options.js b/tests/unit/autocomplete/autocomplete_options.js
index d3a25d2fc8..913f5bc289 100644
--- a/tests/unit/autocomplete/autocomplete_options.js
+++ b/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 = $( "" ),
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 ) {
diff --git a/tests/unit/button/button_core.js b/tests/unit/button/button_core.js
index d53dedf900..6d0bbbe887 100644
--- a/tests/unit/button/button_core.js
+++ b/tests/unit/button/button_core.js
@@ -92,7 +92,7 @@ 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() {
@@ -100,8 +100,76 @@ if ( !$.ui.ie || ( document.documentMode && document.documentMode > 8 ) ) {
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 = $( " " );
+ group.find( "input[type=checkbox]" ).button();
+ ok( group.find( "label" ).is( ".ui-button" ) );
+
+ group = $( " " );
+ group.filter( "input[type=checkbox]" ).button();
+ ok( group.filter( "label" ).is( ".ui-button" ) );
+
+ group = $( " " );
+ group.find( "input[type=checkbox]" ).button();
+ ok( group.filter( "label" ).is( ".ui-button" ) );
+
+ group = $( " " );
+ group.find( "input[type=checkbox]" ).button();
+ ok( group.find( "label" ).is( ".ui-button" ) );
+
+ group = $( " " );
+ 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 = $( "Label " );
+ group.find( "input" ).button();
+ ok( group.find( "label" ).is( ".ui-button" ), "Found an id with a :" );
+});
+
})(jQuery);
diff --git a/tests/unit/button/button_events.js b/tests/unit/button/button_events.js
index 7b79c41ea2..2fd0383256 100644
--- a/tests/unit/button/button_events.js
+++ b/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);
diff --git a/tests/unit/button/button_options.js b/tests/unit/button/button_options.js
index eeb6e5527a..e1931a54e9 100644
--- a/tests/unit/button/button_options.js
+++ b/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);
diff --git a/tests/unit/button/button_tickets.js b/tests/unit/button/button_tickets.js
deleted file mode 100644
index 1272d368fb..0000000000
--- a/tests/unit/button/button_tickets.js
+++ /dev/null
@@ -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 = $( " " );
- group.find( "input[type=checkbox]" ).button();
- ok( group.find( "label" ).is( ".ui-button" ) );
-
- group = $( " " );
- group.filter( "input[type=checkbox]" ).button();
- ok( group.filter( "label" ).is( ".ui-button" ) );
-
- group = $( " " );
- group.find( "input[type=checkbox]" ).button();
- ok( group.filter( "label" ).is( ".ui-button" ) );
-
- group = $( " " );
- group.find( "input[type=checkbox]" ).button();
- ok( group.find( "label" ).is( ".ui-button" ) );
-
- group = $( " " );
- 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 = $( "Label " );
- group.find( "input" ).button();
- ok( group.find( "label" ).is( ".ui-button" ), "Found an id with a :" );
-});
-
-})( jQuery );
diff --git a/tests/unit/core/core.js b/tests/unit/core/core.js
index 5ebb9e9f4e..86b95e157d 100644
--- a/tests/unit/core/core.js
+++ b/tests/unit/core/core.js
@@ -4,11 +4,12 @@ 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();
});
@@ -16,12 +17,10 @@ test( "focus - original functionality", function() {
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();
});
diff --git a/tests/unit/datepicker/datepicker_core.js b/tests/unit/datepicker/datepicker_core.js
index 3c88059d11..1388f9222a 100644
--- a/tests/unit/datepicker/datepicker_core.js
+++ b/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');
+ 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');
- 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');
+ 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');
- 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');
+ 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');
- // Editable month/year and button panel
- inp = TestHelpers.datepicker.init('#inp', {changeMonth: true, changeYear: true, showButtonPanel: true});
- inp.focus();
+ 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');
- 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');
+ step2();
+ });
+ }
- 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');
+ 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
- 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');
+ 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');
- // 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');
+ step3();
+ });
+ }
- // 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');
+ 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');
- // 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');
+ step4();
+ });
+ }
- // 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');
+ 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() {
diff --git a/tests/unit/datepicker/datepicker_options.js b/tests/unit/datepicker/datepicker_options.js
index 8b8888780c..c5e53b85e4 100644
--- a/tests/unit/datepicker/datepicker_options.js
+++ b/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');
diff --git a/tests/unit/dialog/dialog.html b/tests/unit/dialog/dialog.html
index 5413e7cc1b..8f2583ce1b 100644
--- a/tests/unit/dialog/dialog.html
+++ b/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 @@
Favorite food
+
+