I am having a huge problem with getting a unit test to work for a custom file directive for angular 1.5.0 and Jasmine 2.4, I have looked at

How to provide mock files to change event of <input type='file'> for unit testing

However this only seems to work for a raw input file field and not a custom directive.

First the directive, pretty straight forward model assignment. I also trigger a outside function on the scope which I make sure is in the unit test and don't get any errors from that. I just for the life of me can't force a change event to happen on the file input.

app.directive('fileModel', fileModel); fileModel.$inject = ['$parse', '$log']; function fileModel ($parse, $log) { return { restrict: 'A', link: function(scope, element, attrs) { var model = $parse(attrs.fileModel); var modelSetter = model.assign; element.bind('change', function(){ scope.$apply(function(){ modelSetter(scope, element[0].files); scope.parseFolder(scope.myFolder); }); }); } }; }

Here is the unit test, right now I am trying to trigger and event via a button because I couldn't get a manual event trigger to happen but that isn't working either.