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

Side by Side Diff: pkg/polymer/test/instance_attrs_test.dart

Issue 27518006: Practically remove boot.js, adds the initialization from the Dart side of (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 import 'dart:html'; 5 import 'dart:html';
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 'package:polymer/polymer.dart'; 8 import 'package:polymer/polymer.dart';
9 9
10 // Note: we use @CustomTag to make this type reflectable. 10 // Note: we use @CustomTag to make this type reflectable.
11 @CustomTag('my-element') 11 @CustomTag('my-element')
12 class MyElement extends PolymerElement { 12 class MyElement extends PolymerElement {
13 MyElement.created() : super.created(); 13 MyElement.created() : super.created();
14
15 // Added so that [attributes] can be read via mirrors in polymer expressions.
16 // TODO(sigmund): remove this?
Jennifer Messerly 2013/10/17 02:04:35 Funny, I almost added this line. I wonder why this
Siggi Cherem (dart-lang) 2013/10/17 02:37:40 :-) - removed TODO. Yeah I'm not sure why it was f
17 get attributes => super.attributes;
14 } 18 }
15 19
16 main() { 20 @initMethod _main() {
17 useHtmlConfiguration(); 21 useHtmlConfiguration();
18 22
19 test('attributes were deserialized', () { 23 test('attributes were deserialized', () {
20 var elem = query('my-element'); 24 var elem = query('my-element');
21 25
22 expect(elem.attributes, {'foo': '123', 'bar': 'hi', 'baz': 'world'}, 26 expect(elem.attributes, {'foo': '123', 'bar': 'hi', 'baz': 'world'},
23 reason: 'attributes should be copied to instance'); 27 reason: 'attributes should be copied to instance');
24 28
25 var text = elem.shadowRoot.text; 29 var text = elem.shadowRoot.text;
26 // Collapse adjacent whitespace like a browser would: 30 // Collapse adjacent whitespace like a browser would:
27 text = text.replaceAll('\n', ' ').replaceAll(new RegExp(r'\s+'), ' '); 31 text = text.replaceAll('\n', ' ').replaceAll(new RegExp(r'\s+'), ' ');
28 32
29 expect(text, " foo: 123 bar: hi baz: world ", 33 expect(text, " foo: 123 bar: hi baz: world ",
30 reason: 'text should match expected HTML template'); 34 reason: 'text should match expected HTML template');
31 }); 35 });
32 } 36 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698