2 <script src=
"/js-test-resources/js-test.js"></script>
5 document
.body
.innerHTML
+= '<img id="load" src="http://127.0.0.1:8000/resources/slow-image-dimensions.php?name=square100.png&mimeType=image/png&sleep=100">';
7 var img
= window
.document
.getElementById("load");
8 shouldBe('img.currentSrc', '""');
9 shouldBe('img.width', '0');
10 var interval
= setInterval(function() {
12 shouldBe('img.currentSrc', '"http://127.0.0.1:8000/resources/slow-image-dimensions.php?name=square100.png&mimeType=image/png&sleep=100"');
13 shouldBe('img.width', '100');
14 clearInterval(interval
);
15 img
.src
= "http://127.0.0.1:8000/resources/slow-image-dimensions.php?name=square200.png&mimeType=image/png&sleep=100";
16 shouldBe('img.currentSrc', '"http://127.0.0.1:8000/resources/slow-image-dimensions.php?name=square100.png&mimeType=image/png&sleep=100"');
17 shouldBe('img.width', '100');
18 var interval2
= setInterval(function() {
19 if (img
.width
!= 100) {
20 shouldBe('img.currentSrc', '"http://127.0.0.1:8000/resources/slow-image-dimensions.php?name=square200.png&mimeType=image/png&sleep=100"');
21 shouldBe('img.width', '200');
22 clearInterval(interval2
);
23 setTimeout(finishJSTest
, 100);