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

Unified Diff: tests/html/custom_elements_test.dart

Issue 22912004: Initial Dartium custom element support (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Mark tests fail until parser fix Created 7 years, 4 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
« no previous file with comments | « no previous file | tests/html/html.status » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/html/custom_elements_test.dart
diff --git a/tests/html/custom_elements_test.dart b/tests/html/custom_elements_test.dart
index 71714b38708761d56505f8205142f85bd25c7dbf..666a0a3ee133b4d508879963df990a4a995fbc52 100644
--- a/tests/html/custom_elements_test.dart
+++ b/tests/html/custom_elements_test.dart
@@ -8,12 +8,17 @@ import '../../pkg/unittest/lib/html_individual_config.dart';
import 'dart:html';
class CustomType extends Element {
+ factory CustomType() => null;
+
bool onCreatedCalled = false;
void onCreated() {
onCreatedCalled = true;
+ customCreatedCount++;
}
}
+int customCreatedCount = 0;
+
class NotAnElement {}
main() {
@@ -95,4 +100,30 @@ main() {
expect(firedOnPost, isTrue);
});
});
+
+ group('innerHtml', () {
+ test('query', () {
+ document.register('x-type8', CustomType);
+ var element = new DivElement();
+ element.innerHtml = '<x-type8></x-type8>';
+ document.body.nodes.add(element);
+ var queried = query('x-type8');
+
+ expect(queried, isNotNull);
+ expect(queried is CustomType, isTrue);
+ expect(queried.onCreatedCalled, isTrue);
+ });
+ });
+
+ group('lifecycle', () {
+ test('onCreated', () {
+ int oldCount = customCreatedCount;
+
+ document.register('x-type9', CustomType);
+ var element = new DivElement();
+ element.innerHtml = '<x-type9></x-type9>';
+ document.body.nodes.add(element);
+ expect(customCreatedCount, oldCount + 1);
+ });
+ });
}
« no previous file with comments | « no previous file | tests/html/html.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698