I created an editing directive to wrap the html input in a fancy frame.
Now I am creating a unit test to verify that as soon as I type in the input, the dirty state of the form controller is set. This is what I got so far, but it fails in the second wait.
What is wrong here?
Thanks in advance!
describe('dirty', function () { it('false', function () { var scope = $rootScope.$new(), form = $compile('<form name="form"><edit ng-model="model"></edit></form>')(scope), input = form.find('input'); scope.$digest(); expect(scope.form.$dirty).toBeFalsy(); input.triggerHandler('keydown', { which: 65 }); expect(scope.form.$dirty).toBeTruthy(); }); });
Edit:
For everything that matters, this applies to this plunker (without jQuery) ... or this one using jQuery
Any idea?
source share