From 9660b43c01f473da96b76d2d605b9295cefe6f0f Mon Sep 17 00:00:00 2001 From: "Brian J. Dowling" Date: Mon, 2 Dec 2013 20:54:29 +0000 Subject: [PATCH] Tests: Fix andenable a couple of unit tests: dialog, tooltip, draggable Some unit tests were disabled in phantomjs. Dialog and draggable depended on a larger viewPort. Tooltip just worked, that was reenabled as well. Closes gh-1173 --- Gruntfile.js | 10 +++++++--- tests/unit/dialog/dialog_events.js | 4 ++-- tests/unit/dialog/dialog_options.js | 2 +- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index b6a4ca24bdb..f20008d4e8e 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -171,10 +171,14 @@ grunt.initConfig({ }, qunit: { files: expandFiles( "tests/unit/**/*.html" ).filter(function( file ) { - // disabling everything that doesn't (quite) work with PhantomJS for now // TODO except for all|index|test, try to include more as we go - return !( /(all|index|test|dialog|tooltip)\.html$/ ).test( file ); - }) + return !( /(all|index|test)\.html$/ ).test( file ); + }), + options: { + page: { + viewportSize: { width: 700, height: 500 } + } + } }, jshint: { options: { diff --git a/tests/unit/dialog/dialog_events.js b/tests/unit/dialog/dialog_events.js index 1384500f68e..2af9990a898 100644 --- a/tests/unit/dialog/dialog_events.js +++ b/tests/unit/dialog/dialog_events.js @@ -361,9 +361,9 @@ test("ensure dialog keeps focus when clicking modal overlay", function() { var element = $( "
" ).dialog({ modal: true }); - ok( $(":focus").closest(".ui-dialog").length, "focus is in dialog" ); + equal( $( document.activeElement ).closest( ".ui-dialog" ).length, 1, "focus is in dialog" ); $(".ui-widget-overlay").simulate("mousedown"); - ok( $(":focus").closest(".ui-dialog").length, "focus is still in dialog" ); + equal( $( document.activeElement ).closest( ".ui-dialog" ).length, 1, "focus is still in dialog" ); element.remove(); }); diff --git a/tests/unit/dialog/dialog_options.js b/tests/unit/dialog/dialog_options.js index 66aeebde0be..87f3553bedc 100644 --- a/tests/unit/dialog/dialog_options.js +++ b/tests/unit/dialog/dialog_options.js @@ -558,7 +558,7 @@ asyncTest( "#4421 - Focus lost from dialog which uses show-effect", function() { var element = $( "
" ).dialog({ show: "blind", focus: function() { - equal( element.dialog( "widget" ).find( ":focus" ).length, 1, "dialog maintains focus" ); + equal( element.dialog( "widget" ).find( document.activeElement ).length, 1, "dialog maintains focus" ); element.remove(); start(); }