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

Side by Side Diff: tests/html/custom_elements_23127_test.dart

Issue 1066303002: Fix order of parameters in intercepted generative constructor body. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 8 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 | « pkg/compiler/lib/src/ssa/builder.dart ('k') | tests/html/custom_elements_23127_test.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
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.
4
5
6 // Regression test for http://dartbug.com/23127
7 // Tests super calls to a custom element upgrade constructor with various
8 // combinations of parameters and type arguments.
9
10 library custom_elements_23127_test;
11 import 'dart:async';
12 import 'dart:html';
13 import 'package:unittest/html_individual_config.dart';
14 import 'package:unittest/unittest.dart';
15 import 'utils.dart';
16
17 abstract class B1 extends HtmlElement {
18 void action();
19
20 B1.created() : super.created() {
21 action();
22 }
23 }
24
25 abstract class B1T<T> extends HtmlElement {
26 void action();
27 var qq = false;
28 B1T.created() : super.created() {
29 action();
30 qq = this is T;
31 }
32 }
33
34 abstract class B2 extends HtmlElement {
35 void action();
36 var qq;
37 B2.created([a = 1, b = 2, c = 3])
38 : qq = callTwice(() => ++a * ++b), // [a] and [b] are boxed.
39 super.created() {
40 action();
41 qq = [qq, a, b, c];
42 }
43 }
44
45 abstract class B2T<T> extends HtmlElement {
46 void action();
47 var qq;
48 B2T.created([a = 1, b = 2, c = 3])
49 : qq = callTwice(() => ++a * ++b),
50 super.created() {
51 action();
52 qq = [this is T, qq, a, b, c];
53 }
54 }
55
56 class C1 extends B1 {
57 int z;
58 C1.created() : super.created();
59 action() => z = 3;
60 }
61
62 class C1T extends B1T {
63 int z;
64 C1T.created() : super.created();
65 action() => z = 3;
66 }
67
68 class C2 extends B2 {
69 int z;
70 C2.created() : super.created(20);
71 action() => z = 3;
72 }
73
74 class C2T extends B2T {
75 int z;
76 C2T.created() : super.created(20);
77 action() => z = 3;
78 }
79
80
81
82 var callTwice;
83
84 main() {
85 useHtmlIndividualConfiguration();
86
87 setUp(() => customElementsReady);
88
89 callTwice = (f) { f(); return f(); };
90
91 group('baseline', () {
92 test('C1', () {
93 document.register('x-c1', C1);
94 C1 e = document.createElement('x-c1');
95 expect(e.z, 3);
96 });
97 });
98
99 group('c1t', () {
100 test('C1T', () {
101 document.register('x-c1t', C1T);
102 C1T e = document.createElement('x-c1t');
103 expect(e.z, 3);
104 expect(e.qq, true);
105 });
106 });
107
108 group('c2', () {
109 test('C2', () {
110 document.register('x-c2', C2);
111 C2 e = document.createElement('x-c2');
112 expect(e.z, 3);
113 expect(e.qq, [88, 22, 4, 3]);
114 });
115 });
116
117 group('c2t', () {
118 test('C2T', () {
119 document.register('x-c2t', C2T);
120 C2T e = document.createElement('x-c2t');
121 expect(e.z, 3);
122 expect(e.qq, [true, 88, 22, 4, 3]);
123 });
124 });
125
126 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/ssa/builder.dart ('k') | tests/html/custom_elements_23127_test.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698