Commit f6a503bb authored by Randall Leeds's avatar Randall Leeds

Fix the match tests

parent 22f9dc31
...@@ -169,25 +169,25 @@ describe 'h.directives', -> ...@@ -169,25 +169,25 @@ describe 'h.directives', ->
describe '.match', -> describe '.match', ->
$element = null $element = null
$isolateScope = null
beforeEach -> beforeEach ->
$scope.model = {a: 1, b: 1} $scope.model = {a: 1, b: 1}
$element = $compile('<input name="confirmation" ng-model="model.b" match="model.a" />')($scope) $element = $compile('<input name="confirmation" ng-model="model.b" match="model.a" />')($scope)
$isolateScope = $element.isolateScope()
$scope.$digest() $scope.$digest()
it 'is valid if both properties have the same value', -> it 'is valid if both properties have the same value', ->
controller = $element.controller('ngModel') controller = $element.controller('ngModel')
assert.isFalse(controller.$error.match) 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' $isolateScope.match = 2
# it 'is invalid if the local property differs', -> $isolateScope.$digest()
# $scope.model.b = 2
# $scope.$digest()
# controller = $element.controller('ngModel') controller = $element.controller('ngModel')
# assert.isTrue(controller.$error.match) assert.isTrue(controller.$error.match)
it 'is invalid if the matched property differs', -> it 'is invalid if the matched property differs', ->
$scope.model.a = 2 $scope.model.a = 2
...@@ -198,6 +198,7 @@ describe 'h.directives', -> ...@@ -198,6 +198,7 @@ describe 'h.directives', ->
it 'is invalid if the input itself is changed', -> it 'is invalid if the input itself is changed', ->
$element.val('2').trigger('input').keyup() $element.val('2').trigger('input').keyup()
$scope.$digest()
controller = $element.controller('ngModel') controller = $element.controller('ngModel')
assert.isTrue(controller.$error.match) 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