From 5fda4f6828ad523bd0692b76f903010a458fcac4 Mon Sep 17 00:00:00 2001 From: Jörn Zaefferer Date: Thu, 1 Mar 2012 14:30:02 +0100 Subject: Update data naming for Widget, including backwards compability. Updated tests and added one for the custom expression. Partial fix for #7810 --- tests/unit/widget/widget_core.js | 42 ++++++++++++++++++++++++++-------------- 1 file changed, 28 insertions(+), 14 deletions(-) (limited to 'tests') diff --git a/tests/unit/widget/widget_core.js b/tests/unit/widget/widget_core.js index c451c4cf6..b4bb6356d 100644 --- a/tests/unit/widget/widget_core.js +++ b/tests/unit/widget/widget_core.js @@ -32,28 +32,28 @@ test( "element normalization", function() { // workaround for core ticket #8381 this.element.appendTo( "#qunit-fixture" ); ok( this.element.is( "div" ), "generated div" ); - deepEqual( this.element.data( "testWidget" ), this, "intance stored in .data()" ); + deepEqual( this.element.data( "ui-testWidget" ), this, "instance stored in .data()" ); }; $.ui.testWidget(); $.ui.testWidget.prototype.defaultElement = ""; $.ui.testWidget.prototype._create = function() { ok( this.element.is( "span[data-test=pass]" ), "generated span with properties" ); - deepEqual( this.element.data( "testWidget" ), this, "instace stored in .data()" ); + deepEqual( this.element.data( "ui-testWidget" ), this, "instace stored in .data()" ); }; $.ui.testWidget(); elem = $( "" ); $.ui.testWidget.prototype._create = function() { deepEqual( this.element[ 0 ], elem[ 0 ], "from element" ); - deepEqual( elem.data( "testWidget" ), this, "instace stored in .data()" ); + deepEqual( elem.data( "ui-testWidget" ), this, "instace stored in .data()" ); }; $.ui.testWidget( {}, elem[ 0 ] ); elem = $( "
" ); $.ui.testWidget.prototype._create = function() { deepEqual( this.element[ 0 ], elem[ 0 ], "from jQuery object" ); - deepEqual( elem.data( "testWidget" ), this, "instace stored in .data()" ); + deepEqual( elem.data( "ui-testWidget" ), this, "instace stored in .data()" ); }; $.ui.testWidget( {}, elem ); @@ -61,7 +61,7 @@ test( "element normalization", function() { .appendTo( "#qunit-fixture" ); $.ui.testWidget.prototype._create = function() { deepEqual( this.element[ 0 ], elem[ 0 ], "from selector" ); - deepEqual( elem.data( "testWidget" ), this, "instace stored in .data()" ); + deepEqual( elem.data( "ui-testWidget" ), this, "instace stored in .data()" ); }; $.ui.testWidget( {}, "#element-normalization-selector" ); @@ -73,8 +73,16 @@ test( "element normalization", function() { $.ui.testWidget(); }); +test( "custom selector expression", function() { + var elem = $( "
" ).appendTo( "#qunit-fixture" ); + $.widget( "ui.testWidget", {} ); + elem.testWidget(); + deepEqual( $( ":ui-testWidget" )[0], elem[0] ); + elem.testWidget( "destroy" ); +}); + test( "jQuery usage", function() { - expect( 13 ); + expect( 15 ); var shouldCreate = false; @@ -112,12 +120,18 @@ test( "jQuery usage", function() { .testWidget(); shouldCreate = false; - var instance = elem.data( "testWidget" ); + var instance = elem.data( "ui-testWidget" ); equal( typeof instance, "object", "instance stored in .data(pluginName)" ); equal( instance.element[0], elem[0], "element stored on widget" ); var ret = elem.testWidget( "methodWithParams", "value1", "value2" ); equal( ret, elem, "jQuery object returned from method call" ); + // 1.9 BC for #7810 + // TODO remove + var bcInstance = elem.data("testWidget"); + equal( typeof bcInstance, "object", "instance stored in .data(pluginName)" ); + equal( bcInstance.element[0], elem[0], "element stored on widget" ); + ret = elem.testWidget( "getterSetterMethod" ); equal( ret, 5, "getter/setter can act as getter" ); ret = elem.testWidget( "getterSetterMethod", 30 ); @@ -160,7 +174,7 @@ test( "direct usage", function() { var instance = new $.ui.testWidget( {}, elem ); shouldCreate = false; - equal( $( elem ).data( "testWidget" ), instance, + equal( $( elem ).data( "ui-testWidget" ), instance, "instance stored in .data(pluginName)" ); equal( instance.element[ 0 ], elem, "element stored on widget" ); @@ -374,7 +388,7 @@ test( "._super()", function() { } }); - instance = $( "
" ).testWidget3().data( "testWidget3" ); + instance = $( "
" ).testWidget3().data( "ui-testWidget3" ); instance.method( 5 ); delete $.ui.testWidget3; delete $.ui.testWidget2; @@ -411,7 +425,7 @@ test( "._superApply()", function() { } }); - instance = $( "
" ).testWidget3().data( "testWidget3" ); + instance = $( "
" ).testWidget3().data( "ui-testWidget3" ); instance.method( 5, 10 ); delete $.ui.testWidget3; delete $.ui.testWidget2; @@ -521,7 +535,7 @@ test( ".option() - deep option setter", function() { $.widget( "ui.testWidget", {} ); var div = $( "
" ).testWidget(); function deepOption( from, to, msg ) { - div.data( "testWidget" ).options.foo = from; + div.data( "ui-testWidget" ).options.foo = from; $.ui.testWidget.prototype._setOption = function( key, value ) { deepEqual( key, "foo", msg + ": key" ); deepEqual( value, to, msg + ": value" ); @@ -804,7 +818,7 @@ test( "._trigger() - no event, no ui", function() { deepEqual( ui, {}, "empty ui hash passed" ); handlers.push( this ); }); - deepEqual( $( "#widget" ).data( "testWidget" )._trigger( "foo" ), true, + deepEqual( $( "#widget" ).data( "ui-testWidget" )._trigger( "foo" ), true, "_trigger returns true when event is not cancelled" ); deepEqual( handlers, [ $( "#widget" )[ 0 ], @@ -832,7 +846,7 @@ test( "._trigger() - cancelled event", function() { ok( true, "event was triggered" ); return false; }); - deepEqual( $( "#widget" ).data( "testWidget" )._trigger( "foo" ), false, + deepEqual( $( "#widget" ).data( "ui-testWidget" )._trigger( "foo" ), false, "_trigger returns false when event is cancelled" ); }); @@ -846,7 +860,7 @@ test( "._trigger() - cancelled callback", function() { return false; } }); - deepEqual( $( "#widget" ).data( "testWidget" )._trigger( "foo" ), false, + deepEqual( $( "#widget" ).data( "ui-testWidget" )._trigger( "foo" ), false, "_trigger returns false when callback returns false" ); }); -- cgit v1.2.3 From 5e51b8db284b23bf818148051aaf5b41a7b9c7b1 Mon Sep 17 00:00:00 2001 From: Jörn Zaefferer Date: Thu, 1 Mar 2012 15:03:30 +0100 Subject: Update Widget data naming/usage. Remove unnecessary fallbacks, update .removeData to use full name. --- tests/unit/widget/widget_core.js | 5 ++++- ui/jquery.ui.widget.js | 10 +++------- 2 files changed, 7 insertions(+), 8 deletions(-) (limited to 'tests') diff --git a/tests/unit/widget/widget_core.js b/tests/unit/widget/widget_core.js index b4bb6356d..e104d4ae9 100644 --- a/tests/unit/widget/widget_core.js +++ b/tests/unit/widget/widget_core.js @@ -82,7 +82,7 @@ test( "custom selector expression", function() { }); test( "jQuery usage", function() { - expect( 15 ); + expect( 16 ); var shouldCreate = false; @@ -140,6 +140,9 @@ test( "jQuery usage", function() { ret = elem.testWidget( "jQueryObject" ); equal( ret[ 0 ], document.body, "returned jQuery object" ); equal( ret.end(), elem, "stack preserved" ); + + elem.testWidget( "destroy" ); + equal( elem.data( "ui-testWidget" ), null ); }); test( "direct usage", function() { diff --git a/ui/jquery.ui.widget.js b/ui/jquery.ui.widget.js index d06b2654f..17416ff9f 100644 --- a/ui/jquery.ui.widget.js +++ b/ui/jquery.ui.widget.js @@ -163,9 +163,7 @@ $.widget.bridge = function( name, object ) { if ( isMethodCall ) { this.each(function() { - // 1.9 BC for #7810 - // TODO remove fallback to name - var instance = $.data( this, fullName ) || $.data( this, name ); + var instance = $.data( this, fullName ); if ( !instance ) { return $.error( "cannot call methods on " + name + " prior to initialization; " + "attempted to call method '" + options + "'" ); @@ -183,9 +181,7 @@ $.widget.bridge = function( name, object ) { }); } else { this.each(function() { - // 1.9 BC for #7810 - // TODO remove fallback to name - var instance = $.data( this, fullName ) || $.data( this, name ); + var instance = $.data( this, fullName ); if ( instance ) { instance.option( options || {} )._init(); } else { @@ -252,7 +248,7 @@ $.Widget.prototype = { // all event bindings should go through this._bind() this.element .unbind( "." + this.widgetName ) - .removeData( this.widgetName ); + .removeData( this.widgetFullName ); this.widget() .unbind( "." + this.widgetName ) .removeAttr( "aria-disabled" ) -- cgit v1.2.3 From 932fe888c0cde8806a156514c700ec2d9855ff90 Mon Sep 17 00:00:00 2001 From: Scott González Date: Thu, 8 Mar 2012 10:53:08 -0500 Subject: Updated copyright year. --- MIT-LICENSE.txt | 2 +- tests/jquery.simulate.js | 2 +- themes/base/jquery.ui.accordion.css | 2 +- themes/base/jquery.ui.all.css | 2 +- themes/base/jquery.ui.autocomplete.css | 2 +- themes/base/jquery.ui.base.css | 2 +- themes/base/jquery.ui.button.css | 2 +- themes/base/jquery.ui.core.css | 2 +- themes/base/jquery.ui.datepicker.css | 2 +- themes/base/jquery.ui.dialog.css | 2 +- themes/base/jquery.ui.menu.css | 2 +- themes/base/jquery.ui.progressbar.css | 2 +- themes/base/jquery.ui.resizable.css | 2 +- themes/base/jquery.ui.selectable.css | 2 +- themes/base/jquery.ui.slider.css | 2 +- themes/base/jquery.ui.spinner.css | 2 +- themes/base/jquery.ui.tabs.css | 2 +- themes/base/jquery.ui.theme.css | 2 +- themes/base/jquery.ui.tooltip.css | 2 +- ui/jquery.effects.blind.js | 2 +- ui/jquery.effects.bounce.js | 2 +- ui/jquery.effects.clip.js | 2 +- ui/jquery.effects.core.js | 2 +- ui/jquery.effects.drop.js | 2 +- ui/jquery.effects.explode.js | 2 +- ui/jquery.effects.fade.js | 2 +- ui/jquery.effects.fold.js | 2 +- ui/jquery.effects.highlight.js | 2 +- ui/jquery.effects.pulsate.js | 2 +- ui/jquery.effects.scale.js | 2 +- ui/jquery.effects.shake.js | 2 +- ui/jquery.effects.slide.js | 2 +- ui/jquery.effects.transfer.js | 2 +- ui/jquery.ui.accordion.js | 2 +- ui/jquery.ui.autocomplete.js | 2 +- ui/jquery.ui.button.js | 2 +- ui/jquery.ui.core.js | 2 +- ui/jquery.ui.datepicker.js | 2 +- ui/jquery.ui.dialog.js | 2 +- ui/jquery.ui.draggable.js | 2 +- ui/jquery.ui.droppable.js | 2 +- ui/jquery.ui.menu.js | 2 +- ui/jquery.ui.mouse.js | 2 +- ui/jquery.ui.position.js | 2 +- ui/jquery.ui.progressbar.js | 2 +- ui/jquery.ui.resizable.js | 2 +- ui/jquery.ui.selectable.js | 2 +- ui/jquery.ui.slider.js | 2 +- ui/jquery.ui.sortable.js | 2 +- ui/jquery.ui.spinner.js | 2 +- ui/jquery.ui.tabs.js | 2 +- ui/jquery.ui.tooltip.js | 2 +- ui/jquery.ui.widget.js | 2 +- 53 files changed, 53 insertions(+), 53 deletions(-) (limited to 'tests') diff --git a/MIT-LICENSE.txt b/MIT-LICENSE.txt index be226805d..29652242a 100644 --- a/MIT-LICENSE.txt +++ b/MIT-LICENSE.txt @@ -1,4 +1,4 @@ -Copyright (c) 2011 Paul Bakaus, http://jqueryui.com/ +Copyright (c) 2012 Paul Bakaus, http://jqueryui.com/ This software consists of voluntary contributions made by many individuals (AUTHORS.txt, http://jqueryui.com/about) For exact diff --git a/tests/jquery.simulate.js b/tests/jquery.simulate.js index 8ecd60fa7..a85ca6ef3 100644 --- a/tests/jquery.simulate.js +++ b/tests/jquery.simulate.js @@ -1,7 +1,7 @@ /* * jquery.simulate - simulate browser mouse and keyboard events * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) * Dual licensed under the MIT or GPL Version 2 licenses. * http://jquery.org/license */ diff --git a/themes/base/jquery.ui.accordion.css b/themes/base/jquery.ui.accordion.css index 18e087e8f..3e2777adf 100644 --- a/themes/base/jquery.ui.accordion.css +++ b/themes/base/jquery.ui.accordion.css @@ -1,7 +1,7 @@ /* * jQuery UI Accordion @VERSION * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) * Dual licensed under the MIT or GPL Version 2 licenses. * http://jquery.org/license * diff --git a/themes/base/jquery.ui.all.css b/themes/base/jquery.ui.all.css index 96b15aa51..60fd9d6fb 100644 --- a/themes/base/jquery.ui.all.css +++ b/themes/base/jquery.ui.all.css @@ -1,7 +1,7 @@ /* * jQuery UI CSS Framework @VERSION * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) * Dual licensed under the MIT or GPL Version 2 licenses. * http://jquery.org/license * diff --git a/themes/base/jquery.ui.autocomplete.css b/themes/base/jquery.ui.autocomplete.css index b5dff74ca..5ab05e2fd 100644 --- a/themes/base/jquery.ui.autocomplete.css +++ b/themes/base/jquery.ui.autocomplete.css @@ -1,7 +1,7 @@ /* * jQuery UI Autocomplete @VERSION * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) * Dual licensed under the MIT or GPL Version 2 licenses. * http://jquery.org/license * diff --git a/themes/base/jquery.ui.base.css b/themes/base/jquery.ui.base.css index 9a18856c1..97dfd36f0 100644 --- a/themes/base/jquery.ui.base.css +++ b/themes/base/jquery.ui.base.css @@ -1,7 +1,7 @@ /* * jQuery UI CSS Framework @VERSION * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) * Dual licensed under the MIT or GPL Version 2 licenses. * http://jquery.org/license * diff --git a/themes/base/jquery.ui.button.css b/themes/base/jquery.ui.button.css index 2ae50afd1..ccee26aab 100644 --- a/themes/base/jquery.ui.button.css +++ b/themes/base/jquery.ui.button.css @@ -1,7 +1,7 @@ /* * jQuery UI Button @VERSION * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) * Dual licensed under the MIT or GPL Version 2 licenses. * http://jquery.org/license * diff --git a/themes/base/jquery.ui.core.css b/themes/base/jquery.ui.core.css index 143d6c240..1522dabb8 100644 --- a/themes/base/jquery.ui.core.css +++ b/themes/base/jquery.ui.core.css @@ -1,7 +1,7 @@ /* * jQuery UI CSS Framework @VERSION * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) * Dual licensed under the MIT or GPL Version 2 licenses. * http://jquery.org/license * diff --git a/themes/base/jquery.ui.datepicker.css b/themes/base/jquery.ui.datepicker.css index 8d574bac4..d5c81a529 100644 --- a/themes/base/jquery.ui.datepicker.css +++ b/themes/base/jquery.ui.datepicker.css @@ -1,7 +1,7 @@ /* * jQuery UI Datepicker @VERSION * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) * Dual licensed under the MIT or GPL Version 2 licenses. * http://jquery.org/license * diff --git a/themes/base/jquery.ui.dialog.css b/themes/base/jquery.ui.dialog.css index c3a1d85ea..7d6bc0672 100644 --- a/themes/base/jquery.ui.dialog.css +++ b/themes/base/jquery.ui.dialog.css @@ -1,7 +1,7 @@ /* * jQuery UI Dialog @VERSION * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) * Dual licensed under the MIT or GPL Version 2 licenses. * http://jquery.org/license * diff --git a/themes/base/jquery.ui.menu.css b/themes/base/jquery.ui.menu.css index 2df00733f..84d7d85b1 100644 --- a/themes/base/jquery.ui.menu.css +++ b/themes/base/jquery.ui.menu.css @@ -1,7 +1,7 @@ /* * jQuery UI Menu @VERSION * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) * Dual licensed under the MIT or GPL Version 2 licenses. * http://jquery.org/license * diff --git a/themes/base/jquery.ui.progressbar.css b/themes/base/jquery.ui.progressbar.css index 79d786fa7..e24afc886 100644 --- a/themes/base/jquery.ui.progressbar.css +++ b/themes/base/jquery.ui.progressbar.css @@ -1,7 +1,7 @@ /* * jQuery UI Progressbar @VERSION * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) * Dual licensed under the MIT or GPL Version 2 licenses. * http://jquery.org/license * diff --git a/themes/base/jquery.ui.resizable.css b/themes/base/jquery.ui.resizable.css index ed6395230..c652ddb98 100644 --- a/themes/base/jquery.ui.resizable.css +++ b/themes/base/jquery.ui.resizable.css @@ -1,7 +1,7 @@ /* * jQuery UI Resizable @VERSION * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) * Dual licensed under the MIT or GPL Version 2 licenses. * http://jquery.org/license * diff --git a/themes/base/jquery.ui.selectable.css b/themes/base/jquery.ui.selectable.css index 5177f6b1f..0305e2df2 100644 --- a/themes/base/jquery.ui.selectable.css +++ b/themes/base/jquery.ui.selectable.css @@ -1,7 +1,7 @@ /* * jQuery UI Selectable @VERSION * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) * Dual licensed under the MIT or GPL Version 2 licenses. * http://jquery.org/license * diff --git a/themes/base/jquery.ui.slider.css b/themes/base/jquery.ui.slider.css index 8d9b403a9..e9fc963f2 100644 --- a/themes/base/jquery.ui.slider.css +++ b/themes/base/jquery.ui.slider.css @@ -1,7 +1,7 @@ /* * jQuery UI Slider @VERSION * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) * Dual licensed under the MIT or GPL Version 2 licenses. * http://jquery.org/license * diff --git a/themes/base/jquery.ui.spinner.css b/themes/base/jquery.ui.spinner.css index 319782ecb..2603f2012 100644 --- a/themes/base/jquery.ui.spinner.css +++ b/themes/base/jquery.ui.spinner.css @@ -1,7 +1,7 @@ /* * jQuery UI Spinner @VERSION * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) * Dual licensed under the MIT or GPL Version 2 licenses. * http://jquery.org/license * diff --git a/themes/base/jquery.ui.tabs.css b/themes/base/jquery.ui.tabs.css index b6429cf72..a44242a36 100644 --- a/themes/base/jquery.ui.tabs.css +++ b/themes/base/jquery.ui.tabs.css @@ -1,7 +1,7 @@ /* * jQuery UI Tabs @VERSION * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) * Dual licensed under the MIT or GPL Version 2 licenses. * http://jquery.org/license * diff --git a/themes/base/jquery.ui.theme.css b/themes/base/jquery.ui.theme.css index 368ebfbb5..94db2c5a7 100644 --- a/themes/base/jquery.ui.theme.css +++ b/themes/base/jquery.ui.theme.css @@ -1,7 +1,7 @@ /* * jQuery UI CSS Framework @VERSION * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) * Dual licensed under the MIT or GPL Version 2 licenses. * http://jquery.org/license * diff --git a/themes/base/jquery.ui.tooltip.css b/themes/base/jquery.ui.tooltip.css index 058ce6cf4..d6cbcb26d 100644 --- a/themes/base/jquery.ui.tooltip.css +++ b/themes/base/jquery.ui.tooltip.css @@ -1,7 +1,7 @@ /* * jQuery UI Tooltip @VERSION * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) * Dual licensed under the MIT or GPL Version 2 licenses. * http://jquery.org/license * diff --git a/ui/jquery.effects.blind.js b/ui/jquery.effects.blind.js index 0e3f25db7..a5e0d1c8b 100644 --- a/ui/jquery.effects.blind.js +++ b/ui/jquery.effects.blind.js @@ -1,7 +1,7 @@ /* * jQuery UI Effects Blind @VERSION * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) * Dual licensed under the MIT or GPL Version 2 licenses. * http://jquery.org/license * diff --git a/ui/jquery.effects.bounce.js b/ui/jquery.effects.bounce.js index 41ee34f64..73fe3c502 100644 --- a/ui/jquery.effects.bounce.js +++ b/ui/jquery.effects.bounce.js @@ -1,7 +1,7 @@ /* * jQuery UI Effects Bounce @VERSION * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) * Dual licensed under the MIT or GPL Version 2 licenses. * http://jquery.org/license * diff --git a/ui/jquery.effects.clip.js b/ui/jquery.effects.clip.js index c6eecc671..983ac9c53 100644 --- a/ui/jquery.effects.clip.js +++ b/ui/jquery.effects.clip.js @@ -1,7 +1,7 @@ /* * jQuery UI Effects Clip @VERSION * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) * Dual licensed under the MIT or GPL Version 2 licenses. * http://jquery.org/license * diff --git a/ui/jquery.effects.core.js b/ui/jquery.effects.core.js index bc69c9477..24df7178c 100644 --- a/ui/jquery.effects.core.js +++ b/ui/jquery.effects.core.js @@ -1,7 +1,7 @@ /* * jQuery UI Effects @VERSION * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) * Dual licensed under the MIT or GPL Version 2 licenses. * http://jquery.org/license * diff --git a/ui/jquery.effects.drop.js b/ui/jquery.effects.drop.js index 2e7a6ec0f..54cdc25f3 100644 --- a/ui/jquery.effects.drop.js +++ b/ui/jquery.effects.drop.js @@ -1,7 +1,7 @@ /* * jQuery UI Effects Drop @VERSION * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) * Dual licensed under the MIT or GPL Version 2 licenses. * http://jquery.org/license * diff --git a/ui/jquery.effects.explode.js b/ui/jquery.effects.explode.js index 22f506045..08908d3eb 100644 --- a/ui/jquery.effects.explode.js +++ b/ui/jquery.effects.explode.js @@ -1,7 +1,7 @@ /* * jQuery UI Effects Explode @VERSION * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) * Dual licensed under the MIT or GPL Version 2 licenses. * http://jquery.org/license * diff --git a/ui/jquery.effects.fade.js b/ui/jquery.effects.fade.js index 9b79ad3bc..b653f1dfd 100644 --- a/ui/jquery.effects.fade.js +++ b/ui/jquery.effects.fade.js @@ -1,7 +1,7 @@ /* * jQuery UI Effects Fade @VERSION * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) * Dual licensed under the MIT or GPL Version 2 licenses. * http://jquery.org/license * diff --git a/ui/jquery.effects.fold.js b/ui/jquery.effects.fold.js index 7c4f583c1..3642edf3f 100644 --- a/ui/jquery.effects.fold.js +++ b/ui/jquery.effects.fold.js @@ -1,7 +1,7 @@ /* * jQuery UI Effects Fold @VERSION * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) * Dual licensed under the MIT or GPL Version 2 licenses. * http://jquery.org/license * diff --git a/ui/jquery.effects.highlight.js b/ui/jquery.effects.highlight.js index edde845a3..88a69ab51 100644 --- a/ui/jquery.effects.highlight.js +++ b/ui/jquery.effects.highlight.js @@ -1,7 +1,7 @@ /* * jQuery UI Effects Highlight @VERSION * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) * Dual licensed under the MIT or GPL Version 2 licenses. * http://jquery.org/license * diff --git a/ui/jquery.effects.pulsate.js b/ui/jquery.effects.pulsate.js index 7d6e9328f..e1e4d0631 100644 --- a/ui/jquery.effects.pulsate.js +++ b/ui/jquery.effects.pulsate.js @@ -1,7 +1,7 @@ /* * jQuery UI Effects Pulsate @VERSION * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) * Dual licensed under the MIT or GPL Version 2 licenses. * http://jquery.org/license * diff --git a/ui/jquery.effects.scale.js b/ui/jquery.effects.scale.js index 96a9269ec..64e31ea96 100644 --- a/ui/jquery.effects.scale.js +++ b/ui/jquery.effects.scale.js @@ -1,7 +1,7 @@ /* * jQuery UI Effects Scale @VERSION * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) * Dual licensed under the MIT or GPL Version 2 licenses. * http://jquery.org/license * diff --git a/ui/jquery.effects.shake.js b/ui/jquery.effects.shake.js index 7d83a9bb8..0e12cfe56 100644 --- a/ui/jquery.effects.shake.js +++ b/ui/jquery.effects.shake.js @@ -1,7 +1,7 @@ /* * jQuery UI Effects Shake @VERSION * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) * Dual licensed under the MIT or GPL Version 2 licenses. * http://jquery.org/license * diff --git a/ui/jquery.effects.slide.js b/ui/jquery.effects.slide.js index de393c779..a376d3c56 100644 --- a/ui/jquery.effects.slide.js +++ b/ui/jquery.effects.slide.js @@ -1,7 +1,7 @@ /* * jQuery UI Effects Slide @VERSION * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) * Dual licensed under the MIT or GPL Version 2 licenses. * http://jquery.org/license * diff --git a/ui/jquery.effects.transfer.js b/ui/jquery.effects.transfer.js index 1fa291228..df392339b 100644 --- a/ui/jquery.effects.transfer.js +++ b/ui/jquery.effects.transfer.js @@ -1,7 +1,7 @@ /* * jQuery UI Effects Transfer @VERSION * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) * Dual licensed under the MIT or GPL Version 2 licenses. * http://jquery.org/license * diff --git a/ui/jquery.ui.accordion.js b/ui/jquery.ui.accordion.js index 4aa4793cc..7f167d6b1 100644 --- a/ui/jquery.ui.accordion.js +++ b/ui/jquery.ui.accordion.js @@ -1,7 +1,7 @@ /* * jQuery UI Accordion @VERSION * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) * Dual licensed under the MIT or GPL Version 2 licenses. * http://jquery.org/license * diff --git a/ui/jquery.ui.autocomplete.js b/ui/jquery.ui.autocomplete.js index 05a2a28f2..d95d81bca 100644 --- a/ui/jquery.ui.autocomplete.js +++ b/ui/jquery.ui.autocomplete.js @@ -1,7 +1,7 @@ /* * jQuery UI Autocomplete @VERSION * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) * Dual licensed under the MIT or GPL Version 2 licenses. * http://jquery.org/license * diff --git a/ui/jquery.ui.button.js b/ui/jquery.ui.button.js index 25f1668a5..c8e345d93 100644 --- a/ui/jquery.ui.button.js +++ b/ui/jquery.ui.button.js @@ -1,7 +1,7 @@ /* * jQuery UI Button @VERSION * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) * Dual licensed under the MIT or GPL Version 2 licenses. * http://jquery.org/license * diff --git a/ui/jquery.ui.core.js b/ui/jquery.ui.core.js index 6345ef69c..574256cad 100644 --- a/ui/jquery.ui.core.js +++ b/ui/jquery.ui.core.js @@ -1,7 +1,7 @@ /*! * jQuery UI @VERSION * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) * Dual licensed under the MIT or GPL Version 2 licenses. * http://jquery.org/license * diff --git a/ui/jquery.ui.datepicker.js b/ui/jquery.ui.datepicker.js index 529032a99..5dacd6943 100644 --- a/ui/jquery.ui.datepicker.js +++ b/ui/jquery.ui.datepicker.js @@ -1,7 +1,7 @@ /* * jQuery UI Datepicker @VERSION * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) * Dual licensed under the MIT or GPL Version 2 licenses. * http://jquery.org/license * diff --git a/ui/jquery.ui.dialog.js b/ui/jquery.ui.dialog.js index 1f959a837..35b18929f 100644 --- a/ui/jquery.ui.dialog.js +++ b/ui/jquery.ui.dialog.js @@ -1,7 +1,7 @@ /* * jQuery UI Dialog @VERSION * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) * Dual licensed under the MIT or GPL Version 2 licenses. * http://jquery.org/license * diff --git a/ui/jquery.ui.draggable.js b/ui/jquery.ui.draggable.js index 62864454d..0e4389305 100644 --- a/ui/jquery.ui.draggable.js +++ b/ui/jquery.ui.draggable.js @@ -1,7 +1,7 @@ /* * jQuery UI Draggable @VERSION * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) * Dual licensed under the MIT or GPL Version 2 licenses. * http://jquery.org/license * diff --git a/ui/jquery.ui.droppable.js b/ui/jquery.ui.droppable.js index 62bba2aba..19334bf4d 100644 --- a/ui/jquery.ui.droppable.js +++ b/ui/jquery.ui.droppable.js @@ -1,7 +1,7 @@ /* * jQuery UI Droppable @VERSION * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) * Dual licensed under the MIT or GPL Version 2 licenses. * http://jquery.org/license * diff --git a/ui/jquery.ui.menu.js b/ui/jquery.ui.menu.js index 05ecd3feb..18f4eb9f8 100644 --- a/ui/jquery.ui.menu.js +++ b/ui/jquery.ui.menu.js @@ -1,7 +1,7 @@ /* * jQuery UI Menu @VERSION * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) * Dual licensed under the MIT or GPL Version 2 licenses. * http://jquery.org/license * diff --git a/ui/jquery.ui.mouse.js b/ui/jquery.ui.mouse.js index 4ff18ff4f..64a081961 100644 --- a/ui/jquery.ui.mouse.js +++ b/ui/jquery.ui.mouse.js @@ -1,7 +1,7 @@ /*! * jQuery UI Mouse @VERSION * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) * Dual licensed under the MIT or GPL Version 2 licenses. * http://jquery.org/license * diff --git a/ui/jquery.ui.position.js b/ui/jquery.ui.position.js index b8bb2c883..977e621a6 100644 --- a/ui/jquery.ui.position.js +++ b/ui/jquery.ui.position.js @@ -1,7 +1,7 @@ /* * jQuery UI Position @VERSION * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) * Dual licensed under the MIT or GPL Version 2 licenses. * http://jquery.org/license * diff --git a/ui/jquery.ui.progressbar.js b/ui/jquery.ui.progressbar.js index f754f61a4..26f5e76f0 100644 --- a/ui/jquery.ui.progressbar.js +++ b/ui/jquery.ui.progressbar.js @@ -1,7 +1,7 @@ /* * jQuery UI Progressbar @VERSION * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) * Dual licensed under the MIT or GPL Version 2 licenses. * http://jquery.org/license * diff --git a/ui/jquery.ui.resizable.js b/ui/jquery.ui.resizable.js index 0fdd69532..77fe8bcc1 100644 --- a/ui/jquery.ui.resizable.js +++ b/ui/jquery.ui.resizable.js @@ -1,7 +1,7 @@ /* * jQuery UI Resizable @VERSION * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) * Dual licensed under the MIT or GPL Version 2 licenses. * http://jquery.org/license * diff --git a/ui/jquery.ui.selectable.js b/ui/jquery.ui.selectable.js index 408771eff..ec54b5d9c 100644 --- a/ui/jquery.ui.selectable.js +++ b/ui/jquery.ui.selectable.js @@ -1,7 +1,7 @@ /* * jQuery UI Selectable @VERSION * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) * Dual licensed under the MIT or GPL Version 2 licenses. * http://jquery.org/license * diff --git a/ui/jquery.ui.slider.js b/ui/jquery.ui.slider.js index 36075507e..75c6631ca 100644 --- a/ui/jquery.ui.slider.js +++ b/ui/jquery.ui.slider.js @@ -1,7 +1,7 @@ /* * jQuery UI Slider @VERSION * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) * Dual licensed under the MIT or GPL Version 2 licenses. * http://jquery.org/license * diff --git a/ui/jquery.ui.sortable.js b/ui/jquery.ui.sortable.js index 7c81dd2e4..4c6a47169 100644 --- a/ui/jquery.ui.sortable.js +++ b/ui/jquery.ui.sortable.js @@ -1,7 +1,7 @@ /* * jQuery UI Sortable @VERSION * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) * Dual licensed under the MIT or GPL Version 2 licenses. * http://jquery.org/license * diff --git a/ui/jquery.ui.spinner.js b/ui/jquery.ui.spinner.js index c99520b7c..dab7ce471 100644 --- a/ui/jquery.ui.spinner.js +++ b/ui/jquery.ui.spinner.js @@ -1,7 +1,7 @@ /* * jQuery UI Spinner @VERSION * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) * Dual licensed under the MIT or GPL Version 2 licenses. * http://jquery.org/license * diff --git a/ui/jquery.ui.tabs.js b/ui/jquery.ui.tabs.js index eca1a5c1b..ba48c3770 100644 --- a/ui/jquery.ui.tabs.js +++ b/ui/jquery.ui.tabs.js @@ -1,7 +1,7 @@ /* * jQuery UI Tabs @VERSION * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) * Dual licensed under the MIT or GPL Version 2 licenses. * http://jquery.org/license * diff --git a/ui/jquery.ui.tooltip.js b/ui/jquery.ui.tooltip.js index 08ad19636..eddd9a0c9 100644 --- a/ui/jquery.ui.tooltip.js +++ b/ui/jquery.ui.tooltip.js @@ -1,7 +1,7 @@ /* * jQuery UI Tooltip @VERSION * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) * Dual licensed under the MIT or GPL Version 2 licenses. * http://jquery.org/license * diff --git a/ui/jquery.ui.widget.js b/ui/jquery.ui.widget.js index 40abd67de..1b7405e28 100644 --- a/ui/jquery.ui.widget.js +++ b/ui/jquery.ui.widget.js @@ -1,7 +1,7 @@ /*! * jQuery UI Widget @VERSION * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) * Dual licensed under the MIT or GPL Version 2 licenses. * http://jquery.org/license * -- cgit v1.2.3 From edec16acbbac57596364a5c1f9d2bb895143f5c1 Mon Sep 17 00:00:00 2001 From: Scott González Date: Thu, 8 Mar 2012 11:11:30 -0500 Subject: Added composite test suite for all 'active' tests. --- tests/unit/all-active.html | 72 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 tests/unit/all-active.html (limited to 'tests') diff --git a/tests/unit/all-active.html b/tests/unit/all-active.html new file mode 100644 index 000000000..f014078f6 --- /dev/null +++ b/tests/unit/all-active.html @@ -0,0 +1,72 @@ + + + + + jQuery UI Test Suite + + + + + + + + + + + + +

