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

Side by Side Diff: test/paper_checkbox_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, 1 month 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
« no previous file with comments | « test/paper_button_test.dart ('k') | test/paper_checked_element_behavior_test.dart » ('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) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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 @TestOn('browser') 4 @TestOn('browser')
5 library polymer_elements.test.paper_checkbox_test; 5 library polymer_elements.test.paper_checkbox_test;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'package:polymer_elements/paper_checkbox.dart'; 8 import 'package:polymer_elements/paper_checkbox.dart';
9 import 'package:polymer_interop/polymer_interop.dart'; 9 import 'package:polymer_interop/polymer_interop.dart';
10 import 'package:web_components/web_components.dart'; 10 import 'package:web_components/web_components.dart';
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 }); 68 });
69 69
70 test('disabled checkbox is always valid', () { 70 test('disabled checkbox is always valid', () {
71 c1.disabled = true; 71 c1.disabled = true;
72 c1.required = true; 72 c1.required = true;
73 expect(c1.validate(null), isTrue); 73 expect(c1.validate(null), isTrue);
74 74
75 c1.checked = true; 75 c1.checked = true;
76 expect(c1.validate(null), isTrue); 76 expect(c1.validate(null), isTrue);
77 }); 77 });
78
79 test('checkbox label can be updated', () {
80 Polymer.dom(c1).text = 'Batman';
81 c1.updateAriaLabel();
82 expect(c1.getAttribute('aria-label'), 'Batman');
83
84 Polymer.dom(c1).text = 'Robin';
85 c1.updateAriaLabel();
86 expect(c1.getAttribute('aria-label'), 'Robin');
87 });
88 }); 78 });
89 79
90 group('a11y', () { 80 group('a11y', () {
91 PaperCheckbox c1; 81 PaperCheckbox c1;
92 PaperCheckbox c2; 82 PaperCheckbox c2;
93 83
94 setUp(() { 84 setUp(() {
95 c1 = fixture('NoLabel'); 85 c1 = fixture('NoLabel');
96 c2 = fixture('WithLabel'); 86 c2 = fixture('WithLabel');
97 }); 87 });
98 88
99 test('has aria role "checkbox"', () { 89 test('has aria role "checkbox"', () {
100 expect(c1.getAttribute('role'), equals('checkbox')); 90 expect(c1.getAttribute('role'), equals('checkbox'));
101 expect(c2.getAttribute('role'), equals('checkbox')); 91 expect(c2.getAttribute('role'), equals('checkbox'));
102 }); 92 });
103 93
104 test('checkbox with no label has no aria label', () { 94 test('checkbox with no label has no aria label', () {
105 expect(c1.getAttribute('aria-label'), isEmpty); 95 expect(c1.getAttribute('aria-label'), isNull);
106 });
107
108 test('checkbox with a label sets an aria label', () {
109 expect(c2.getAttribute('aria-label'), equals("Batman"));
110 }); 96 });
111 97
112 test('checkbox respects the user set aria-label', () { 98 test('checkbox respects the user set aria-label', () {
113 PaperCheckbox c = fixture('AriaLabel'); 99 PaperCheckbox c = fixture('AriaLabel');
114 expect(c.getAttribute('aria-label'), equals("Batman")); 100 expect(c.getAttribute('aria-label'), equals("Batman"));
115 }); 101 });
116 102
117 // TODO(jakemac): Investigate these 103 // TODO(jakemac): Investigate these
118 // a11ySuite('NoLabel'); 104 // a11ySuite('NoLabel');
119 // a11ySuite('WithLabel'); 105 // a11ySuite('WithLabel');
120 // a11ySuite('AriaLabel'); 106 // a11ySuite('AriaLabel');
121 }); 107 });
122 } 108 }
OLDNEW
« no previous file with comments | « test/paper_button_test.dart ('k') | test/paper_checked_element_behavior_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698