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

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

Issue 469823002: Roll polymer to 0.3.5 (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: style nit Created 6 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
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.event_binding_release_handler_test;
6
7 import 'dart:async';
8 import 'dart:html';
9 import 'package:polymer/polymer.dart';
10 import 'package:unittest/unittest.dart';
11 import 'package:unittest/html_config.dart';
12 import 'package:template_binding/template_binding.dart';
13
14 @CustomTag('x-foo')
15 class XFoo extends PolymerElement {
16 @PublishedProperty(reflect: true)
17 int count = 1;
18
19 XFoo.created() : super.created();
20
21 increment() { ++count; }
22 }
23
24 main() {
25 // Do not run the test in the zone so the future does not trigger a
26 // dirtyCheck. We want to verify that event bindings trigger dirty checks on
27 // their own.
28 initPolymer();
29
30 useHtmlConfiguration();
31
32 setUp(() => Polymer.onReady);
33
34 test('event handlers can be released', () {
35 XFoo element = querySelector('x-foo');
36 expect(element, isNotNull);
37 ButtonElement button = element.shadowRoot.querySelector('button');
38 expect(button, isNotNull);
39
40 button.click();
41 return new Future(() {}).then((_) {
42 expect(element.shadowRoot.querySelector('p').text, 'Count: 2');
43 // Remove and detach the element so the binding is invalidated.
44 element.remove();
45 element.detached();
46 }).then((_) => new Future(() {})).then((_) {
47 // Clicks should no longer affect the elements count.
48 button.click();
49 // TODO(jakemac): This is flaky so its commented out, (the rest of the
50 // test is not flaky). Figure out how to make this not flaky.
51 // expect(element.count, 2);
52 });
53 });
54 }
OLDNEW
« no previous file with comments | « pkg/polymer/lib/src/js/polymer/polymer.js.map ('k') | pkg/polymer/test/event_binding_release_handler_test.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698