rwlbuis@webkit.org | 1864497 | 2010-06-01 20:06:44 +0000 | [diff] [blame] | 1 | description("Tests whether removing the viewBox attribute propagates to the viewBox DOM values."); |
| 2 | |
| 3 | var svgDoc = document.implementation.createDocument("http://www.w3.org/2000/svg", "svg", null); |
| 4 | var svg = svgDoc.rootElement; |
fmalita@chromium.org | 9e4854c | 2013-03-21 19:14:00 +0000 | [diff] [blame] | 5 | |
rwlbuis@webkit.org | 1864497 | 2010-06-01 20:06:44 +0000 | [diff] [blame] | 6 | svg.setAttribute("viewBox", "20 10 200 100"); |
| 7 | shouldBe("svg.viewBox.baseVal.x", "20"); |
| 8 | shouldBe("svg.viewBox.baseVal.y", "10"); |
| 9 | shouldBe("svg.viewBox.baseVal.width", "200"); |
| 10 | shouldBe("svg.viewBox.baseVal.height", "100"); |
| 11 | svg.removeAttribute("viewBox"); |
| 12 | shouldBe("svg.viewBox.baseVal.x", "0"); |
| 13 | shouldBe("svg.viewBox.baseVal.y", "0"); |
| 14 | shouldBe("svg.viewBox.baseVal.width", "0"); |
| 15 | shouldBe("svg.viewBox.baseVal.height", "0"); |
| 16 | |
fmalita@chromium.org | 9e4854c | 2013-03-21 19:14:00 +0000 | [diff] [blame] | 17 | svg.setAttribute("viewBox", "20 10 200 100"); |
| 18 | shouldBe("svg.viewBox.baseVal.x", "20"); |
| 19 | shouldBe("svg.viewBox.baseVal.y", "10"); |
| 20 | shouldBe("svg.viewBox.baseVal.width", "200"); |
| 21 | shouldBe("svg.viewBox.baseVal.height", "100"); |
| 22 | svg.setAttribute("viewBox", "invalid value"); |
| 23 | shouldBe("svg.viewBox.baseVal.x", "0"); |
| 24 | shouldBe("svg.viewBox.baseVal.y", "0"); |
| 25 | shouldBe("svg.viewBox.baseVal.width", "0"); |
| 26 | shouldBe("svg.viewBox.baseVal.height", "0"); |
| 27 | shouldBe("svg.getAttribute('viewBox')", "'invalid value'"); |
| 28 | |
rwlbuis@webkit.org | 1864497 | 2010-06-01 20:06:44 +0000 | [diff] [blame] | 29 | var successfullyParsed = true; |