From 3353618cbafc9152e49fdabdb41644cf946dfb05 Mon Sep 17 00:00:00 2001 From: CJ Cenizal Date: Tue, 21 Jan 2014 20:04:13 -0800 Subject: [PATCH] test(macAutocomplete): Added test for mac-autocomplete-source = 'invokedFunction()'. Closes #142 --- test/unit/autocomplete.spec.coffee | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/test/unit/autocomplete.spec.coffee b/test/unit/autocomplete.spec.coffee index 937a1b5..15f1aac 100644 --- a/test/unit/autocomplete.spec.coffee +++ b/test/unit/autocomplete.spec.coffee @@ -98,6 +98,18 @@ describe "Mac autocomplete", -> expect($(".mac-menu-item").text() == "foo").toBe true + it "should use a callback function returned by an invoked function", -> + $rootScope.source = (val) -> + return (query, callback) -> callback [val] + + element = $compile("") $rootScope + $rootScope.$digest() + + changeInputValue element, "f" + $rootScope.$digest() + + expect($(".mac-menu-item").text() == "foo").toBe true + describe "label", -> it "should use default 'name' label", -> $rootScope.source = [