Commit f6a503bb authored by Randall Leeds's avatar Randall Leeds

Fix the match tests

parent 22f9dc31
......@@ -169,25 +169,25 @@ describe 'h.directives', ->
describe '.match', ->
$element = null
$isolateScope = null
beforeEach ->
$scope.model = {a: 1, b: 1}
$element = $compile('<input name="confirmation" ng-model="model.b" match="model.a" />')($scope)
$isolateScope = $element.isolateScope()
$scope.$digest()
it 'is valid if both properties have the same value', ->
controller = $element.controller('ngModel')
assert.isFalse(controller.$error.match)
# TODO: Work out how to watch for changes to the model.
it 'is invalid if the local property differs'
# it 'is invalid if the local property differs', ->
# $scope.model.b = 2
# $scope.$digest()
it 'is invalid if the local property differs', ->
$isolateScope.match = 2
$isolateScope.$digest()
# controller = $element.controller('ngModel')
# assert.isTrue(controller.$error.match)
controller = $element.controller('ngModel')
assert.isTrue(controller.$error.match)
it 'is invalid if the matched property differs', ->
$scope.model.a = 2
......@@ -198,6 +198,7 @@ describe 'h.directives', ->
it 'is invalid if the input itself is changed', ->
$element.val('2').trigger('input').keyup()
$scope.$digest()
controller = $element.controller('ngModel')
assert.isTrue(controller.$error.match)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment