Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(216)

Side by Side Diff: LayoutTests/fast/dom/HTMLImageElement/image-picture-source-dynamic-changes.html

Issue 290203002: <picture>: Update the <img> element when a <source> changes (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: with tests Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698