Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds test for checking media queries in stylesheets
- Loading branch information
Rohit Burra
committed
Jan 29, 2017
1 parent
b5c94ba
commit c1eb6ae
Showing
4 changed files
with
48 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
[stylesheet_media_queries.html.ini] | ||
type: testharness | ||
expected: FAIL | ||
bug: https://github.com/servo/servo/issues/14719 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<html> | ||
<head> | ||
<style media="(min-width: 400px)"> | ||
h1 { | ||
background: rgb(255, 0, 0); | ||
} | ||
</style> | ||
<style media="(max-width: 399px)"> | ||
h1 { | ||
background: rgb(0, 255, 0); | ||
} | ||
</style> | ||
</head> | ||
<body> | ||
<h1 id="testelement">Header</h1> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<!doctype html> | ||
<meta charset="utf-8"> | ||
<title>CSS Test: Media query correctly forces style invalidation</title> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<iframe id="myframe" src="iframe_for_media_queries.html" height="500" width="500"> | ||
</iframe> | ||
<script> | ||
var test = async_test("Media queries within stylesheets"); | ||
window.onload = test.step_func(function() { | ||
var frame = document.getElementById("myframe"); | ||
var frameDoc = frame.contentWindow.document; | ||
var element = frameDoc.getElementById("testelement"); | ||
assert_equals(frame.contentWindow.getComputedStyle(element).backgroundColor, "rgb(255, 0, 0)"); | ||
frame.width = "300"; | ||
frameDoc.documentElement.offsetWidth; // Force layout | ||
window.requestAnimationFrame(test.step_func_done(function () { | ||
assert_equals(frame.contentWindow.getComputedStyle(element).backgroundColor, "rgb(0, 255, 0)"); | ||
})); | ||
}); | ||
</script> |