Skip to content

Commit c38420b

Browse files
committed
Apply fix across all specs that spy on the $.fn object
1 parent b5c874d commit c38420b

File tree

5 files changed

+30
-0
lines changed

5 files changed

+30
-0
lines changed

test/unit/directives/alertSpec.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,13 @@ describe('alert', function () {
3737
// Tests
3838

3939
it('should correctly call $.fn.alert', function () {
40+
var old = $.fn.alert;
4041
var spy = spyOn($.fn, 'alert').andCallThrough();
42+
for (var key in old) {
43+
if (old.hasOwnProperty(key)) {
44+
spy[key] = old[key];
45+
}
46+
}
4147
var elm = compileDirective();
4248
expect(spy).toHaveBeenCalled();
4349
});

test/unit/directives/datepickerSpec.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,13 @@ describe('datepicker', function () {
3939
});
4040

4141
it('should correctly call $.fn.datepicker', function () {
42+
var old = $.fn.datepicker;
4243
var spy = spyOn($.fn, 'datepicker');
44+
for (var key in old) {
45+
if (old.hasOwnProperty(key)) {
46+
spy[key] = old[key];
47+
}
48+
}
4349
var elm = compileDirective();
4450
expect(spy).toHaveBeenCalled();
4551
});

test/unit/directives/modalSpec.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,13 @@ describe('modal', function () {
6969
});
7070

7171
it('should correctly call $.fn.modal', function () {
72+
var old = $.fn.modal;
7273
var spy = spyOn($.fn, 'modal').andCallThrough();
74+
for (var key in old) {
75+
if (old.hasOwnProperty(key)) {
76+
spy[key] = old[key];
77+
}
78+
}
7379
var elm = compileDirective();
7480
elm.modal('show');
7581
expect(spy).toHaveBeenCalled();

test/unit/directives/timepickerSpec.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,13 @@ describe('timepicker', function () {
3838
});
3939

4040
it('should correctly call $.fn.timepicker', function () {
41+
var old = $.fn.timepicker;
4142
var spy = spyOn($.fn, 'timepicker');
43+
for (var key in old) {
44+
if (old.hasOwnProperty(key)) {
45+
spy[key] = old[key];
46+
}
47+
}
4248
var elm = compileDirective();
4349
expect(spy).toHaveBeenCalled();
4450
});

test/unit/directives/typeaheadSpec.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,13 @@ describe('typeahead', function () {
4949
});
5050

5151
it('should correctly call $.fn.typeahead', function () {
52+
var old = $.fn.typeahead;
5253
var spy = spyOn($.fn, 'typeahead').andCallThrough();
54+
for (var key in old) {
55+
if (old.hasOwnProperty(key)) {
56+
spy[key] = old[key];
57+
}
58+
}
5359
var elm = compileDirective();
5460
expect(spy).toHaveBeenCalled();
5561
});

0 commit comments

Comments
 (0)