aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJörn Zaefferer <joern.zaefferer@gmail.com>2012-11-17 18:04:10 +0100
committerJörn Zaefferer <joern.zaefferer@gmail.com>2012-11-26 10:28:25 +0100
commitf3525afe0ec8d6599e2c54571b005b4c3d754352 (patch)
treed36d769d10c5eca996799680e5fd304a50440384
parent73533d9bbc85ef14698668c3305359aa5522e07d (diff)
downloadjquery-ui-f3525afe0ec8d6599e2c54571b005b4c3d754352.tar.gz
jquery-ui-f3525afe0ec8d6599e2c54571b005b4c3d754352.zip
Dialog: Update focus-tabbable test with a timer workaround to get IE8 to pass.
-rw-r--r--tests/unit/dialog/dialog_core.js52
1 files changed, 27 insertions, 25 deletions
diff --git a/tests/unit/dialog/dialog_core.js b/tests/unit/dialog/dialog_core.js
index b5566255c..404e81770 100644
--- a/tests/unit/dialog/dialog_core.js
+++ b/tests/unit/dialog/dialog_core.js
@@ -48,34 +48,36 @@ test( "focus tabbable", function() {
}]
};
- // 1. first element inside the dialog matching [autofocus]
el = $( "<div><input><input autofocus></div>" ).dialog( options );
- equal( document.activeElement, el.find( "input" )[ 1 ] );
+ equal( document.activeElement, el.find( "input" )[ 1 ], "1. first element inside the dialog matching [autofocus]" );
el.remove();
- // 2. tabbable element inside the content element
- el = $( "<div><input><input></div>" ).dialog( options );
- equal( document.activeElement, el.find( "input" )[ 0 ] );
- el.remove();
-
- // 3. tabbable element inside the buttonpane
- el = $( "<div>text</div>" ).dialog( options );
- equal( document.activeElement, el.dialog( "widget" ).find( ".ui-dialog-buttonpane button" )[ 0 ] );
- el.remove();
-
- // 4. the close button
- el = $( "<div>text</div>" ).dialog();
- equal( document.activeElement, el.dialog( "widget" ).find( ".ui-dialog-titlebar .ui-dialog-titlebar-close" )[ 0 ] );
- el.remove();
-
- // 5. the dialog itself
- el = $( "<div>text</div>" ).dialog({
- autoOpen: false
- });
- el.dialog( "widget" ).find( ".ui-dialog-titlebar-close" ).hide();
- el.dialog( "open" );
- equal( document.activeElement, el.parent()[ 0 ] );
- el.remove();
+ // IE8 fails to focus the input, <body> ends up being the activeElement
+ // so wait for that stupid browser
+ stop();
+ setTimeout(function() {
+ el = $( "<div><input><input></div>" ).dialog( options );
+ equal( document.activeElement, el.find( "input" )[ 0 ], "2. tabbable element inside the content element" );
+ el.remove();
+
+ el = $( "<div>text</div>" ).dialog( options );
+ equal( document.activeElement, el.dialog( "widget" ).find( ".ui-dialog-buttonpane button" )[ 0 ], "3. tabbable element inside the buttonpane" );
+ el.remove();
+
+ el = $( "<div>text</div>" ).dialog();
+ equal( document.activeElement, el.dialog( "widget" ).find( ".ui-dialog-titlebar .ui-dialog-titlebar-close" )[ 0 ], "4. the close button" );
+ el.remove();
+
+ el = $( "<div>text</div>" ).dialog({
+ autoOpen: false
+ });
+ el.dialog( "widget" ).find( ".ui-dialog-titlebar-close" ).hide();
+ el.dialog( "open" );
+ equal( document.activeElement, el.parent()[ 0 ], "5. the dialog itself" );
+ el.remove();
+
+ start();
+ }, 13);
});
})(jQuery);