OLD | NEW |
---|---|
(Empty) | |
1 <!DOCTYPE html> | |
2 <script src="../../../resources/js-test.js"></script> | |
3 <script src="resources/currentSrcHelper.js"></script> | |
4 | |
5 <picture> | |
6 <source id="src" srcset="../../hidpi/resources/image-set-1x.png?1 1x"> | |
7 <img id="simple" src="resources/blue_rect.jpg?1"> | |
8 </picture> | |
9 | |
10 <script> | |
11 jsTestIsAsync = true; | |
12 | |
13 var iteration = 0; | |
14 | |
15 var simple = document.getElementById('simple'); | |
16 var src = document.getElementById('src'); | |
17 | |
18 simple.addEventListener('load', function() { | |
19 switch (iteration) { | |
20 case 0: | |
21 shouldBe('document.getElementById("simple").clientWidth', '400'); | |
22 shouldBe('currentSrcFileName("simple")', '"image-set-1x.png?1"'); | |
23 | |
24 src.srcset = 'resources/image-set-4x.png 1x'; | |
25 break; | |
26 case 1: | |
27 shouldBe('document.getElementById("simple").clientWidth', '1600'); | |
28 shouldBe('currentSrcFileName("simple")', '"image-set-4x.png"'); | |
29 | |
30 src.parentNode.removeChild(src); | |
31 break; | |
32 case 2: | |
33 shouldBe('document.getElementById("simple").clientWidth', '75'); | |
34 shouldBe('currentSrcFileName("simple")', '"blue_rect.jpg?1"'); | |
35 | |
36 src.srcset = '../../hidpi/resources/image-set-1x.png?2 1x'; | |
37 simple.parentNode.insertBefore(src, simple); | |
38 break; | |
39 case 3: | |
40 shouldBe('document.getElementById("simple").clientWidth', '400'); | |
41 shouldBe('currentSrcFileName("simple")', '"image-set-1x.png?2"'); | |
42 | |
43 | |
44 // When there is a <source>, changing the <src> should have no effec t | |
cbiesinger
2014/05/23 01:35:53
I added this test because the current code has thi
| |
45 simple.src = 'resources/blue_rect.jpg?2'; | |
46 shouldBe('currentSrcFileName("simple")', '"image-set-1x.png?2"'); | |
47 | |
48 finishJSTest(); | |
49 break; | |
50 }; | |
51 ++iteration; | |
52 }, false); | |
53 </script> | |
54 | |
OLD | NEW |