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

Side by Side Diff: pkg/polymer/test/data/unit/events_test.html

Issue 23224003: move polymer.dart into dart svn (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: add --deploy to todomvc sample Created 7 years, 4 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/polymer/test/data/unit/event_path_test.html ('k') | pkg/polymer/test/paths_test.dart » ('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 <!doctype html>
2 <!--
3 Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
4 for details. All rights reserved. Use of this source code is governed by a
5 BSD-style license that can be found in the LICENSE file.
6 -->
7 <html>
8 <head>
9 <title>event path</title>
10 <script src="packages/polymer/testing/testing.js"></script>
11 <script src="packages/unittest/test_controller.js"></script>
12 <!--
13 Test ported from:
14 https://github.com/Polymer/polymer/blob/7936ff8/test/js/events.js
15
16 TODO(sigmund): when we have support for mutation observers, render all of
17 the test in Dart (like events.js does in JS)
18 -->
19 </head>
20 <body>
21
22 <polymer-element name="test-a" on-click="clickHandler">
23 <template></template>
24 <script type="application/dart">
25 import 'package:polymer/polymer.dart';
26
27 @CustomTag("test-a")
28 class TestA extends PolymerElement {
29 List clicks = [];
30 void clickHandler() {
31 clicks.add('host click on: $localName (id $id)');
32 }
33 }
34 </script>
35 </polymer-element>
36
37 <polymer-element name="test-b">
38 <template>
39 <div>
40 <span id="b-1">1</span>
41 <span id="b-2" on-click="clickHandler">2</span>
42 </div>
43 </template>
44 <script type="application/dart">
45 import 'package:polymer/polymer.dart';
46
47 @CustomTag("test-b")
48 class TestB extends PolymerElement {
49 List clicks = [];
50 void clickHandler(event, detail, target) {
51 clicks.add('local click under $localName (id $id) on ${target.id}');
52 }
53 }
54 </script>
55 </polymer-element>
56
57 <test-a id="a"></test-a>
58 <test-b id="b"></test-b>
59
60 <script type="application/dart">
61 import 'dart:html';
62 import 'dart:async';
63 import 'package:unittest/unittest.dart';
64 import 'package:unittest/html_config.dart';
65
66 main() {
67 useHtmlConfiguration();
68
69 test('host event', () {
70 // Note: this test is currently the only event in
71 // polymer/test/js/events.js at commit #7936ff8
72 Timer.run(expectAsync0(() {
73 var testA = query('#a');
74 expect(testA.xtag.clicks, isEmpty);
75 testA.click();
76 expect(testA.xtag.clicks, ['host click on: test-a (id a)']);
77 }));
78 });
79
80 test('local event', () {
81 Timer.run(expectAsync0(() {
82 var testB = query('#b');
83 expect(testB.xtag.clicks, isEmpty);
84 testB.click();
85 expect(testB.xtag.clicks, []);
86 var b1 = testB.shadowRoot.query('#b-1');
87 b1.click();
88 expect(testB.xtag.clicks, []);
89 var b2 = testB.shadowRoot.query('#b-2');
90 b2.click();
91 expect(testB.xtag.clicks, ['local click under test-b (id b) on b-2']);
92 }));
93 });
94 }
95 </script>
96 </body>
97 </html>
OLDNEW
« no previous file with comments | « pkg/polymer/test/data/unit/event_path_test.html ('k') | pkg/polymer/test/paths_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698