Wed, 31 Dec 2014 13:27:57 +0100
Ignore runtime configuration files generated during quality assurance.
michael@0 | 1 | <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" |
michael@0 | 2 | "http://www.w3.org/TR/html4/strict.dtd"> |
michael@0 | 3 | <html lang="en-US"> |
michael@0 | 4 | <head> |
michael@0 | 5 | <title>Bug 453896 Test middle frame</title> |
michael@0 | 6 | <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> |
michael@0 | 7 | <meta http-equiv="Content-Style-Type" content="text/css"> |
michael@0 | 8 | <script type="application/javascript; version=1.7"> |
michael@0 | 9 | |
michael@0 | 10 | function run(test_window) |
michael@0 | 11 | { |
michael@0 | 12 | var subdoc = document.getElementById("subdoc").contentDocument; |
michael@0 | 13 | var subwin = document.getElementById("subdoc").contentWindow; |
michael@0 | 14 | var style = subdoc.getElementById("style"); |
michael@0 | 15 | var iframe_style = document.getElementById("subdoc").style; |
michael@0 | 16 | var body_cs = subdoc.defaultView.getComputedStyle(subdoc.body, ""); |
michael@0 | 17 | |
michael@0 | 18 | function query_applies(q) { |
michael@0 | 19 | style.setAttribute("media", q); |
michael@0 | 20 | return body_cs.getPropertyValue("text-decoration") == "underline"; |
michael@0 | 21 | } |
michael@0 | 22 | |
michael@0 | 23 | function should_apply(q) { |
michael@0 | 24 | test_window.ok(query_applies(q), q + " should apply"); |
michael@0 | 25 | } |
michael@0 | 26 | |
michael@0 | 27 | function should_not_apply(q) { |
michael@0 | 28 | test_window.ok(!query_applies(q), q + " should not apply"); |
michael@0 | 29 | } |
michael@0 | 30 | |
michael@0 | 31 | // in this test, assume the common underlying implementation is correct |
michael@0 | 32 | let width_val = 157; // pick two not-too-round numbers |
michael@0 | 33 | let height_val = 182; |
michael@0 | 34 | iframe_style.width = width_val + "px"; |
michael@0 | 35 | iframe_style.height = height_val + "px"; |
michael@0 | 36 | for (let [feature, value] in |
michael@0 | 37 | Iterator({ "width": width_val, "height": height_val })) { |
michael@0 | 38 | should_apply("all and (" + feature + ": " + value + "px)"); |
michael@0 | 39 | should_not_apply("all and (" + feature + ": " + (value + 1) + "px)"); |
michael@0 | 40 | should_not_apply("all and (" + feature + ": " + (value - 1) + "px)"); |
michael@0 | 41 | } |
michael@0 | 42 | |
michael@0 | 43 | iframe_style.width = "0"; |
michael@0 | 44 | should_apply("all and (height)"); |
michael@0 | 45 | should_not_apply("all and (width)"); |
michael@0 | 46 | iframe_style.height = "0"; |
michael@0 | 47 | should_not_apply("all and (height)"); |
michael@0 | 48 | should_not_apply("all and (width)"); |
michael@0 | 49 | should_apply("all and (device-height)"); |
michael@0 | 50 | should_apply("all and (device-width)"); |
michael@0 | 51 | iframe_style.width = width_val + "px"; |
michael@0 | 52 | should_not_apply("all and (height)"); |
michael@0 | 53 | should_apply("all and (width)"); |
michael@0 | 54 | iframe_style.height = height_val + "px"; |
michael@0 | 55 | should_apply("all and (height)"); |
michael@0 | 56 | should_apply("all and (width)"); |
michael@0 | 57 | |
michael@0 | 58 | test_window.SimpleTest.finish(); |
michael@0 | 59 | } |
michael@0 | 60 | |
michael@0 | 61 | </script> |
michael@0 | 62 | </head> |
michael@0 | 63 | <body> |
michael@0 | 64 | |
michael@0 | 65 | <iframe id="subdoc" src="media_queries_iframe.html"></iframe> |
michael@0 | 66 | |
michael@0 | 67 | </body> |
michael@0 | 68 | </html> |