aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/desandro/imagesloaded/test/unit/basics.js
blob: 6c502a79372fa366b969694fcdc04eab5c9683b0 (plain) (blame)
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
QUnit.test( 'basics', function( assert ) {

  'use strict';

  var elem = document.querySelector('#basics');
  var images = elem.querySelectorAll('img');
  var done = assert.async( 3 + images.length );

  var imgLoader = new imagesLoaded( elem, function( obj ) {
    assert.ok( true, 'callback function triggered' );
    assert.equal( imgLoader, obj, 'callback argument and instance match' );
    done();
  });
  imgLoader.on( 'done', function() {
    assert.ok( true, 'done event triggered' );
    done();
  });
  imgLoader.on( 'always', function() {
    assert.ok( true, 'always event triggered' );
    done();
  });

  imgLoader.on( 'progress', function( loader, image ) {
    assert.ok( image.isLoaded, 'image is loaded');
    done();
  });

});