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

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

Issue 26592009: Removing Element.createdCallback (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
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 attribute_changed_callback_test; 5 library attribute_changed_callback_test;
6 6
7 import 'dart:html'; 7 import 'dart:html';
8 import 'dart:js' as js; 8 import 'dart:js' as js;
9 import 'package:unittest/html_individual_config.dart'; 9 import 'package:unittest/html_individual_config.dart';
10 import 'package:unittest/unittest.dart'; 10 import 'package:unittest/unittest.dart';
11 import '../utils.dart'; 11 import '../utils.dart';
12 12
13 class A extends HtmlElement { 13 class A extends HtmlElement {
14 static final tag = 'x-a'; 14 static final tag = 'x-a';
15 factory A() => new Element.tag(tag); 15 factory A() => new Element.tag(tag);
16 A.created() : super.created(); 16 A.created() : super.created();
17 17
18 static var attributeChangedInvocations = 0; 18 static var attributeChangedInvocations = 0;
19 19
20 void attributeChanged(name, oldValue, newValue) { 20 void attributeChanged(name, oldValue, newValue) {
21 attributeChangedInvocations++; 21 attributeChangedInvocations++;
22 } 22 }
23 } 23 }
24 24
25 class B extends HtmlElement { 25 class B extends HtmlElement {
26 static final tag = 'x-b'; 26 static final tag = 'x-b';
27 factory B() => new Element.tag(tag); 27 factory B() => new Element.tag(tag);
28 B.created() : super.created(); 28 B.created() : super.created() {
29 invocations.add('created');
30 }
29 31
30 static var invocations = []; 32 static var invocations = [];
31 33
32 void createdCallback() {
33 invocations.add('created');
34 }
35
36 void attributeChanged(name, oldValue, newValue) { 34 void attributeChanged(name, oldValue, newValue) {
37 invocations.add('$name: $oldValue => $newValue'); 35 invocations.add('$name: $oldValue => $newValue');
38 } 36 }
39 } 37 }
40 38
41 // Pump custom events polyfill events. 39 // Pump custom events polyfill events.
42 void customElementsTakeRecords() { 40 void customElementsTakeRecords() {
43 if (js.context.hasProperty('CustomElements')) { 41 if (js.context.hasProperty('CustomElements')) {
44 js.context['CustomElements'].callMethod('takeRecords'); 42 js.context['CustomElements'].callMethod('takeRecords');
45 } 43 }
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 103
106 test('add, change classes', () { 104 test('add, change classes', () {
107 var b = new B(); 105 var b = new B();
108 106
109 B.invocations = []; 107 B.invocations = [];
110 b.classes.toggle('u'); 108 b.classes.toggle('u');
111 expect(B.invocations, ['class: null => u']); 109 expect(B.invocations, ['class: null => u']);
112 }); 110 });
113 }); 111 });
114 } 112 }
OLDNEW
« no previous file with comments | « sdk/lib/html/dartium/html_dartium.dart ('k') | tests/html/custom/constructor_calls_created_synchronously_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698