Chromium Code Reviews| Index: LayoutTests/svg/custom/size-follows-container-size.html |
| diff --git a/LayoutTests/svg/custom/size-follows-container-size.html b/LayoutTests/svg/custom/size-follows-container-size.html |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..df32b04879ab0d16e93f62b7045c71bc51fffabb |
| --- /dev/null |
| +++ b/LayoutTests/svg/custom/size-follows-container-size.html |
| @@ -0,0 +1,29 @@ |
| +<!doctype html> |
| +<script src="../../resources/testharness.js"></script> |
| +<script src="../../resources/testharnessreport.js"></script> |
| +<style> |
| + svg { background-color: lightblue } |
| + div { width: 500px; background-color: blue; padding: 1em } |
| +</style> |
| +<div> |
| + <svg viewBox="0 0 100 100"></svg> |
| +</div> |
| +<script> |
| + var dec_test = async_test("Test SVG dimensions after container width has shrunk"); |
| + var inc_test = async_test("Test SVG dimensions after container width has grown"); |
| + onload = setTimeout(function() { |
|
pdr.
2014/06/18 17:48:43
Can you use requestAnimationFrame instead of setTi
davve
2014/06/18 19:16:47
Good idea. I haven't accustomed myself with reques
|
| + document.querySelector('div').style.width = "1000px"; |
| + inc_test.step(function() { |
| + assert_equals(document.querySelector('svg').offsetWidth, 1000); |
| + assert_equals(document.querySelector('svg').offsetHeight, 1000); |
| + }); |
| + inc_test.done(); |
| + |
| + document.querySelector('div').style.width = "100px"; |
| + dec_test.step(function() { |
| + assert_equals(document.querySelector('svg').offsetWidth, 100); |
| + assert_equals(document.querySelector('svg').offsetHeight, 100); |
| + }); |
| + dec_test.done(); |
| + }, 0); |
| +</script> |