How to test that an angular.element was called? [duplicate]

This question already has an answer here:

I have a simple function that triggers a click on an element in the DOM. I have to do it this way because the element in the DOM is an input of type file so there’s really no other way to programmatically call it. Here’s what the code is like:

this.openFile = function() {
  angular.element('#file-button').trigger('click');
}

And in the DOM I have:

 <input type="file" id="file-button" />

How do I write a unit test that makes sure I call the angular.element when openFile() is invoked?

Source: AngularJS