Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(173)

Unified Diff: test/codegen/lib/html/custom/element_upgrade_test.html

Issue 1930043002: Add all dart:html tests from the sdk to test/codegen. (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: ptal Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: test/codegen/lib/html/custom/element_upgrade_test.html
diff --git a/test/codegen/lib/html/custom/element_upgrade_test.html b/test/codegen/lib/html/custom/element_upgrade_test.html
new file mode 100644
index 0000000000000000000000000000000000000000..3267d7ff65c30ab4b88cadcd17413d076be311bf
--- /dev/null
+++ b/test/codegen/lib/html/custom/element_upgrade_test.html
@@ -0,0 +1,51 @@
+<!DOCTYPE html>
+<meta name="dart.unittest" content="full-stack-traces">
+<title> element_upgrade_test </title>
+<style>
+ .unittest-table { font-family:monospace; border:1px; }
+ .unittest-pass { background: #6b3;}
+ .unittest-fail { background: #d55;}
+ .unittest-error { background: #a11;}
+</style>
+<script src="/packages/web_components/webcomponents.js"></script>
+<script src="/packages/web_components/dart_support.js"></script>
+
+<body>
+ <h1> Running element_upgrade_test </h1>
+
+<script>
+var Foo = function() {};
+Foo.prototype = Object.create(HTMLElement.prototype);
+Foo.prototype.createdCallback = function() {
+ this.fooCreated = true;
+ this.textContent = 'constructed';
+
+ // Tell the Dart side that this was created.
+ // For testing purposes, for real code this would use a different mechanism.
+ window.upgradeListener(this);
+};
+
+Foo.prototype.doSomething = function() {
+ this.textContent = 'didSomething';
+ return 'didSomething';
+};
+
+Foo = document.registerElement('x-foo', Foo);
+
+function validateIsFoo(element) {
+ if (!(element instanceof Foo)) {
+ throw Error('Element is not a Foo');
+ }
+
+ if (!element.fooCreated) {
+ throw Error('Expected fooCreated to be set');
+ }
+}
+</script>
+
+ <script type="text/javascript"
+ src="/root_dart/tools/testing/dart/test_controller.js"></script>
+ <script type="text/javascript"
+ src="/packages/browser/interop.js"></script>
+ %TEST_SCRIPTS%
+</body>
« no previous file with comments | « test/codegen/lib/html/custom/element_upgrade_test.dart ('k') | test/codegen/lib/html/custom/entered_left_view_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698