-
Notifications
You must be signed in to change notification settings - Fork 151
/
Copy pathcustom-callback-no-return.js
48 lines (41 loc) · 1.1 KB
/
custom-callback-no-return.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
describe('giving a specific callback with no default return', function() {
require('./fixtures/bootstrap.js');
beforeEach(h.clean);
afterEach(h.clean);
var standardSrc = '/test/fixtures/tiny.gif?'+(+new Date());
var hdSrc = '/test/fixtures/tiny.gif?HD&'+(+new Date());
var lazyFunc = 'customCallbackNoReturn';
var called;
var test;
window[lazyFunc] = true;
beforeEach(function() {
window[lazyFunc] = lazyload({
src: function(elt) {
called = true;
}
});
test = h.createTest({
tagName: 'img',
attributes: {
src: standardSrc,
'data-hdSrc': hdSrc,
width: 10,
height: 10,
onload: lazyFunc+'(this)'
}
});
h.insertTest(test);
});
describe('after some scrolling', function() {
beforeEach(h.scroller(0, 50));
beforeEach(h.wait(200));
beforeEach(h.scroller(0, 0));
beforeEach(h.wait(200));
it('custom callback was called', function() {
assert(called === true);
});
it('src was not changed', function() {
assert(test.src.indexOf(standardSrc) !== -1);
});
});
});