jQuery UI Test Suite

+

+
+

+
    +
    + +
    + + -- cgit v1.2.3 From 575baa0e2c0584ab6ed297b2a566313ef50bf215 Mon Sep 17 00:00:00 2001 From: Jörn Zaefferer Date: Sat, 10 Mar 2012 15:38:30 +0100 Subject: Updated to QUnit 1.4.0. Added expect(0) to make tabs and tooltip tests pass, even though those assertions are actually missing. Introduces dialog and slider failures when running in composite all.html suite, all green when running one by one, also all-active.html is green. --- external/qunit.css | 2 +- external/qunit.js | 457 ++++++++++++++++++++----------------- tests/unit/tabs/tabs_core.js | 1 + tests/unit/tooltip/tooltip_core.js | 1 + 4 files changed, 245 insertions(+), 216 deletions(-) (limited to 'tests') diff --git a/external/qunit.css b/external/qunit.css index 58101ea34..4be7e3643 100644 --- a/external/qunit.css +++ b/external/qunit.css @@ -1,5 +1,5 @@ /** - * QUnit v1.4.0pre - A JavaScript Unit Testing Framework + * QUnit v1.4.0 - A JavaScript Unit Testing Framework * * http://docs.jquery.com/QUnit * diff --git a/external/qunit.js b/external/qunit.js index 1d609f61a..f50407ae5 100644 --- a/external/qunit.js +++ b/external/qunit.js @@ -1,5 +1,5 @@ /** - * QUnit v1.4.0pre - A JavaScript Unit Testing Framework + * QUnit v1.4.0 - A JavaScript Unit Testing Framework * * http://docs.jquery.com/QUnit * @@ -21,7 +21,7 @@ var defined = { } catch(e) { return false; } - })() + }()) }; var testId = 0, @@ -85,14 +85,17 @@ Test.prototype = { // TODO why?? QUnit.current_testEnvironment = this.testEnvironment; + if ( !config.pollution ) { + saveGlobal(); + } + if ( config.notrycatch ) { + this.testEnvironment.setup.call(this.testEnvironment); + return; + } try { - if ( !config.pollution ) { - saveGlobal(); - } - this.testEnvironment.setup.call(this.testEnvironment); } catch(e) { - QUnit.ok( false, "Setup failed on " + this.testName + ": " + e.message ); + QUnit.pushFailure( "Setup failed on " + this.testName + ": " + e.message, extractStacktrace( e, 1 ) ); } }, run: function() { @@ -108,8 +111,7 @@ Test.prototype = { try { this.callback.call(this.testEnvironment); } catch(e) { - fail("Test " + this.testName + " died, exception and test follows", e, this.callback); - QUnit.ok( false, "Died on test #" + (this.assertions.length + 1) + ": " + e.message + " - " + QUnit.jsDump.parse(e) ); + QUnit.pushFailure( "Died on test #" + (this.assertions.length + 1) + ": " + e.message, extractStacktrace( e, 1 ) ); // else next test will carry the responsibility saveGlobal(); @@ -121,20 +123,28 @@ Test.prototype = { }, teardown: function() { config.current = this; - try { + if ( config.notrycatch ) { this.testEnvironment.teardown.call(this.testEnvironment); - checkPollution(); - } catch(e) { - QUnit.ok( false, "Teardown failed on " + this.testName + ": " + e.message ); + return; + } else { + try { + this.testEnvironment.teardown.call(this.testEnvironment); + } catch(e) { + QUnit.pushFailure( "Teardown failed on " + this.testName + ": " + e.message, extractStacktrace( e, 1 ) ); + } } + checkPollution(); }, finish: function() { config.current = this; if ( this.expected != null && this.expected != this.assertions.length ) { - QUnit.ok( false, "Expected " + this.expected + " assertions, but " + this.assertions.length + " were run" ); + QUnit.pushFailure( "Expected " + this.expected + " assertions, but " + this.assertions.length + " were run" ); + } else if ( this.expected == null && !this.assertions.length ) { + QUnit.pushFailure( "Expected at least one assertion, but none were run - call expect(0) to accept zero assertions." ); } var good = 0, bad = 0, + li, i, tests = id("qunit-tests"); config.stats.all += this.assertions.length; @@ -143,10 +153,10 @@ Test.prototype = { if ( tests ) { var ol = document.createElement("ol"); - for ( var i = 0; i < this.assertions.length; i++ ) { + for ( i = 0; i < this.assertions.length; i++ ) { var assertion = this.assertions[i]; - var li = document.createElement("li"); + li = document.createElement("li"); li.className = assertion.result ? "pass" : "fail"; li.innerHTML = assertion.message || (assertion.result ? "okay" : "failed"); ol.appendChild( li ); @@ -163,13 +173,13 @@ Test.prototype = { // store result when possible if ( QUnit.config.reorder && defined.sessionStorage ) { if (bad) { - sessionStorage.setItem("qunit-" + this.module + "-" + this.testName, bad); + sessionStorage.setItem("qunit-test-" + this.module + "-" + this.testName, bad); } else { - sessionStorage.removeItem("qunit-" + this.module + "-" + this.testName); + sessionStorage.removeItem("qunit-test-" + this.module + "-" + this.testName); } } - if (bad == 0) { + if (bad === 0) { ol.style.display = "none"; } @@ -196,7 +206,7 @@ Test.prototype = { } }); - var li = id(this.id); + li = id(this.id); li.className = bad ? "fail" : "pass"; li.removeChild( li.firstChild ); li.appendChild( b ); @@ -204,7 +214,7 @@ Test.prototype = { li.appendChild( ol ); } else { - for ( var i = 0; i < this.assertions.length; i++ ) { + for ( i = 0; i < this.assertions.length; i++ ) { if ( !this.assertions[i].result ) { bad++; config.stats.bad++; @@ -213,11 +223,7 @@ Test.prototype = { } } - try { - QUnit.reset(); - } catch(e) { - fail("reset() failed, following Test " + this.testName + ", exception and reset fn follows", e, QUnit.reset); - } + QUnit.reset(); runLoggingCallbacks( 'testDone', QUnit, { name: this.testName, @@ -249,12 +255,12 @@ Test.prototype = { }); } // defer when previous test run passed, if storage is available - var bad = QUnit.config.reorder && defined.sessionStorage && +sessionStorage.getItem("qunit-" + this.module + "-" + this.testName); + var bad = QUnit.config.reorder && defined.sessionStorage && +sessionStorage.getItem("qunit-test-" + this.module + "-" + this.testName); if (bad) { run(); } else { synchronize(run, true); - }; + } } }; @@ -298,46 +304,39 @@ var QUnit = { test.queue(); }, - /** - * Specify the number of expected assertions to gurantee that failed test (no assertions are run at all) don't slip through. - */ + // Specify the number of expected assertions to gurantee that failed test (no assertions are run at all) don't slip through. expect: function(asserts) { config.current.expected = asserts; }, - /** - * Asserts true. - * @example ok( "asdfasdf".length > 5, "There must be at least 5 chars" ); - */ - ok: function(a, msg) { + // Asserts true. + // @example ok( "asdfasdf".length > 5, "There must be at least 5 chars" ); + ok: function(result, msg) { if (!config.current) { throw new Error("ok() assertion outside test context, was " + sourceFromStacktrace(2)); } - a = !!a; + result = !!result; var details = { - result: a, + result: result, message: msg }; - msg = escapeInnerText(msg); + msg = escapeInnerText(msg || (result ? "okay" : "failed")); + if ( !result ) { + var source = sourceFromStacktrace(2); + if (source) { + details.source = source; + msg += '
    Source:
    ' + escapeInnerText(source) + '
    '; + } + } runLoggingCallbacks( 'log', QUnit, details ); config.current.assertions.push({ - result: a, + result: result, message: msg }); }, - /** - * Checks that the first two arguments are equal, with an optional message. - * Prints out both actual and expected values. - * - * Prefered to ok( actual == expected, message ) - * - * @example equal( format("Received {0} bytes.", 2), "Received 2 bytes." ); - * - * @param Object actual - * @param Object expected - * @param String message (optional) - */ + // Checks that the first two arguments are equal, with an optional message. Prints out both actual and expected values. + // @example equal( format("Received {0} bytes.", 2), "Received 2 bytes." ); equal: function(actual, expected, message) { QUnit.push(expected == actual, actual, expected, message); }, @@ -441,20 +440,20 @@ var QUnit = { //We want access to the constructor's prototype (function() { - function F(){}; + function F(){} F.prototype = QUnit; QUnit = new F(); //Make F QUnit's constructor so that we can add to the prototype later QUnit.constructor = F; -})(); +}()); // deprecated; still export them to window to provide clear error messages // next step: remove entirely QUnit.equals = function() { - throw new Error("QUnit.equals has been deprecated since 2009 (e88049a0), use QUnit.equal instead"); + QUnit.push(false, false, false, "QUnit.equals has been deprecated since 2009 (e88049a0), use QUnit.equal instead"); }; QUnit.same = function() { - throw new Error("QUnit.same has been deprecated since 2009 (e88049a0), use QUnit.deepEqual instead"); + QUnit.push(false, false, false, "QUnit.same has been deprecated since 2009 (e88049a0), use QUnit.deepEqual instead"); }; // Maintain internal state @@ -510,16 +509,14 @@ var config = { config.filter = urlParams.filter; // Figure out if we're running the tests from a server or not - QUnit.isLocal = !!(location.protocol === 'file:'); -})(); + QUnit.isLocal = location.protocol === 'file:'; +}()); // Expose the API as global variables, unless an 'exports' -// object exists, in that case we assume we're in CommonJS +// object exists, in that case we assume we're in CommonJS - export everything at the end if ( typeof exports === "undefined" || typeof require === "undefined" ) { extend(window, QUnit); window.QUnit = QUnit; -} else { - module.exports = QUnit; } // define these after exposing globals to keep them in these QUnit namespace only @@ -531,7 +528,7 @@ extend(QUnit, { extend(config, { stats: { all: 0, bad: 0 }, moduleStats: { all: 0, bad: 0 }, - started: +new Date, + started: +new Date(), updateRate: 1000, blocking: false, autostart: true, @@ -576,11 +573,8 @@ extend(QUnit, { } }, - /** - * Resets the test setup. Useful for tests that modify the DOM. - * - * If jQuery is available, uses jQuery's html(), otherwise just innerHTML. - */ + // Resets the test setup. Useful for tests that modify the DOM. + // If jQuery is available, uses jQuery's html(), otherwise just innerHTML. reset: function() { if ( window.jQuery ) { jQuery( "#qunit-fixture" ).html( config.fixture ); @@ -592,14 +586,8 @@ extend(QUnit, { } }, - /** - * Trigger an event on an element. - * - * @example triggerEvent( document.body, "click" ); - * - * @param DOMElement elem - * @param String type - */ + // Trigger an event on an element. + // @example triggerEvent( document.body, "click" ); triggerEvent: function( elem, type, event ) { if ( document.createEvent ) { event = document.createEvent("MouseEvents"); @@ -630,19 +618,18 @@ extend(QUnit, { var type = toString.call( obj ).match(/^\[object\s(.*)\]$/)[1] || ''; switch (type) { - case 'Number': - if (isNaN(obj)) { - return "nan"; - } else { - return "number"; - } - case 'String': - case 'Boolean': - case 'Array': - case 'Date': - case 'RegExp': - case 'Function': - return type.toLowerCase(); + case 'Number': + if (isNaN(obj)) { + return "nan"; + } + return "number"; + case 'String': + case 'Boolean': + case 'Array': + case 'Date': + case 'RegExp': + case 'Function': + return type.toLowerCase(); } if (typeof obj === "object") { return "object"; @@ -688,6 +675,23 @@ extend(QUnit, { }); }, + pushFailure: function(message, source) { + var details = { + result: false, + message: message + }; + var output = escapeInnerText(message); + if (source) { + details.source = source; + output += '
    Source:
    ' + escapeInnerText(source) + '
    '; + } + runLoggingCallbacks( 'log', QUnit, details ); + config.current.assertions.push({ + result: false, + message: output + }); + }, + url: function( params ) { params = extend( extend( {}, QUnit.urlParams ), params ); var querystring = "?", @@ -743,7 +747,8 @@ QUnit.load = function() { config.blocking = false; var urlConfigHtml = '', len = config.urlConfig.length; - for ( var i = 0, val; i < len, val = config.urlConfig[i]; i++ ) { + for ( var i = 0, val; i < len; i++ ) { + val = config.urlConfig[i]; config[val] = QUnit.urlParams[val]; urlConfigHtml += ''; } @@ -811,10 +816,10 @@ addEvent(window, "load", QUnit.load); // addEvent(window, "error") gives us a useless event object window.onerror = function( message, file, line ) { if ( QUnit.config.current ) { - ok( false, message + ", " + file + ":" + line ); + QUnit.pushFailure( message, file + ":" + line ); } else { - test( "global failure", function() { - ok( false, message + ", " + file + ":" + line ); + QUnit.test( "global failure", function() { + QUnit.pushFailure( message, file + ":" + line ); }); } }; @@ -834,7 +839,7 @@ function done() { var banner = id("qunit-banner"), tests = id("qunit-tests"), - runtime = +new Date - config.started, + runtime = +new Date() - config.started, passed = config.stats.all - config.stats.bad, html = [ 'Tests completed in ', @@ -869,7 +874,7 @@ function done() { // clear own sessionStorage items if all tests passed if ( config.reorder && defined.sessionStorage && config.stats.bad === 0 ) { for (var key in sessionStorage) { - if (sessionStorage.hasOwnProperty(key) && key.indexOf("qunit-") === 0 ) { + if (sessionStorage.hasOwnProperty(key) && key.indexOf("qunit-test-") === 0 ) { sessionStorage.removeItem(key); } } @@ -909,26 +914,34 @@ function validTest( name ) { // so far supports only Firefox, Chrome and Opera (buggy) // could be extended in the future to use something like https://github.com/csnover/TraceKit -function sourceFromStacktrace(offset) { +function extractStacktrace( e, offset ) { offset = offset || 3; + if (e.stacktrace) { + // Opera + return e.stacktrace.split("\n")[offset + 3]; + } else if (e.stack) { + // Firefox, Chrome + var stack = e.stack.split("\n"); + if (/^error$/i.test(stack[0])) { + stack.shift(); + } + return stack[offset]; + } else if (e.sourceURL) { + // Safari, PhantomJS + // hopefully one day Safari provides actual stacktraces + // exclude useless self-reference for generated Error objects + if ( /qunit.js$/.test( e.sourceURL ) ) { + return; + } + // for actual exceptions, this is useful + return e.sourceURL + ":" + e.line; + } +} +function sourceFromStacktrace(offset) { try { throw new Error(); } catch ( e ) { - if (e.stacktrace) { - // Opera - return e.stacktrace.split("\n")[offset + 3]; - } else if (e.stack) { - // Firefox, Chrome - var stack = e.stack.split("\n"); - if (/^error$/i.test(stack[0])) { - stack.shift(); - } - return stack[offset]; - } else if (e.sourceURL) { - // Safari, PhantomJS - // TODO sourceURL points at the 'throw new Error' line above, useless - //return e.sourceURL + ":" + e.line; - } + return extractStacktrace( e, offset ); } } @@ -956,6 +969,9 @@ function synchronize( callback, last ) { } function process( last ) { + function next() { + process( last ); + } var start = new Date().getTime(); config.depth = config.depth ? config.depth + 1 : 1; @@ -963,9 +979,7 @@ function process( last ) { if ( !defined.setTimeout || config.updateRate <= 0 || ( ( new Date().getTime() - start ) < config.updateRate ) ) { config.queue.shift()(); } else { - window.setTimeout( function(){ - process( last ); - }, 13 ); + window.setTimeout( next, 13 ); break; } } @@ -994,12 +1008,12 @@ function checkPollution( name ) { var newGlobals = diff( config.pollution, old ); if ( newGlobals.length > 0 ) { - ok( false, "Introduced global variable(s): " + newGlobals.join(", ") ); + QUnit.pushFailure( "Introduced global variable(s): " + newGlobals.join(", ") ); } var deletedGlobals = diff( old, config.pollution ); if ( deletedGlobals.length > 0 ) { - ok( false, "Deleted global variable(s): " + deletedGlobals.join(", ") ); + QUnit.pushFailure( "Deleted global variable(s): " + deletedGlobals.join(", ") ); } } @@ -1018,18 +1032,6 @@ function diff( a, b ) { return result; } -function fail(message, exception, callback) { - if ( typeof console !== "undefined" && console.error && console.warn ) { - console.error(message); - console.error(exception); - console.error(exception.stack); - console.warn(callback.toString()); - - } else if ( window.opera && opera.postError ) { - opera.postError(message, exception, callback.toString); - } -} - function extend(a, b) { for ( var prop in b ) { if ( b[prop] === undefined ) { @@ -1081,7 +1083,7 @@ function runLoggingCallbacks(key, scope, args) { // Test for equality any JavaScript type. // Author: Philippe Rathé -QUnit.equiv = function () { +QUnit.equiv = (function() { var innerEquiv; // the real equiv function var callers = []; // stack to decide between skip/abort functions @@ -1103,7 +1105,7 @@ QUnit.equiv = function () { return obj.__proto__; }; - var callbacks = function () { + var callbacks = (function () { // for string, boolean, number and null function useStrictEquality(b, a) { @@ -1130,17 +1132,18 @@ QUnit.equiv = function () { }, "date" : function(b, a) { - return QUnit.objectType(b) === "date" - && a.valueOf() === b.valueOf(); + return QUnit.objectType(b) === "date" && a.valueOf() === b.valueOf(); }, "regexp" : function(b, a) { - return QUnit.objectType(b) === "regexp" - && a.source === b.source && // the regex itself - a.global === b.global && // and its modifers - // (gmi) ... - a.ignoreCase === b.ignoreCase - && a.multiline === b.multiline; + return QUnit.objectType(b) === "regexp" && + // the regex itself + a.source === b.source && + // and its modifers + a.global === b.global && + // (gmi) ... + a.ignoreCase === b.ignoreCase && + a.multiline === b.multiline; }, // - skip when the property is a method of an instance (OOP) @@ -1156,7 +1159,7 @@ QUnit.equiv = function () { var len; // b could be an object literal here - if (!(QUnit.objectType(b) === "array")) { + if (QUnit.objectType(b) !== "array") { return false; } @@ -1195,7 +1198,7 @@ QUnit.equiv = function () { // Allow objects with no prototype to be equivalent to // objects with Object as their constructor. if (!((getProto(a) === null && getProto(b) === Object.prototype) || - (getProto(b) === null && getProto(a) === Object.prototype))) + (getProto(b) === null && getProto(a) === Object.prototype))) { return false; } @@ -1210,9 +1213,10 @@ QUnit.equiv = function () { // and go deep loop = false; for (j = 0; j < parents.length; j++) { - if (parents[j] === a[i]) - loop = true; // don't go down the same path - // twice + if (parents[j] === a[i]) { + // don't go down the same path twice + loop = true; + } } aProperties.push(i); // collect a's properties @@ -1230,12 +1234,10 @@ QUnit.equiv = function () { } // Ensures identical properties name - return eq - && innerEquiv(aProperties.sort(), bProperties - .sort()); + return eq && innerEquiv(aProperties.sort(), bProperties.sort()); } }; - }(); + }()); innerEquiv = function() { // can take multiple arguments var args = Array.prototype.slice.apply(arguments); @@ -1246,23 +1248,21 @@ QUnit.equiv = function () { return (function(a, b) { if (a === b) { return true; // catch the most you can - } else if (a === null || b === null || typeof a === "undefined" - || typeof b === "undefined" - || QUnit.objectType(a) !== QUnit.objectType(b)) { + } else if (a === null || b === null || typeof a === "undefined" || + typeof b === "undefined" || + QUnit.objectType(a) !== QUnit.objectType(b)) { return false; // don't lose time with error prone cases } else { return bindCallbacks(a, callbacks, [ b, a ]); } // apply transition with (1..n) arguments - })(args[0], args[1]) - && arguments.callee.apply(this, args.splice(1, - args.length - 1)); + }(args[0], args[1]) && arguments.callee.apply(this, args.splice(1, args.length - 1))); }; return innerEquiv; -}(); +}()); /** * jsDump Copyright (c) 2008 Ariel Flesler - aflesler(at)gmail(dot)com | @@ -1277,33 +1277,36 @@ QUnit.equiv = function () { QUnit.jsDump = (function() { function quote( str ) { return '"' + str.toString().replace(/"/g, '\\"') + '"'; - }; + } function literal( o ) { return o + ''; - }; + } function join( pre, arr, post ) { var s = jsDump.separator(), base = jsDump.indent(), inner = jsDump.indent(1); - if ( arr.join ) + if ( arr.join ) { arr = arr.join( ',' + s + inner ); - if ( !arr ) + } + if ( !arr ) { return pre + post; + } return [ pre, inner + arr, base + post ].join(s); - }; + } function array( arr, stack ) { - var i = arr.length, ret = Array(i); + var i = arr.length, ret = new Array(i); this.up(); - while ( i-- ) + while ( i-- ) { ret[i] = this.parse( arr[i] , undefined , stack); + } this.down(); return join( '[', ret, ']' ); - }; + } var reName = /^function (\w+)/; var jsDump = { - parse:function( obj, type, stack ) { //type is used mostly internally, you can fix a (custom)type in advance + parse: function( obj, type, stack ) { //type is used mostly internally, you can fix a (custom)type in advance stack = stack || [ ]; var parser = this.parsers[ type || this.typeOf(obj) ]; type = typeof parser; @@ -1321,7 +1324,7 @@ QUnit.jsDump = (function() { // else return (type == 'string') ? parser : this.parsers.error; }, - typeOf:function( obj ) { + typeOf: function( obj ) { var type; if ( obj === null ) { type = "null"; @@ -1351,45 +1354,48 @@ QUnit.jsDump = (function() { } return type; }, - separator:function() { + separator: function() { return this.multiline ? this.HTML ? '
    ' : '\n' : this.HTML ? ' ' : ' '; }, - indent:function( extra ) {// extra can be a number, shortcut for increasing-calling-decreasing - if ( !this.multiline ) + indent: function( extra ) {// extra can be a number, shortcut for increasing-calling-decreasing + if ( !this.multiline ) { return ''; + } var chr = this.indentChar; - if ( this.HTML ) + if ( this.HTML ) { chr = chr.replace(/\t/g,' ').replace(/ /g,' '); - return Array( this._depth_ + (extra||0) ).join(chr); + } + return new Array( this._depth_ + (extra||0) ).join(chr); }, - up:function( a ) { + up: function( a ) { this._depth_ += a || 1; }, - down:function( a ) { + down: function( a ) { this._depth_ -= a || 1; }, - setParser:function( name, parser ) { + setParser: function( name, parser ) { this.parsers[name] = parser; }, // The next 3 are exposed so you can use them - quote:quote, - literal:literal, - join:join, + quote: quote, + literal: literal, + join: join, // _depth_: 1, // This is the list of parsers, to modify them, use jsDump.setParser - parsers:{ + parsers: { window: '[Window]', document: '[Document]', - error:'[ERROR]', //when no parser is found, shouldn't happen + error: '[ERROR]', //when no parser is found, shouldn't happen unknown: '[Unknown]', - 'null':'null', - 'undefined':'undefined', - 'function':function( fn ) { + 'null': 'null', + 'undefined': 'undefined', + 'function': function( fn ) { var ret = 'function', name = 'name' in fn ? fn.name : (reName.exec(fn)||[])[1];//functions never have name in IE - if ( name ) + if ( name ) { ret += ' ' + name; + } ret += '('; ret = [ ret, QUnit.jsDump.parse( fn, 'functionArgs' ), '){'].join(''); @@ -1397,18 +1403,26 @@ QUnit.jsDump = (function() { }, array: array, nodelist: array, - arguments: array, - object:function( map, stack ) { - var ret = [ ]; + 'arguments': array, + object: function( map, stack ) { + var ret = [ ], keys, key, val, i; QUnit.jsDump.up(); - for ( var key in map ) { - var val = map[key]; - ret.push( QUnit.jsDump.parse(key,'key') + ': ' + QUnit.jsDump.parse(val, undefined, stack)); + if (Object.keys) { + keys = Object.keys( map ); + } else { + keys = []; + for (key in map) { keys.push( key ); } + } + keys.sort(); + for (i = 0; i < keys.length; i++) { + key = keys[ i ]; + val = map[ key ]; + ret.push( QUnit.jsDump.parse( key, 'key' ) + ': ' + QUnit.jsDump.parse( val, undefined, stack ) ); } QUnit.jsDump.down(); return join( '{', ret, '}' ); }, - node:function( node ) { + node: function( node ) { var open = QUnit.jsDump.HTML ? '<' : '<', close = QUnit.jsDump.HTML ? '>' : '>'; @@ -1417,28 +1431,32 @@ QUnit.jsDump = (function() { for ( var a in QUnit.jsDump.DOMAttrs ) { var val = node[QUnit.jsDump.DOMAttrs[a]]; - if ( val ) + if ( val ) { ret += ' ' + a + '=' + QUnit.jsDump.parse( val, 'attribute' ); + } } return ret + close + open + '/' + tag + close; }, - functionArgs:function( fn ) {//function calls it internally, it's the arguments part of the function + functionArgs: function( fn ) {//function calls it internally, it's the arguments part of the function var l = fn.length; - if ( !l ) return ''; + if ( !l ) { + return ''; + } - var args = Array(l); - while ( l-- ) + var args = new Array(l); + while ( l-- ) { args[l] = String.fromCharCode(97+l);//97 is 'a' + } return ' ' + args.join(', ') + ' '; }, - key:quote, //object calls it internally, the key part of an item in a map - functionCode:'[code]', //function calls it internally, it's the content of the function - attribute:quote, //node calls it internally, it's an html attribute value - string:quote, - date:quote, - regexp:literal, //regex - number:literal, - 'boolean':literal + key: quote, //object calls it internally, the key part of an item in a map + functionCode: '[code]', //function calls it internally, it's the content of the function + attribute: quote, //node calls it internally, it's an html attribute value + string: quote, + date: quote, + regexp: literal, //regex + number: literal, + 'boolean': literal }, DOMAttrs:{//attributes to dump from nodes, name=>realName id:'id', @@ -1451,7 +1469,7 @@ QUnit.jsDump = (function() { }; return jsDump; -})(); +}()); // from Sizzle.js function getText( elems ) { @@ -1471,7 +1489,7 @@ function getText( elems ) { } return ret; -}; +} //from jquery.js function inArray( elem, array ) { @@ -1506,26 +1524,29 @@ QUnit.diff = (function() { function diff(o, n) { var ns = {}; var os = {}; + var i; - for (var i = 0; i < n.length; i++) { - if (ns[n[i]] == null) + for (i = 0; i < n.length; i++) { + if (ns[n[i]] == null) { ns[n[i]] = { rows: [], o: null }; + } ns[n[i]].rows.push(i); } - for (var i = 0; i < o.length; i++) { - if (os[o[i]] == null) + for (i = 0; i < o.length; i++) { + if (os[o[i]] == null) { os[o[i]] = { rows: [], n: null }; + } os[o[i]].rows.push(i); } - for (var i in ns) { + for (i in ns) { if ( !hasOwn.call( ns, i ) ) { continue; } @@ -1541,7 +1562,7 @@ QUnit.diff = (function() { } } - for (var i = 0; i < n.length - 1; i++) { + for (i = 0; i < n.length - 1; i++) { if (n[i].text != null && n[i + 1].text == null && n[i].row + 1 < o.length && o[n[i].row + 1].text == null && n[i + 1] == o[n[i].row + 1]) { n[i + 1] = { @@ -1555,7 +1576,7 @@ QUnit.diff = (function() { } } - for (var i = n.length - 1; i > 0; i--) { + for (i = n.length - 1; i > 0; i--) { if (n[i].text != null && n[i - 1].text == null && n[i].row > 0 && o[n[i].row - 1].text == null && n[i - 1] == o[n[i].row - 1]) { n[i - 1] = { @@ -1578,9 +1599,10 @@ QUnit.diff = (function() { return function(o, n) { o = o.replace(/\s+$/, ''); n = n.replace(/\s+$/, ''); - var out = diff(o == "" ? [] : o.split(/\s+/), n == "" ? [] : n.split(/\s+/)); + var out = diff(o === "" ? [] : o.split(/\s+/), n === "" ? [] : n.split(/\s+/)); var str = ""; + var i; var oSpace = o.match(/\s+/g); if (oSpace == null) { @@ -1597,8 +1619,8 @@ QUnit.diff = (function() { nSpace.push(" "); } - if (out.n.length == 0) { - for (var i = 0; i < out.o.length; i++) { + if (out.n.length === 0) { + for (i = 0; i < out.o.length; i++) { str += '' + out.o[i] + oSpace[i] + ""; } } @@ -1609,7 +1631,7 @@ QUnit.diff = (function() { } } - for (var i = 0; i < out.n.length; i++) { + for (i = 0; i < out.n.length; i++) { if (out.n[i].text == null) { str += '' + out.n[i] + nSpace[i] + ""; } @@ -1626,7 +1648,12 @@ QUnit.diff = (function() { return str; }; -})(); +}()); + +// for CommonJS enviroments, export everything +if ( typeof exports !== "undefined" || typeof require !== "undefined" ) { + extend(exports, QUnit); +} // get at whatever the global object is, like window in browsers -})( (function() {return this}).call() ); +}( (function() {return this;}.call()) )); diff --git a/tests/unit/tabs/tabs_core.js b/tests/unit/tabs/tabs_core.js index 263032921..21250fb33 100644 --- a/tests/unit/tabs/tabs_core.js +++ b/tests/unit/tabs/tabs_core.js @@ -61,6 +61,7 @@ test( "aria-controls", function() { test( "accessibility", function() { // TODO: add tests + expect( 0 ); }); test( "#3627 - Ajax tab with url containing a fragment identifier fails to load", function() { diff --git a/tests/unit/tooltip/tooltip_core.js b/tests/unit/tooltip/tooltip_core.js index d18b85398..e2569fb01 100644 --- a/tests/unit/tooltip/tooltip_core.js +++ b/tests/unit/tooltip/tooltip_core.js @@ -21,6 +21,7 @@ test( "markup structure", function() { test( "accessibility", function() { // TODO: add tests + expect( 0 ); }); }( jQuery ) ); -- cgit v1.2.3