aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorFelix Nagel <info@felixnagel.com>2013-06-24 20:28:10 +0200
committerFelix Nagel <info@felixnagel.com>2013-06-24 20:28:10 +0200
commit9992d4626eca1182c9688190ff5642168f2490ec (patch)
tree41bc8629a8c8e3c133bfe4de4fae1da1d6202f90 /tests
parentab72fd16667cf08cadc0bf8b3375622b0d74d81a (diff)
parentfe9f6ca98634dd82c3cdb907d725c42f97afe951 (diff)
downloadjquery-ui-9992d4626eca1182c9688190ff5642168f2490ec.tar.gz
jquery-ui-9992d4626eca1182c9688190ff5642168f2490ec.zip
Merge branch 'master' into selectmenu
Diffstat (limited to 'tests')
-rw-r--r--tests/unit/datepicker/datepicker_test_helpers.js12
-rw-r--r--tests/unit/draggable/draggable_core.js30
-rw-r--r--tests/unit/effects/effects.html2
-rw-r--r--tests/unit/effects/effects_core.js5
-rw-r--r--tests/unit/menu/menu_methods.js13
-rw-r--r--tests/unit/testsuite.js12
6 files changed, 59 insertions, 15 deletions
diff --git a/tests/unit/datepicker/datepicker_test_helpers.js b/tests/unit/datepicker/datepicker_test_helpers.js
index 9cb63c9ec..34b41bbc6 100644
--- a/tests/unit/datepicker/datepicker_test_helpers.js
+++ b/tests/unit/datepicker/datepicker_test_helpers.js
@@ -22,16 +22,6 @@ TestHelpers.datepicker = {
var id = $( "<input>" ).appendTo( "#qunit-fixture" );
return TestHelpers.datepicker.init( id, options );
},
- onFocus: function( element, onFocus ) {
- var fn = function( event ){
- if( !event.originalEvent ) {
- return;
- }
- element.unbind( "focus", fn );
- onFocus();
- };
-
- element.bind( "focus", fn )[ 0 ].focus();
- },
+ onFocus: TestHelpers.onFocus,
PROP_NAME: "datepicker"
}; \ No newline at end of file
diff --git a/tests/unit/draggable/draggable_core.js b/tests/unit/draggable/draggable_core.js
index e2dc2a481..69906b6a7 100644
--- a/tests/unit/draggable/draggable_core.js
+++ b/tests/unit/draggable/draggable_core.js
@@ -185,4 +185,34 @@ test( "#5727: draggable from iframe" , function() {
TestHelpers.draggable.shouldMove( draggable1 );
});
+test( "#8399: A draggable should become the active element after you are finished interacting with it, but not before.", function() {
+ expect( 2 );
+
+ var element = $( "<a href='#'>link</a>" ).appendTo( "#qunit-fixture" ).draggable();
+
+ $( document ).one( "mousemove", function() {
+ notStrictEqual( document.activeElement, element.get( 0 ), "moving a draggable anchor did not make it the active element" );
+ });
+
+ TestHelpers.draggable.move( element, 50, 50 );
+
+ strictEqual( document.activeElement, element.get( 0 ), "finishing moving a draggable anchor made it the active element" );
+});
+
+asyncTest( "#4261: active element should blur when mousing down on a draggable", function() {
+ expect( 2 );
+
+ var textInput = $( "<input>" ).appendTo( "#qunit-fixture" ),
+ element = $( "#draggable1" ).draggable();
+
+ TestHelpers.onFocus( textInput, function() {
+ strictEqual( document.activeElement, textInput.get( 0 ), "ensure that a focussed text input is the active element before mousing down on a draggable" );
+
+ TestHelpers.draggable.move( element, 50, 50 );
+
+ notStrictEqual( document.activeElement, textInput.get( 0 ), "ensure the text input is no longer the active element after mousing down on a draggable" );
+ start();
+ });
+});
+
})( jQuery );
diff --git a/tests/unit/effects/effects.html b/tests/unit/effects/effects.html
index 4538ecb03..f35393b89 100644
--- a/tests/unit/effects/effects.html
+++ b/tests/unit/effects/effects.html
@@ -21,9 +21,11 @@
"ui/jquery.ui.effect-fade.js",
"ui/jquery.ui.effect-fold.js",
"ui/jquery.ui.effect-highlight.js",
+ "ui/jquery.ui.effect-puff.js",
"ui/jquery.ui.effect-pulsate.js",
"ui/jquery.ui.effect-scale.js",
"ui/jquery.ui.effect-shake.js",
+ "ui/jquery.ui.effect-size.js",
"ui/jquery.ui.effect-slide.js",
"ui/jquery.ui.effect-transfer.js"
]
diff --git a/tests/unit/effects/effects_core.js b/tests/unit/effects/effects_core.js
index 11e9d0b45..05db494e6 100644
--- a/tests/unit/effects/effects_core.js
+++ b/tests/unit/effects/effects_core.js
@@ -217,10 +217,7 @@ asyncTest( "animateClass: css and class changes during animation are not lost (#
$.each( $.effects.effect, function( effect ) {
module( "effects." + effect );
- // puff and size are defined inside scale
- if ( effect !== "puff" && effect !== "size" ) {
- TestHelpers.testJshint( "effect-" + effect );
- }
+ TestHelpers.testJshint( "effect-" + effect );
if ( effect === "transfer" ) {
return;
diff --git a/tests/unit/menu/menu_methods.js b/tests/unit/menu/menu_methods.js
index c51d123c2..063fbf0b7 100644
--- a/tests/unit/menu/menu_methods.js
+++ b/tests/unit/menu/menu_methods.js
@@ -69,6 +69,19 @@ test( "refresh submenu", function() {
equal( element.find( "ul:first .ui-menu-item" ).length, 4 );
});
+test( "refresh icons (see #9377)", function() {
+ expect( 3 );
+ var element = $( "#menu1" ).menu();
+ ok( !element.hasClass( "ui-menu-icons") );
+ element.find( "li:first a" ).html( "<span class='ui-icon ui-icon-disk'></span>Save</a>" );
+ element.menu( "refresh" );
+
+ ok( element.hasClass( "ui-menu-icons" ) );
+ element.find( "li:first a" ).html( "Save" );
+ element.menu( "refresh" );
+ ok( !element.hasClass( "ui-menu-icons") );
+});
+
test( "widget", function() {
expect( 2 );
var element = $( "#menu1" ).menu(),
diff --git a/tests/unit/testsuite.js b/tests/unit/testsuite.js
index ddc59ed08..6e840f415 100644
--- a/tests/unit/testsuite.js
+++ b/tests/unit/testsuite.js
@@ -175,6 +175,18 @@ TestHelpers.commonWidgetTests = function( widget, settings ) {
});
};
+TestHelpers.onFocus= function( element, onFocus ) {
+ var fn = function( event ){
+ if( !event.originalEvent ) {
+ return;
+ }
+ element.unbind( "focus", fn );
+ onFocus();
+ };
+
+ element.bind( "focus", fn )[ 0 ].focus();
+};
+
/*
* Taken from https://github.com/jquery/qunit/tree/master/addons/close-enough
*/