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

Unified 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 side-by-side diff with in-line comments
Download patch
« 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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/polymer/test/data/unit/events_test.html
diff --git a/pkg/polymer/test/data/unit/events_test.html b/pkg/polymer/test/data/unit/events_test.html
new file mode 100644
index 0000000000000000000000000000000000000000..cbf33d145180f6a5f9b8c9d94b31fd3b5c6d4721
--- /dev/null
+++ b/pkg/polymer/test/data/unit/events_test.html
@@ -0,0 +1,97 @@
+<!doctype html>
+<!--
+ Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
+ for details. All rights reserved. Use of this source code is governed by a
+ BSD-style license that can be found in the LICENSE file.
+-->
+<html>
+ <head>
+ <title>event path</title>
+ <script src="packages/polymer/testing/testing.js"></script>
+ <script src="packages/unittest/test_controller.js"></script>
+ <!--
+ Test ported from:
+ https://github.com/Polymer/polymer/blob/7936ff8/test/js/events.js
+
+ TODO(sigmund): when we have support for mutation observers, render all of
+ the test in Dart (like events.js does in JS)
+ -->
+ </head>
+ <body>
+
+ <polymer-element name="test-a" on-click="clickHandler">
+ <template></template>
+ <script type="application/dart">
+ import 'package:polymer/polymer.dart';
+
+ @CustomTag("test-a")
+ class TestA extends PolymerElement {
+ List clicks = [];
+ void clickHandler() {
+ clicks.add('host click on: $localName (id $id)');
+ }
+ }
+ </script>
+ </polymer-element>
+
+ <polymer-element name="test-b">
+ <template>
+ <div>
+ <span id="b-1">1</span>
+ <span id="b-2" on-click="clickHandler">2</span>
+ </div>
+ </template>
+ <script type="application/dart">
+ import 'package:polymer/polymer.dart';
+
+ @CustomTag("test-b")
+ class TestB extends PolymerElement {
+ List clicks = [];
+ void clickHandler(event, detail, target) {
+ clicks.add('local click under $localName (id $id) on ${target.id}');
+ }
+ }
+ </script>
+ </polymer-element>
+
+ <test-a id="a"></test-a>
+ <test-b id="b"></test-b>
+
+ <script type="application/dart">
+ import 'dart:html';
+ import 'dart:async';
+ import 'package:unittest/unittest.dart';
+ import 'package:unittest/html_config.dart';
+
+ main() {
+ useHtmlConfiguration();
+
+ test('host event', () {
+ // Note: this test is currently the only event in
+ // polymer/test/js/events.js at commit #7936ff8
+ Timer.run(expectAsync0(() {
+ var testA = query('#a');
+ expect(testA.xtag.clicks, isEmpty);
+ testA.click();
+ expect(testA.xtag.clicks, ['host click on: test-a (id a)']);
+ }));
+ });
+
+ test('local event', () {
+ Timer.run(expectAsync0(() {
+ var testB = query('#b');
+ expect(testB.xtag.clicks, isEmpty);
+ testB.click();
+ expect(testB.xtag.clicks, []);
+ var b1 = testB.shadowRoot.query('#b-1');
+ b1.click();
+ expect(testB.xtag.clicks, []);
+ var b2 = testB.shadowRoot.query('#b-2');
+ b2.click();
+ expect(testB.xtag.clicks, ['local click under test-b (id b) on b-2']);
+ }));
+ });
+ }
+ </script>
+ </body>
+</html>
« 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