Files
sdk/tests/html/custom/element_upgrade_test.html
T
Terry Lucas 49558b9c4c Fixed MessageChannel receiveing messages on ports.
Removed pkg browser from tests.

Fixes https://github.com/dart-lang/sdk/issues/26351
Fixes https://github.com/dart-lang/sdk/issues/32631

R=kevmoo@google.com

Change-Id: Ib0ef5f933d38b2f748cca1f82de8bcf01702df4d
Reviewed-on: https://dart-review.googlesource.com/48742
Reviewed-by: Kevin Moore <kevmoo@google.com>
Commit-Queue: Terry Lucas <terry@google.com>
2018-03-30 17:16:15 +00:00

50 lines
1.3 KiB
HTML

<!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>
%TEST_SCRIPTS%
</body>