vendredi 23 janvier 2015

Angularjs unit Testing $parse

I am new to angularjs, I found a angular directive solution for upload files online. How should I think for writing unit test for $parse.



.directive('fileModel', function ($parse) {
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[0]);
});
});
}
};
});

Aucun commentaire:

Enregistrer un commentaire