Skip to content
This repository has been archived by the owner on May 30, 2022. It is now read-only.

Commit

Permalink
test(macAutocomplete): Added test for mac-autocomplete-source = 'invo…
Browse files Browse the repository at this point in the history
…kedFunction()'.

Closes #142
  • Loading branch information
cjcenizal authored and adrianlee44 committed Jan 22, 2014
1 parent 73f14cd commit 3353618
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions test/unit/autocomplete.spec.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -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("<mac-autocomplete ng-model='test' mac-autocomplete-source='source(\"foo\")' mac-autocomplete-delay='0'></mac-autocomplete>") $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 = [
Expand Down

0 comments on commit 3353618

Please sign in to comment.