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

Side by Side Diff: pkg/polymer_expressions/test/globals_test.dart

Issue 814073002: remove polymer expressions from the repo (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years 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:async';
6 import 'dart:html';
7
8 import 'package:observe/observe.dart';
9 import 'package:observe/mirrors_used.dart'; // make test smaller.
10 import 'package:polymer_expressions/polymer_expressions.dart';
11 import 'package:template_binding/template_binding.dart';
12 import 'package:unittest/unittest.dart';
13 import 'package:unittest/html_config.dart';
14
15 main() {
16 useHtmlConfiguration();
17
18 var testDiv;
19 group('enumerate', () {
20 setUp(() {
21 testDiv = new Element.html('''
22 <div id="test">
23 <template bind>
24 <template repeat="{{entry in this | enumerate}}">
25 <div>Item {{ entry.index }} is {{ entry.value }}</div>
26 </template>
27 </template>
28 </div>''');
29 TemplateBindExtension.bootstrap(testDiv);
30 document.body.nodes.add(testDiv);
31 });
32
33 tearDown(() {
34 testDiv.remove();
35 testDiv = null;
36 });
37
38 test('should enumerate item and index', () {
39 templateBind(testDiv.query('template'))
40 ..bindingDelegate = new PolymerExpressions()
41 ..model = toObservable(
42 ['hello', 'from', 'polymer', 'expressions']);
43
44 return new Future(() {
45 expect(testDiv.queryAll('div').map((n) => n.text), [
46 'Item 0 is hello',
47 'Item 1 is from',
48 'Item 2 is polymer',
49 'Item 3 is expressions',
50 ]);
51 });
52 });
53
54 test('should update after changes', () {
55 var model = toObservable(
56 ['hello', 'from', 'polymer', 'expressions', 'a', 'b', 'c']);
57
58 templateBind(testDiv.query('template'))
59 ..bindingDelegate = new PolymerExpressions()
60 ..model = model;
61
62 return new Future(() {
63 expect(testDiv.queryAll('div').map((n) => n.text), [
64 'Item 0 is hello',
65 'Item 1 is from',
66 'Item 2 is polymer',
67 'Item 3 is expressions',
68 'Item 4 is a',
69 'Item 5 is b',
70 'Item 6 is c',
71 ]);
72
73 model.removeAt(1);
74 model[1] = 'world';
75 model[2] = '!';
76 model.insert(5, 'e');
77
78 return new Future(() {
79 expect(testDiv.queryAll('div').map((n) => n.text), [
80 'Item 0 is hello',
81 'Item 1 is world',
82 'Item 2 is !',
83 'Item 3 is a',
84 'Item 4 is b',
85 'Item 5 is e',
86 'Item 6 is c',
87 ]);
88 });
89 });
90 });
91 });
92 }
OLDNEW
« no previous file with comments | « pkg/polymer_expressions/test/eval_test.dart ('k') | pkg/polymer_expressions/test/globals_test.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698