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

Side by Side Diff: lib/src/paper-dropdown-menu/test/paper-dropdown-menu.html

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 | « lib/src/paper-dropdown-menu/paper-dropdown-menu.html ('k') | lib/src/paper-fab/paper-fab.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 <!doctype html> 1 <!doctype html>
2 <!-- 2 <!--
3 @license 3 @license
4 Copyright (c) 2015 The Polymer Project Authors. All rights reserved. 4 Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
5 This code may only be used under the BSD style license found at http://polymer.g ithub.io/LICENSE.txt 5 This code may only be used under the BSD style license found at http://polymer.g ithub.io/LICENSE.txt
6 The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt 6 The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
7 The complete set of contributors may be found at http://polymer.github.io/CONTRI BUTORS.txt 7 The complete set of contributors may be found at http://polymer.github.io/CONTRI BUTORS.txt
8 Code distributed by Google as part of the polymer project is also 8 Code distributed by Google as part of the polymer project is also
9 subject to an additional IP rights grant found at http://polymer.github.io/PATEN TS.txt 9 subject to an additional IP rights grant found at http://polymer.github.io/PATEN TS.txt
10 --> 10 -->
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 suite('when a value is preselected', function() { 112 suite('when a value is preselected', function() {
113 setup(function() { 113 setup(function() {
114 dropdownMenu = fixture('PreselectedDropdownMenu'); 114 dropdownMenu = fixture('PreselectedDropdownMenu');
115 }); 115 });
116 116
117 test('the input area shows the correct selection', function() { 117 test('the input area shows the correct selection', function() {
118 var secondItem = Polymer.dom(dropdownMenu).querySelectorAll('paper-ite m')[1]; 118 var secondItem = Polymer.dom(dropdownMenu).querySelectorAll('paper-ite m')[1];
119 expect(dropdownMenu.selectedItem).to.be.equal(secondItem); 119 expect(dropdownMenu.selectedItem).to.be.equal(secondItem);
120 }); 120 });
121 }); 121 });
122
123 suite('deselecting', function() {
124 var menu;
125
126 setup(function() {
127 dropdownMenu = fixture('PreselectedDropdownMenu');
128 menu = Polymer.dom(dropdownMenu).querySelector('.dropdown-content');
129 });
130
131 test('an `iron-deselect` event clears the current selection', function() {
132 menu.selected = null;
133 expect(dropdownMenu.selectedItem).to.be.equal(null);
134 });
135 });
136
137 suite('validation', function() {
138 test('a non required dropdown is valid regardless of its selection', fun ction() {
139 var dropdownMenu = fixture('TrivialDropdownMenu');
140 menu = Polymer.dom(dropdownMenu).querySelector('.dropdown-content');
141
142 // no selection.
143 expect(dropdownMenu.validate()).to.be.true;
144 expect(dropdownMenu.invalid).to.be.false;
145 expect(dropdownMenu.value).to.not.be.ok;
146
147 // some selection.
148 menu.selected = 1;
149 expect(dropdownMenu.validate()).to.be.true;
150 expect(dropdownMenu.invalid).to.be.false;
151 expect(dropdownMenu.value).to.be.equal('Bar');
152 });
153
154 test('a required dropdown is invalid without a selection', function() {
155 var dropdownMenu = fixture('TrivialDropdownMenu');
156 dropdownMenu.required = true;
157
158 // no selection.
159 expect(dropdownMenu.validate()).to.be.false;
160 expect(dropdownMenu.invalid).to.be.true;
161 expect(dropdownMenu.value).to.not.be.ok;
162 });
163
164 test('a required dropdown is valid with a selection', function() {
165 var dropdownMenu = fixture('PreselectedDropdownMenu');
166 dropdownMenu.required = true;
167
168 expect(dropdownMenu.validate()).to.be.true;
169 expect(dropdownMenu.invalid).to.be.false;
170 expect(dropdownMenu.value).to.be.equal('Bar');
171 });
172 });
122 }); 173 });
123 </script> 174 </script>
124 175
125 </body> 176 </body>
126 </html> 177 </html>
OLDNEW
« no previous file with comments | « lib/src/paper-dropdown-menu/paper-dropdown-menu.html ('k') | lib/src/paper-fab/paper-fab.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698