| Index: LayoutTests/dart/WindowAttrs.html
|
| diff --git a/LayoutTests/dart/WindowAttrs.html b/LayoutTests/dart/WindowAttrs.html
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..ee356bd1c417f48728be2067f8efd18fa68ff15c
|
| --- /dev/null
|
| +++ b/LayoutTests/dart/WindowAttrs.html
|
| @@ -0,0 +1,52 @@
|
| +<html>
|
| +<body>
|
| +
|
| +<div id='foo'></div>
|
| +
|
| +<script type="application/dart">
|
| +import 'dart:html';
|
| +
|
| +void main() {
|
| + log("window.document is Document: ${document is Document}");
|
| + // FIXME: move into separate HTMLDocument test.
|
| + Element foo = document.query('#foo');
|
| + log("window.document.query('#foo') is DivElement: ${foo is DivElement}");
|
| + Element missing = document.query('#missing_id');
|
| + log("window.document.query('#missing_id'): $missing");
|
| + bool closed = window.closed;
|
| + log("window.closed: $closed");
|
| + window.name = "WindowAttr";
|
| + String name = window.name;
|
| + log("window.name: '$name'");
|
| + mustThrow("window.name = 239", () { window.name = 239; });
|
| + // Note: later we may rethink it and treat null as allowed value.
|
| + mustThrow("window.name = null", () { window.name = null; });
|
| + mustThrow("window.onload = 239", () { window.onload = 239; });
|
| + log("PASS");
|
| +}
|
| +
|
| +void mustThrow(String snippet, void code()) {
|
| + // FIXME: re-enable when we don't immediately output exceptions into stdout.
|
| + return;
|
| + try {
|
| + code();
|
| + log("FAILED: $snippet should have thrown");
|
| + } catch(e) {
|
| + log("$snippet threw $e");
|
| + }
|
| +}
|
| +
|
| +void log(String msg) {
|
| + Element element = new Element.tag('div');
|
| + element.innerHtml = msg;
|
| + document.body.nodes.add(element);
|
| +}
|
| +</script>
|
| +
|
| +<script>
|
| + if (window.testRunner)
|
| + window.testRunner.dumpAsText();
|
| +</script>
|
| +
|
| +</body>
|
| +</html>
|
|
|