|
1 | 1 | /* |
2 | | - * JavaScript Load Image Test 1.0 |
| 2 | + * JavaScript Load Image Test 1.1 |
3 | 3 | * https://github.com/blueimp/JavaScript-Load-Image |
4 | 4 | * |
5 | 5 | * Copyright 2011, Sebastian Tschan |
|
25 | 25 |
|
26 | 26 | $.module('Loading'); |
27 | 27 |
|
| 28 | + $.test('Return the img element or FileReader object to allow aborting the image load', function () { |
| 29 | + var img = $.loadImage(blob, function () {}); |
| 30 | + $.strictEqual(img && typeof img.onload, 'function'); |
| 31 | + }); |
| 32 | + |
28 | 33 | $.asyncTest('Load image url', function () { |
29 | 34 | $.ok($.loadImage(imageUrl, function (img) { |
30 | 35 | $.start(); |
|
41 | 46 | })); |
42 | 47 | }); |
43 | 48 |
|
44 | | - $.asyncTest('Return image loading error', function () { |
| 49 | + $.asyncTest('Return image loading error to callback', function () { |
45 | 50 | $.ok($.loadImage('404', function (img) { |
46 | 51 | $.start(); |
47 | 52 | $.ok(img instanceof $.Event); |
|
85 | 90 |
|
86 | 91 | $.module('Canvas'); |
87 | 92 |
|
88 | | - $.asyncTest('Return img element if options.canvas is not true', function () { |
| 93 | + $.asyncTest('Return img element to callback if options.canvas is not true', function () { |
89 | 94 | $.ok($.loadImage(blob, function (img) { |
90 | 95 | $.start(); |
91 | 96 | $.ok(!img.getContext); |
92 | 97 | $.strictEqual(img.nodeName.toLowerCase(), 'img'); |
93 | 98 | })); |
94 | 99 | }); |
95 | 100 |
|
96 | | - $.asyncTest('Return canvas element if options.canvas is true', function () { |
| 101 | + $.asyncTest('Return canvas element to callback if options.canvas is true', function () { |
97 | 102 | $.ok($.loadImage(blob, function (img) { |
98 | 103 | $.start(); |
99 | 104 | $.ok(img.getContext); |
100 | 105 | $.strictEqual(img.nodeName.toLowerCase(), 'canvas'); |
101 | 106 | }, {canvas: true})); |
102 | 107 | }); |
103 | 108 |
|
104 | | - $.asyncTest('Return scaled canvas element', function () { |
| 109 | + $.asyncTest('Return scaled canvas element to callback', function () { |
105 | 110 | $.ok($.loadImage(blob, function (img) { |
106 | 111 | $.start(); |
107 | 112 | $.ok(img.getContext); |
|
0 commit comments