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

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

Issue 25719003: Fixing Node.clone not returning upgraded custom elements. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 2 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
« no previous file with comments | « no previous file | tools/dom/idl/dart/dart.idl » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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';
11 11
12 class A extends HtmlElement { 12 class A extends HtmlElement {
13 static final tag = 'x-a'; 13 static final tag = 'x-a';
14 factory A() => new Element.tag(tag); 14 factory A() => new Element.tag(tag);
15 A.created() : super.created(); 15 A.created() : super.created();
16 16
17 static int ncallbacks = 0; 17 static int ncallbacks = 0;
18 18
19 void createdCallback() { 19 void createdCallback() {
20 ncallbacks++; 20 ncallbacks++;
21 } 21 }
22 } 22 }
23 23
24 main() { 24 main() {
25 useHtmlConfiguration(); 25 useHtmlConfiguration();
26 26
27 // Adapted from Blink's 27 // Adapted from Blink's
28 // fast/dom/custom/constructor-calls-created-synchronously test. 28 // fast/dom/custom/constructor-calls-created-synchronously test.
29 29
30 setUp(loadPolyfills); 30 var registered = false;
31 setUp(() {
32 return loadPolyfills().then((_) {
33 if (!registered) {
34 registered = true;
35 document.register(A.tag, A);
36 }
37 });
38 });
31 39
32 test('createdCallback', () { 40 test('createdCallback', () {
33 document.register(A.tag, A);
34 var x = new A(); 41 var x = new A();
35 expect(A.ncallbacks, 1); 42 expect(A.ncallbacks, 1);
36 }); 43 });
44
45 test('clone node', () {
46 A.ncallbacks = 0;
47
48 var a = new A();
49 expect(A.ncallbacks, 1);
50 var b = a.clone(false);
51 expect(A.ncallbacks, 2);
52 expect(b is A, isTrue);
53 });
37 } 54 }
OLDNEW
« no previous file with comments | « no previous file | tools/dom/idl/dart/dart.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698