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

Unified Diff: test/paper_checked_element_behavior_test.dart

Issue 1418513006: update elements and fix some bugs (Closed) Base URL: git@github.com:dart-lang/polymer_elements.git@master
Patch Set: code review updates Created 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « test/paper_checkbox_test.dart ('k') | test/paper_checked_element_behavior_test.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/paper_checked_element_behavior_test.dart
diff --git a/test/paper_checked_element_behavior_test.dart b/test/paper_checked_element_behavior_test.dart
new file mode 100644
index 0000000000000000000000000000000000000000..3684d75ef8c98e80275ae6531a1b1c5de3af1c2f
--- /dev/null
+++ b/test/paper_checked_element_behavior_test.dart
@@ -0,0 +1,84 @@
+// Copyright (c) 2015, 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.
+@TestOn('browser')
+library polymer_elements.test.paper_checked_element_behavior_test;
+
+import 'dart:async';
+import 'package:polymer_elements/iron_a11y_keys_behavior.dart';
+import 'package:polymer_elements/iron_checked_element_behavior.dart';
+import 'package:polymer_elements/iron_button_state.dart';
+import 'package:polymer_elements/iron_control_state.dart';
+import 'package:polymer_elements/iron_form_element_behavior.dart';
+import 'package:polymer_elements/iron_validatable_behavior.dart';
+import 'package:polymer_elements/paper_checked_element_behavior.dart';
+import 'package:polymer_elements/paper_inky_focus_behavior.dart';
+import 'package:polymer_elements/paper_ripple_behavior.dart';
+import 'package:polymer/polymer.dart';
+import 'package:web_components/web_components.dart';
+import 'package:test/test.dart';
+import 'common.dart';
+
+main() async {
+ await initPolymer();
+
+ group('PaperCheckedElementBehavior', () {
+ TestChecked checked;
+
+ setUp(() {
+ checked = fixture('basic');
+ });
+
+ test('element checked when tapped to check', () {
+ tap(checked);
+ expect(checked.checked, isTrue);
+ });
+
+ test('element checked when active', () {
+ checked.active = true;
+ expect(checked.checked, isTrue);
+ });
+
+ test('element not checked when disabled and made active', () {
+ checked.disabled = true;
+ checked.active = true;
+ expect(checked.checked, isFalse);
+ });
+
+ test('element not checked when disabled and tapped', () {
+ checked.disabled = true;
+ tap(checked);
+ expect(checked.checked, isFalse);
+ });
+
+ test('element ripple has checked attribute when element tapped to check',
+ () {
+ tap(checked);
+ expect(checked.hasRipple(), isTrue);
+ expect(checked.getRipple().getAttribute('checked'), isNotNull);
+ });
+
+ test(
+ 'element ripple does not have checked attribute when element tapped to '
+ 'uncheck', () {
+ tap(checked);
+ tap(checked);
+ expect(checked.getRipple().getAttribute('checked'), isNull);
+ });
+ });
+}
+
+@PolymerRegister('test-checked')
+class TestChecked extends PolymerElement
+ with
+ IronA11yKeysBehavior,
+ IronButtonState,
+ IronControlState,
+ PaperRippleBehavior,
+ PaperInkyFocusBehavior,
+ IronFormElementBehavior,
+ IronValidatableBehavior,
+ IronCheckedElementBehavior,
+ PaperCheckedElementBehavior {
+ TestChecked.created() : super.created();
+}
« no previous file with comments | « test/paper_checkbox_test.dart ('k') | test/paper_checked_element_behavior_test.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698