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

Side by Side Diff: tests/html/custom/element_upgrade_test.html

Issue 184033007: Prototype of Dart proxies for JS objects. Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: More tests. Created 6 years, 9 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <meta name="dart.unittest" content="full-stack-traces">
3 <title> element_upgrade_test </title>
4 <style>
5 .unittest-table { font-family:monospace; border:1px; }
6 .unittest-pass { background: #6b3;}
7 .unittest-fail { background: #d55;}
8 .unittest-error { background: #a11;}
9 </style>
10 <script src="/packages/web_components/platform.concat.js"></script>
11 <script src="/packages/web_components/dart_support.js"></script>
12
13 <body>
14 <h1> Running element_upgrade_test </h1>
15
16 <script>
17 var Foo = function() {};
18 Foo.prototype = Object.create(HTMLElement.prototype);
19 Foo.prototype.createdCallback = function() {
20 this.fooCreated = true;
21 this.textContent = 'constructed';
22
23 // Tell the Dart side that this was created.
24 // For testing purposes, for real code this would use a different mechanism.
25 window.upgradeListener(this);
26 };
27
28 Foo.prototype.doSomething = function() {
29 this.textContent = 'didSomething';
30 return 'didSomething';
31 };
32
33 Foo = document.registerElement('x-foo', Foo);
34
35 function validateIsFoo(element) {
36 if (!(element instanceof Foo)) {
37 throw Error('Element is not a Foo');
38 }
39
40 if (!element.fooCreated) {
41 throw Error('Expected fooCreated to be set');
42 }
43 }
44 </script>
45
46 <script type="text/javascript"
47 src="/packages/unittest/test_controller.js"></script>
48 %TEST_SCRIPTS%
49 </body>
OLDNEW
« no previous file with comments | « tests/html/custom/element_upgrade_test.dart ('k') | tools/dom/src/dart2js_CustomElementSupport.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698