OLD | NEW |
---|---|
(Empty) | |
1 <html> | |
2 <head> | |
3 <style> | |
4 #px_based{line-height:16px} | |
5 #em_based{line-height:16px} | |
6 @media screen and (max-width:300px){ | |
7 #px_based{background-color: red; line-height:64px} | |
8 } | |
9 @media screen and (max-width:18.75em){ | |
10 #em_based{background-color: red; line-height:64px} | |
11 } | |
12 </style> | |
13 </head> | |
14 <body> | |
15 <div id="px_based">This is affected by px</div> | |
16 <div id="em_based">This is affected by em</div> | |
17 some text | |
18 <script> | |
19 var globals = { zoomedIn: [false,false], | |
kenneth.r.christiansen
2013/05/31 08:21:21
I prefer that you make methods and use onload. Thi
| |
20 zoomedOut: [false,false], | |
21 counter: 0}, | |
22 interval; | |
23 var checkZoom = function(elem, name, pos, counter){ | |
24 console.log(name + ":" + getComputedStyle(elem).lineHeight); | |
abarth-chromium
2013/05/31 08:11:21
Can we use js-test-pre and js-test-post so we can
| |
25 if(getComputedStyle(elem).lineHeight>"63"){ | |
abarth-chromium
2013/05/31 08:11:21
Why is the 63 in quotes?
Also your test is pretty
| |
26 console.log(name + " style changed " + counter); | |
27 globals.zoomedIn[pos] = true; | |
28 } | |
29 else if(globals.zoomedIn[pos] && !globals.zoomedOut[pos]){ | |
30 console.log(name + " style changed back " + counter); | |
31 globals.zoomedOut[pos] = true; | |
32 } | |
33 else{ | |
34 console.log(name + " style not changed " + counter); | |
35 } | |
36 }; | |
37 if (window.testRunner){ | |
38 testRunner.waitUntilDone(); | |
39 } | |
40 interval = setInterval(function(){ | |
41 if(globals.counter > 20){ | |
42 clearInterval(interval); | |
43 if (window.testRunner) | |
44 testRunner.notifyDone(); | |
45 return; | |
46 } | |
47 | |
48 if(eventSender){ | |
49 if(!globals.zoomedIn[0] && !globals.zoomedIn[1]){ | |
kenneth.r.christiansen
2013/05/31 08:21:21
spaces after if please
| |
50 eventSender.zoomPageIn(); | |
51 globals.counter++; | |
52 } | |
53 else{ | |
54 globals.counter--; | |
55 eventSender.zoomPageOut(); | |
56 if(globals.counter == 0){ | |
57 clearInterval(interval); | |
58 if (window.testRunner) | |
59 testRunner.notifyDone(); | |
60 return; | |
61 } | |
62 } | |
63 } | |
64 | |
65 checkZoom(document.getElementById("px_based"), "px", 0, globals.coun ter); | |
66 checkZoom(document.getElementById("em_based"), "em", 1, globals.coun ter); | |
67 }, 100); | |
68 | |
69 </script> | |
70 </body> | |
71 </html> | |
OLD | NEW |