Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save degamer106/2de374647d8e57424a7a4dc3636853ea to your computer and use it in GitHub Desktop.
Save degamer106/2de374647d8e57424a7a4dc3636853ea to your computer and use it in GitHub Desktop.
fdescribe('totalHoursValidator', function() {
var $scope, $compile, element, template;
beforeEach(inject(function(_$rootScope_, _$compile_) {
$scope = _$rootScope_.$new();
$compile = _$compile_;
template = '<form name="leaveRequestForm">' +
'<div name="startDate"></div>' +
'<div name="endDate"></div>' +
'<div name="totalHours" ng-model="form.totalHours" total-hours-validator form="form"></div>' +
'</form>';
$scope.form = {
startDate : undefined,
endDate : undefined,
totalHours : 0
};
element = $compile(template)($scope);
$scope.$digest();
}));
describe('greaterThanZero validator', function() {
it('Should return true if scope.form, scope.form.startDate, or scope.form.endDate are undefined', function() {
var modelCtrl = $scope.leaveRequestForm.totalHours;
expect(element.data('$formController')).toBeTruthy();
console.log(modelCtrl.$validators.greaterThanZero());
});
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment