Skip to content

Commit 8bd58b0

Browse files
committed
test/BasicSetupSpec.js: Replace deprecrated .bind() and .unbind() with .on() and .off() respectively.
* https://api.jquery.com/category/deprecated/deprecated-3.0/
1 parent a905ee9 commit 8bd58b0

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

test/BasicSetupSpec.js

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -18,27 +18,27 @@ describe('uiScroll', function() {
1818
var scrollSettings = { datasource: 'myEmptyDatasource' };
1919

2020
it('should bind to window scroll and resize events and unbind them after the scope is destroyed', function() {
21-
spyOn($.fn, 'bind').and.callThrough();
22-
spyOn($.fn, 'unbind').and.callThrough();
21+
spyOn($.fn, 'on').and.callThrough();
22+
spyOn($.fn, 'off').and.callThrough();
2323
runTest(scrollSettings,
2424
function(viewport) {
25-
expect($.fn.bind.calls.all().length).toBe(3);
26-
expect($.fn.bind.calls.all()[0].args[0]).toBe('mousewheel');
27-
expect($.fn.bind.calls.all()[0].object[0]).toBe(viewport[0]);
28-
expect($.fn.bind.calls.all()[1].args[0]).toBe('resize');
29-
expect($.fn.bind.calls.all()[1].object[0]).toBe(viewport[0]);
30-
expect($.fn.bind.calls.all()[2].args[0]).toBe('scroll');
31-
expect($.fn.bind.calls.all()[2].object[0]).toBe(viewport[0]);
25+
expect($.fn.on.calls.all().length).toBe(3);
26+
expect($.fn.on.calls.all()[0].args[0]).toBe('mousewheel');
27+
expect($.fn.on.calls.all()[0].object[0]).toBe(viewport[0]);
28+
expect($.fn.on.calls.all()[1].args[0]).toBe('resize');
29+
expect($.fn.on.calls.all()[1].object[0]).toBe(viewport[0]);
30+
expect($.fn.on.calls.all()[2].args[0]).toBe('scroll');
31+
expect($.fn.on.calls.all()[2].object[0]).toBe(viewport[0]);
3232
}, {
3333
cleanupTest: function(viewport, scope, $timeout) {
3434
$timeout(function() {
35-
expect($.fn.unbind.calls.all().length).toBe(3);
36-
expect($.fn.unbind.calls.all()[0].args[0]).toBe('resize');
37-
expect($.fn.unbind.calls.all()[0].object[0]).toBe(viewport[0]);
38-
expect($.fn.unbind.calls.all()[1].args[0]).toBe('scroll');
39-
expect($.fn.unbind.calls.all()[1].object[0]).toBe(viewport[0]);
40-
expect($.fn.unbind.calls.all()[2].args[0]).toBe('mousewheel');
41-
expect($.fn.unbind.calls.all()[2].object[0]).toBe(viewport[0]);
35+
expect($.fn.off.calls.all().length).toBe(3);
36+
expect($.fn.off.calls.all()[0].args[0]).toBe('resize');
37+
expect($.fn.off.calls.all()[0].object[0]).toBe(viewport[0]);
38+
expect($.fn.off.calls.all()[1].args[0]).toBe('scroll');
39+
expect($.fn.off.calls.all()[1].object[0]).toBe(viewport[0]);
40+
expect($.fn.off.calls.all()[2].args[0]).toBe('mousewheel');
41+
expect($.fn.off.calls.all()[2].object[0]).toBe(viewport[0]);
4242
});
4343
}
4444
}

0 commit comments

Comments
 (0)