 
       expect($rootScope.source).toHaveBeenCalled()
 
+    # TODO: Should convert this to e2e test
     xit "should focus on autocomplete when click on tag autocomplete", ->
       $rootScope.source = ["test", "test1", "test2"]
       element           = $compile("<mac-tag-autocomplete mac-tag-autocomplete-source='source'></mac-tag-autocomplete>") $rootScope
       $rootScope.$digest()
 
-      element.click()
-
-      textInput = $(".mac-autocomplete", element)
-      expect(textInput.is(":focus")).toBeTruthy()
+      element.triggerHandler "click"
+
+      textInput = element[0].querySelector ".mac-autocomplete"
+      expect(textInput).toBe document.activeElement
 
     it "should model -> view", ->
       element = $compile("<mac-tag-autocomplete mac-tag-autocomplete-model='model'></mac-tag-autocomplete>") $rootScope

      element = $compile("<mac-tag-autocomplete mac-tag-autocomplete-url='url'></mac-tag-autocomplete>") $rootScope
      $rootScope.$digest()

      textInput = $(".mac-autocomplete", element)
      expect(textInput.attr("mac-autocomplete-url")).toBe "url"

    it "should set the source attribute on mac-autocomplete", ->
      $rootScope.source = ["test", "test1", "test2"]
      element = $compile("<mac-tag-autocomplete mac-tag-autocomplete-source='source'></mac-tag-autocomplete>") $rootScope
      $rootScope.$digest()

      textInput = $(".mac-autocomplete", element)
      expect(textInput.attr("mac-autocomplete-source")).toBe "autocompleteSource"

    it "should have the same source function as the parent scope", ->
      $rootScope.source = jasmine.createSpy "source"

  $timeout   = null
  keys       = null

  hasClass = (element, className) ->
    element[0].className.indexOf(className) > -1

  beforeEach module("Mac")
  beforeEach module("template/tag_autocomplete.html")
  beforeEach module("template/autocomplete.html")
