From 432ea96a2325a036907645c29d55c6edf36ff071 Mon Sep 17 00:00:00 2001 From: "Brian J. Dowling" Date: Mon, 2 Dec 2013 20:54:29 +0000 Subject: [PATCH 1/5] Fix/enable a couple of unit tests: dialog, tooltip, draggable. I noticed some unit tests were disabled in phantomjs. dialog and draggable depend on a larger viewPort. tooltip just seemed to work, so I reenebaled that as well. Changing the viewportSize depends on a not yet merged feature in gruntjs/grunt-lib-phantomjs#21 --- Gruntfile.js | 7 +++---- tests/unit/dialog/dialog_events.js | 4 ++-- tests/unit/dialog/dialog_options.js | 2 +- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index 60d02efd0d8..992f06e09ab 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -179,10 +179,9 @@ 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 ); + files: expandFiles( "tests/unit/**/*.html" ).filter(function( file ) { + // TODO except for all|index|test, try to include more as we go + return !( /(all|index|test)\.html$/ ).test( file ); }) }, jshint: { diff --git a/tests/unit/dialog/dialog_events.js b/tests/unit/dialog/dialog_events.js index 1384500f68e..8b1ed7b41da 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(); } From 91adb3508dab3f77dfe5c4f1794e0f8e884a30d5 Mon Sep 17 00:00:00 2001 From: "Brian J. Dowling" Date: Mon, 2 Dec 2013 20:59:52 +0000 Subject: [PATCH 2/5] Gruntfile.js config for viewportSize missed from last commit Note, this depends on the new phantomjs/main.js in the not yet merged feature in gruntjs/grunt-lib-phantomjs#21 --- Gruntfile.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Gruntfile.js b/Gruntfile.js index 992f06e09ab..0868c7a7341 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -182,7 +182,12 @@ grunt.initConfig({ files: expandFiles( "tests/unit/**/*.html" ).filter(function( file ) { // TODO except for all|index|test, try to include more as we go return !( /(all|index|test)\.html$/ ).test( file ); - }) + }), + options: { + page : { + viewportSize : { width: 700, height: 500 } + } + } }, jshint: { options: { From f6a5cfe82efc6cdbc5b90d02b3a0698a2de205cf Mon Sep 17 00:00:00 2001 From: "Brian J. Dowling" Date: Fri, 17 Jan 2014 16:32:12 +0000 Subject: [PATCH 3/5] Tests: Fixed a couple of tests that failed due to :focus --- tests/unit/dialog/dialog_events.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/unit/dialog/dialog_events.js b/tests/unit/dialog/dialog_events.js index 8b1ed7b41da..9ac9730ef11 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 }); - equal( $(document.activeElement).closest(".ui-dialog").length, 1, "focus is in dialog" ); + equal( $(document.activeElement ).closest( ".ui-dialog" ).length, 1, "focus is in dialog" ); $(".ui-widget-overlay").simulate("mousedown"); - equal( $(document.activeElement).closest(".ui-dialog").length, 1, "focus is still in dialog" ); + equal( $( document.activeElement ).closest( ".ui-dialog" ).length, 1, "focus is still in dialog" ); element.remove(); }); From 9e151c5a1691f7a8b29b2f088c13b1686f9237b0 Mon Sep 17 00:00:00 2001 From: "Brian J. Dowling" Date: Fri, 17 Jan 2014 17:01:59 +0000 Subject: [PATCH 4/5] Formatting: Fixed tabbing in Gruntfile --- Gruntfile.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index 0868c7a7341..d913c20944b 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -179,15 +179,15 @@ grunt.initConfig({ }) }, qunit: { - files: expandFiles( "tests/unit/**/*.html" ).filter(function( file ) { - // TODO except for all|index|test, try to include more as we go - return !( /(all|index|test)\.html$/ ).test( file ); + files: expandFiles( "tests/unit/**/*.html" ).filter(function( file ) { + // TODO except for all|index|test, try to include more as we go + return !( /(all|index|test)\.html$/ ).test( file ); }), options: { - page : { - viewportSize : { width: 700, height: 500 } - } - } + page: { + viewportSize: { width: 700, height: 500 } + } + } }, jshint: { options: { From 1020e93b57576df29cdd72c0f1e9fc6674c93414 Mon Sep 17 00:00:00 2001 From: "Brian J. Dowling" Date: Sat, 18 Jan 2014 19:27:38 +0000 Subject: [PATCH 5/5] Spacing: after paren --- tests/unit/dialog/dialog_events.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/unit/dialog/dialog_events.js b/tests/unit/dialog/dialog_events.js index 9ac9730ef11..2af9990a898 100644 --- a/tests/unit/dialog/dialog_events.js +++ b/tests/unit/dialog/dialog_events.js @@ -361,7 +361,7 @@ test("ensure dialog keeps focus when clicking modal overlay", function() { var element = $( "
" ).dialog({ modal: true }); - equal( $(document.activeElement ).closest( ".ui-dialog" ).length, 1, "focus is in dialog" ); + equal( $( document.activeElement ).closest( ".ui-dialog" ).length, 1, "focus is in dialog" ); $(".ui-widget-overlay").simulate("mousedown"); equal( $( document.activeElement ).closest( ".ui-dialog" ).length, 1, "focus is still in dialog" ); element.remove();