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

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

Issue 24149003: Port of github.com/polymer/polymer. (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
(Empty)
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
3 // BSD-style license that can be found in the LICENSE file.
4
5 import 'dart:html';
6 import 'package:unittest/unittest.dart';
7 import 'package:unittest/html_config.dart';
8 import 'package:polymer/polymer.dart';
9
10 @CustomTag('my-element')
11 class MyElement extends PolymerElement {
12 @published double volume;
13 @published int factor;
14 @published bool crankIt;
15 @published String msg;
16 @published DateTime time;
17 @published Object json;
18 }
19
20 main() {
21 useHtmlConfiguration();
22
23 test('attributes were deserialized', () {
24 MyElement elem = query('my-element').xtag;
25 final msg = 'property should match attribute.';
26 expect(elem.volume, 11.0, reason: '"volume" should match attribute');
27 expect(elem.factor, 3, reason: '"factor" should match attribute');
28 expect(elem.crankIt, true, reason: '"crankIt" should match attribute');
29 expect(elem.msg, "Yo!", reason: '"msg" should match attribute');
30 expect(elem.time, DateTime.parse('2013-08-08T18:34Z'),
31 reason: '"time" should match attribute');
32 expect(elem.json, {'here': 'is', 'some': 'json', 'x': 123},
33 reason: '"json" should match attribute');
34
35 var text = elem.shadowRoot.text;
36 // Collapse adjacent whitespace like a browser would:
37 text = text.replaceAll('\n', ' ').replaceAll(new RegExp(r'\s+'), ' ');
38
39 expect(text, " Yo! The volume is 33.0 !! The time is "
40 "2013-08-08 18:34:00.000Z and here's some JSON: "
41 "{here: is, some: json, x: 123} ",
42 reason: 'text should match expected HTML template');
43 });
44 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698