Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Commit 7ffe524

Browse files
mbenfordmgol
authored andcommitted
test(jqLite): Refactor test for isDefaultPrevent
Refactor the spec for isDefaultPrevent method so it fails if the existing expectations aren't executed.
1 parent 30354c5 commit 7ffe524

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

test/jqLiteSpec.js

+7-1
Original file line numberDiff line numberDiff line change
@@ -1091,15 +1091,21 @@ describe('jqLite', function() {
10911091
});
10921092

10931093
it('should have event.isDefaultPrevented method', function() {
1094-
jqLite(a).on('click', function(e) {
1094+
var element = jqLite(a),
1095+
clickSpy = jasmine.createSpy('clickSpy');
1096+
1097+
clickSpy.andCallFake(function(e) {
10951098
expect(function() {
10961099
expect(e.isDefaultPrevented()).toBe(false);
10971100
e.preventDefault();
10981101
expect(e.isDefaultPrevented()).toBe(true);
10991102
}).not.toThrow();
11001103
});
11011104

1105+
element.on('click', clickSpy);
1106+
11021107
browserTrigger(a, 'click');
1108+
expect(clickSpy).toHaveBeenCalled();
11031109
});
11041110

11051111
it('should stop triggering handlers when stopImmediatePropagation is called', function() {

0 commit comments

Comments
 (0)