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

Side by Side Diff: tests/html/custom/constructor_calls_created_synchronously_test.dart

Issue 268313002: [dart:html] rename register to registerElement per spec (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: rebase Created 6 years, 7 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
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library constructor_calls_created_synchronously_test; 5 library constructor_calls_created_synchronously_test;
6 import 'package:unittest/unittest.dart'; 6 import 'package:unittest/unittest.dart';
7 import 'package:unittest/html_config.dart'; 7 import 'package:unittest/html_config.dart';
8 import 'dart:html'; 8 import 'dart:html';
9 import '../utils.dart'; 9 import '../utils.dart';
10 import 'dart:mirrors'; 10 import 'dart:mirrors';
(...skipping 12 matching lines...) Expand all
23 useHtmlConfiguration(); 23 useHtmlConfiguration();
24 24
25 // Adapted from Blink's 25 // Adapted from Blink's
26 // fast/dom/custom/constructor-calls-created-synchronously test. 26 // fast/dom/custom/constructor-calls-created-synchronously test.
27 27
28 var registered = false; 28 var registered = false;
29 setUp(() { 29 setUp(() {
30 return customElementsReady.then((_) { 30 return customElementsReady.then((_) {
31 if (!registered) { 31 if (!registered) {
32 registered = true; 32 registered = true;
33 document.register(A.tag, A); 33 document.registerElement(A.tag, A);
34 } 34 }
35 }); 35 });
36 }); 36 });
37 37
38 test('createdCallback', () { 38 test('createdCallback', () {
39 var x = new A(); 39 var x = new A();
40 expect(A.ncallbacks, 1); 40 expect(A.ncallbacks, 1);
41 }); 41 });
42 42
43 test('clone node', () { 43 test('clone node', () {
44 A.ncallbacks = 0; 44 A.ncallbacks = 0;
45 45
46 var a = new A(); 46 var a = new A();
47 expect(A.ncallbacks, 1); 47 expect(A.ncallbacks, 1);
48 var b = a.clone(false); 48 var b = a.clone(false);
49 expect(A.ncallbacks, 2); 49 expect(A.ncallbacks, 2);
50 expect(b is A, isTrue); 50 expect(b is A, isTrue);
51 }); 51 });
52 52
53 test("can extend elements that don't have special prototypes", () { 53 test("can extend elements that don't have special prototypes", () {
54 document.register('fancy-section', FancySection, extendsTag: 'section'); 54 document.registerElement('fancy-section', FancySection,
55 extendsTag: 'section');
55 var fancy = document.createElement('section', 'fancy-section'); 56 var fancy = document.createElement('section', 'fancy-section');
56 expect(fancy is FancySection, true, reason: 'fancy-section was registered'); 57 expect(fancy is FancySection, true, reason: 'fancy-section was registered');
57 expect(fancy.wasCreated, true, reason: 'FancySection ctor was called'); 58 expect(fancy.wasCreated, true, reason: 'FancySection ctor was called');
58 }); 59 });
59 } 60 }
60 61
61 class FancySection extends HtmlElement { 62 class FancySection extends HtmlElement {
62 bool wasCreated = false; 63 bool wasCreated = false;
63 FancySection.created() : super.created() { 64 FancySection.created() : super.created() {
64 wasCreated = true; 65 wasCreated = true;
65 } 66 }
66 } 67 }
OLDNEW
« no previous file with comments | « tests/html/custom/attribute_changed_callback_test.dart ('k') | tests/html/custom/created_callback_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698