aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/unit/autocomplete/autocomplete_core.js86
-rw-r--r--tests/unit/dialog/dialog_options.js13
2 files changed, 95 insertions, 4 deletions
diff --git a/tests/unit/autocomplete/autocomplete_core.js b/tests/unit/autocomplete/autocomplete_core.js
index 3f92aa01f..d98f56abf 100644
--- a/tests/unit/autocomplete/autocomplete_core.js
+++ b/tests/unit/autocomplete/autocomplete_core.js
@@ -80,4 +80,90 @@ test( "allow form submit on enter when menu is not active", function() {
ok( !event.isDefaultPrevented(), "default action is prevented" );
});
+(function() {
+ test( "up arrow invokes search - input", function() {
+ arrowsInvokeSearch( "#autocomplete", true, true );
+ });
+
+ test( "down arrow invokes search - input", function() {
+ arrowsInvokeSearch( "#autocomplete", false, true );
+ });
+
+ test( "up arrow invokes search - textarea", function() {
+ arrowsInvokeSearch( "#autocomplete-textarea", true, false );
+ });
+
+ test( "down arrow invokes search - textarea", function() {
+ arrowsInvokeSearch( "#autocomplete-textarea", false, false );
+ });
+
+ test( "up arrow invokes search - contenteditable", function() {
+ arrowsInvokeSearch( "#autocomplete-contenteditable", true, false );
+ });
+
+ test( "down arrow invokes search - contenteditable", function() {
+ arrowsInvokeSearch( "#autocomplete-contenteditable", false, false );
+ });
+
+ test( "up arrow moves focus - input", function() {
+ arrowsMoveFocus( "#autocomplete", true );
+ });
+
+ test( "down arrow moves focus - input", function() {
+ arrowsMoveFocus( "#autocomplete", false );
+ });
+
+ test( "up arrow moves focus - textarea", function() {
+ arrowsMoveFocus( "#autocomplete-textarea", true );
+ });
+
+ test( "down arrow moves focus - textarea", function() {
+ arrowsMoveFocus( "#autocomplete-textarea", false );
+ });
+
+ test( "up arrow moves focus - contenteditable", function() {
+ arrowsMoveFocus( "#autocomplete-contenteditable", true );
+ });
+
+ test( "down arrow moves focus - contenteditable", function() {
+ arrowsMoveFocus( "#autocomplete-contenteditable", false );
+ });
+
+ function arrowsInvokeSearch( id, isKeyUp, shouldMove ) {
+ expect( 1 );
+
+ var didMove = false,
+ element = $( id ).autocomplete({
+ source: [ "a" ],
+ delay: 0,
+ minLength: 0
+ });
+ element.data( "autocomplete" )._move = function() {
+ didMove = true;
+ };
+ element.simulate( "keydown", { keyCode: ( isKeyUp ? $.ui.keyCode.UP : $.ui.keyCode.DOWN ) } );
+ equal( didMove, shouldMove, "respond to arrow" );
+ }
+
+ function arrowsMoveFocus( id, isKeyUp ) {
+ expect( 1 );
+
+ var didMove = false,
+ element = $( id ).autocomplete({
+ source: [ "a" ],
+ delay: 0,
+ minLength: 0
+ });
+ element.data( "autocomplete" )._move = function() {
+ ok( true, "repsond to arrow" );
+ };
+ element.autocomplete( "search" );
+ element.simulate( "keydown", { keyCode: ( isKeyUp ? $.ui.keyCode.UP : $.ui.keyCode.DOWN ) } );
+ }
+})();
+
+(function() {
+
+})();
+
}( jQuery ) );
diff --git a/tests/unit/dialog/dialog_options.js b/tests/unit/dialog/dialog_options.js
index eab577c69..264c2fb6e 100644
--- a/tests/unit/dialog/dialog_options.js
+++ b/tests/unit/dialog/dialog_options.js
@@ -177,19 +177,24 @@ test("draggable", function() {
});
test("height", function() {
- expect(3);
+ expect(4);
el = $('<div></div>').dialog();
- equals(dlg().height(), 150, "default height");
+ equals(dlg().outerHeight(), 150, "default height");
el.remove();
el = $('<div></div>').dialog({ height: 237 });
- equals(dlg().height(), 237, "explicit height");
+ equals(dlg().outerHeight(), 237, "explicit height");
el.remove();
el = $('<div></div>').dialog();
el.dialog('option', 'height', 238);
- equals(dlg().height(), 238, "explicit height set after init");
+ equals(dlg().outerHeight(), 238, "explicit height set after init");
+ el.remove();
+
+ el = $('<div></div>').css("padding", "20px")
+ .dialog({ height: 240 });
+ equals(dlg().outerHeight(), 240, "explicit height with padding");
el.remove();
});