Skip to content

Commit

Permalink
Closes #89. Function getSelectedItem works with categories.
Browse files Browse the repository at this point in the history
  • Loading branch information
pawelczak authored and pawelczak committed Oct 1, 2015
1 parent a26b835 commit c3bb353
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions test/core/functions.js
Original file line number Diff line number Diff line change
Expand Up @@ -360,3 +360,45 @@ QUnit.test("getSelectedItem - response - two different easyAutocomplete instance

expect(2);
});


QUnit.test("getSelectedItem should work with categories", function( assert ) {


//given
$("#inputOne").easyAutocomplete({

categories: [{
listLocation: "fruits"
}, {
listLocation: "vegetables"
}],

url: "resources/categories.json",

list: {

onLoadEvent: function() {
//trigger select event
$("#inputOne").next().find("ul li").eq(8).find(" > div").trigger("click");
},

onSelectItemEvent: function() {

assert.equal(8, $("#inputOne").getSelectedItem(), "second fruit selected");

QUnit.start();
}
}
});


//execute
var e = $.Event('keyup');
e.keyCode = 50;
$("#inputOne").val("more").trigger(e);

QUnit.stop();

expect(1);
});

0 comments on commit c3bb353

Please sign in to comment.