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

Unified 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, 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 | « lib/src/paper-dropdown-menu/paper-dropdown-menu.html ('k') | lib/src/paper-fab/paper-fab.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/src/paper-dropdown-menu/test/paper-dropdown-menu.html
diff --git a/lib/src/paper-dropdown-menu/test/paper-dropdown-menu.html b/lib/src/paper-dropdown-menu/test/paper-dropdown-menu.html
index bc652582af9d3b9d53a4254b7ca47c7e836e4548..537a5154adc793ac64a60c898c9e3998d54a565d 100644
--- a/lib/src/paper-dropdown-menu/test/paper-dropdown-menu.html
+++ b/lib/src/paper-dropdown-menu/test/paper-dropdown-menu.html
@@ -119,6 +119,57 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
expect(dropdownMenu.selectedItem).to.be.equal(secondItem);
});
});
+
+ suite('deselecting', function() {
+ var menu;
+
+ setup(function() {
+ dropdownMenu = fixture('PreselectedDropdownMenu');
+ menu = Polymer.dom(dropdownMenu).querySelector('.dropdown-content');
+ });
+
+ test('an `iron-deselect` event clears the current selection', function() {
+ menu.selected = null;
+ expect(dropdownMenu.selectedItem).to.be.equal(null);
+ });
+ });
+
+ suite('validation', function() {
+ test('a non required dropdown is valid regardless of its selection', function() {
+ var dropdownMenu = fixture('TrivialDropdownMenu');
+ menu = Polymer.dom(dropdownMenu).querySelector('.dropdown-content');
+
+ // no selection.
+ expect(dropdownMenu.validate()).to.be.true;
+ expect(dropdownMenu.invalid).to.be.false;
+ expect(dropdownMenu.value).to.not.be.ok;
+
+ // some selection.
+ menu.selected = 1;
+ expect(dropdownMenu.validate()).to.be.true;
+ expect(dropdownMenu.invalid).to.be.false;
+ expect(dropdownMenu.value).to.be.equal('Bar');
+ });
+
+ test('a required dropdown is invalid without a selection', function() {
+ var dropdownMenu = fixture('TrivialDropdownMenu');
+ dropdownMenu.required = true;
+
+ // no selection.
+ expect(dropdownMenu.validate()).to.be.false;
+ expect(dropdownMenu.invalid).to.be.true;
+ expect(dropdownMenu.value).to.not.be.ok;
+ });
+
+ test('a required dropdown is valid with a selection', function() {
+ var dropdownMenu = fixture('PreselectedDropdownMenu');
+ dropdownMenu.required = true;
+
+ expect(dropdownMenu.validate()).to.be.true;
+ expect(dropdownMenu.invalid).to.be.false;
+ expect(dropdownMenu.value).to.be.equal('Bar');
+ });
+ });
});
</script>
« 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