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

Side by Side Diff: packages/polymer/test/events_test.dart

Issue 2312183003: Removed Polymer from Observatory deps (Closed)
Patch Set: Created 4 years, 3 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
« no previous file with comments | « packages/polymer/test/event_path_test.html ('k') | packages/polymer/test/events_test.html » ('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 // 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 library polymer.test.web.events_test;
6
7 import 'dart:html';
8 import 'package:polymer/polymer.dart';
9 import 'package:unittest/html_config.dart';
10 import 'package:unittest/unittest.dart';
11
12 @CustomTag("test-b")
13 class TestB extends PolymerElement {
14 TestB.created() : super.created();
15
16 List clicks = [];
17 void clickHandler(event, detail, target) {
18 clicks.add('local click under $localName (id $id) on ${target.id}');
19 }
20 }
21
22 @CustomTag("test-a")
23 class TestA extends PolymerElement {
24 TestA.created() : super.created();
25
26 List clicks = [];
27 void clickHandler() {
28 clicks.add('host click on: $localName (id $id)');
29 }
30 }
31
32 @reflectable
33 class TestBase extends PolymerElement {
34 TestBase.created() : super.created();
35
36 List clicks = [];
37 void clickHandler(e) {
38 clicks.add('local click under $localName (id $id) on ${e.target.id}');
39 }
40 }
41
42 @CustomTag("test-c")
43 class TestC extends TestBase {
44 TestC.created() : super.created();
45 }
46
47 main() => initPolymer().then((zone) => zone.run(() {
48 useHtmlConfiguration();
49
50 setUp(() => Polymer.onReady);
51
52 test('host event', () {
53 // Note: this test is currently the only event in
54 // polymer/test/js/events.js at commit #7936ff8
55 var testA = querySelector('#a');
56 expect(testA.clicks, isEmpty);
57 testA.click();
58 expect(testA.clicks, ['host click on: test-a (id a)']);
59 });
60
61 test('local event', () {
62 var testB = querySelector('#b');
63 expect(testB.clicks, isEmpty);
64 testB.click();
65 expect(testB.clicks, []);
66 var b1 = testB.shadowRoot.querySelector('#b-1');
67 b1.click();
68 expect(testB.clicks, []);
69 var b2 = testB.shadowRoot.querySelector('#b-2');
70 b2.click();
71 expect(testB.clicks, ['local click under test-b (id b) on b-2']);
72 });
73
74 test('event on superclass', () {
75 var testC = querySelector('#c');
76 expect(testC.clicks, isEmpty);
77 testC.click();
78 expect(testC.clicks, []);
79 var c1 = testC.shadowRoot.querySelector('#c-1');
80 c1.click();
81 expect(testC.clicks, []);
82 var c2 = testC.shadowRoot.querySelector('#c-2');
83 c2.click();
84 expect(testC.clicks, ['local click under test-c (id c) on c-2']);
85 });
86 }));
OLDNEW
« no previous file with comments | « packages/polymer/test/event_path_test.html ('k') | packages/polymer/test/events_test.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698