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

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

Issue 79353003: [polymer.dart] fix *Changed observers inheriting (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 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
« no previous file with comments | « pkg/polymer/test/event_handlers_test.html ('k') | pkg/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
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 library polymer.test.web.events_test; 5 library polymer.test.web.events_test;
6 6
7 import 'dart:html'; 7 import 'dart:html';
8 import 'package:polymer/polymer.dart'; 8 import 'package:polymer/polymer.dart';
9 import 'package:unittest/html_config.dart'; 9 import 'package:unittest/html_config.dart';
10 import 'package:unittest/unittest.dart'; 10 import 'package:unittest/unittest.dart';
(...skipping 11 matching lines...) Expand all
22 @CustomTag("test-a") 22 @CustomTag("test-a")
23 class TestA extends PolymerElement { 23 class TestA extends PolymerElement {
24 TestA.created() : super.created(); 24 TestA.created() : super.created();
25 25
26 List clicks = []; 26 List clicks = [];
27 void clickHandler() { 27 void clickHandler() {
28 clicks.add('host click on: $localName (id $id)'); 28 clicks.add('host click on: $localName (id $id)');
29 } 29 }
30 } 30 }
31 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
32 main() { 47 main() {
33 initPolymer(); 48 initPolymer();
34 useHtmlConfiguration(); 49 useHtmlConfiguration();
35 50
36 setUp(() => Polymer.onReady); 51 setUp(() => Polymer.onReady);
37 52
38 test('host event', () { 53 test('host event', () {
39 // Note: this test is currently the only event in 54 // Note: this test is currently the only event in
40 // polymer/test/js/events.js at commit #7936ff8 55 // polymer/test/js/events.js at commit #7936ff8
41 var testA = query('#a'); 56 var testA = query('#a');
42 expect(testA.clicks, isEmpty); 57 expect(testA.clicks, isEmpty);
43 testA.click(); 58 testA.click();
44 expect(testA.clicks, ['host click on: test-a (id a)']); 59 expect(testA.clicks, ['host click on: test-a (id a)']);
45 }); 60 });
46 61
47 test('local event', () { 62 test('local event', () {
48 var testB = query('#b'); 63 var testB = query('#b');
49 expect(testB.clicks, isEmpty); 64 expect(testB.clicks, isEmpty);
50 testB.click(); 65 testB.click();
51 expect(testB.clicks, []); 66 expect(testB.clicks, []);
52 var b1 = testB.shadowRoot.query('#b-1'); 67 var b1 = testB.shadowRoot.query('#b-1');
53 b1.click(); 68 b1.click();
54 expect(testB.clicks, []); 69 expect(testB.clicks, []);
55 var b2 = testB.shadowRoot.query('#b-2'); 70 var b2 = testB.shadowRoot.query('#b-2');
56 b2.click(); 71 b2.click();
57 expect(testB.clicks, ['local click under test-b (id b) on b-2']); 72 expect(testB.clicks, ['local click under test-b (id b) on b-2']);
58 }); 73 });
74
75 test('event on superclass', () {
76 var testC = query('#c');
77 expect(testC.clicks, isEmpty);
78 testC.click();
79 expect(testC.clicks, []);
80 var c1 = testC.shadowRoot.query('#c-1');
81 c1.click();
82 expect(testC.clicks, []);
83 var c2 = testC.shadowRoot.query('#c-2');
84 c2.click();
85 expect(testC.clicks, ['local click under test-c (id c) on c-2']);
86 });
59 } 87 }
OLDNEW
« no previous file with comments | « pkg/polymer/test/event_handlers_test.html ('k') | pkg/polymer/test/events_test.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698