我有输入日期选择器的指令,任何人都可以帮我写这个指令的单元测试用例
angular.module('myApp').directive('myDatepicker', function () {
return {
restrict: 'A',
require: 'ngModel',
link: function (scope, element, attrs, ngModelCtrl) {
element.datepicker({
dateFormat: 'mm/dd/yy',
onSelect: function (date) {
ngModelCtrl.$setViewValue(date);
ngModelCtrl.$render();
scope.$apply();
}
});
}
};
});