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

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

Issue 27307004: Converting Polymer's WebComponentsLoaded to an onReady future (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
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 'dart:async'; 8 import 'package:polymer/polymer.dart';
9 import 'package:unittest/html_config.dart';
9 import 'package:unittest/unittest.dart'; 10 import 'package:unittest/unittest.dart';
10 import 'package:unittest/html_config.dart';
11 11
12 main() { 12 main() {
13 useHtmlConfiguration(); 13 useHtmlConfiguration();
14 14
15 setUp(() => Polymer.onReady);
16
15 test('host event', () { 17 test('host event', () {
16 // Note: this test is currently the only event in 18 // Note: this test is currently the only event in
17 // polymer/test/js/events.js at commit #7936ff8 19 // polymer/test/js/events.js at commit #7936ff8
18 Timer.run(expectAsync0(() { 20 var testA = query('#a');
19 var testA = query('#a'); 21 expect(testA.xtag.clicks, isEmpty);
20 expect(testA.xtag.clicks, isEmpty); 22 testA.click();
21 testA.click(); 23 expect(testA.xtag.clicks, ['host click on: test-a (id a)']);
22 expect(testA.xtag.clicks, ['host click on: test-a (id a)']);
23 }));
24 }); 24 });
25 25
26 test('local event', () { 26 test('local event', () {
27 Timer.run(expectAsync0(() { 27 var testB = query('#b');
28 var testB = query('#b'); 28 expect(testB.xtag.clicks, isEmpty);
29 expect(testB.xtag.clicks, isEmpty); 29 testB.click();
30 testB.click(); 30 expect(testB.xtag.clicks, []);
31 expect(testB.xtag.clicks, []); 31 var b1 = testB.shadowRoot.query('#b-1');
32 var b1 = testB.shadowRoot.query('#b-1'); 32 b1.click();
33 b1.click(); 33 expect(testB.xtag.clicks, []);
34 expect(testB.xtag.clicks, []); 34 var b2 = testB.shadowRoot.query('#b-2');
35 var b2 = testB.shadowRoot.query('#b-2'); 35 b2.click();
36 b2.click(); 36 expect(testB.xtag.clicks, ['local click under test-b (id b) on b-2']);
37 expect(testB.xtag.clicks, ['local click under test-b (id b) on b-2']);
38 }));
39 }); 37 });
40 } 38 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698