Created
April 24, 2017 10:47
-
-
Save hawx/6a3b30a7394051969de12df48ca31dba to your computer and use it in GitHub Desktop.
Testing checkbox in Angular...
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
it('test', () => { | |
const element = ` | |
<section> | |
<label> | |
<input type="checkbox" name="test" ng-model="$ctrl.value" /> | |
ok | |
</label> | |
<div ng-if="$ctrl.value">what</div> | |
</section> | |
`; | |
let compiled = $compile(element)($scope); | |
$scope.$digest(); | |
compiled.find('input').trigger('click'); | |
$scope.$digest(); | |
assert.equal(compiled.find('div').text(), 'what'); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment