Created
April 1, 2016 18:08
-
-
Save degamer106/2de374647d8e57424a7a4dc3636853ea to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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