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

Unified Diff: test/paper_dropdown_menu_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_checked_element_behavior_test.html ('k') | test/paper_inky_focus_behavior_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/paper_dropdown_menu_test.dart
diff --git a/test/paper_dropdown_menu_test.dart b/test/paper_dropdown_menu_test.dart
index 5ab70757bb1ceef041b2040f6f47f57bec6f5664..164850e4daef23b9ff736970dbc7acdbcdff26ca 100644
--- a/test/paper_dropdown_menu_test.dart
+++ b/test/paper_dropdown_menu_test.dart
@@ -75,5 +75,58 @@ main() async {
expect(dropdownMenu.selectedItem, secondItem);
});
});
+
+ group('deselecting', () {
+ var menu;
+
+ setUp(() {
+ dropdownMenu = fixture('PreselectedDropdownMenu');
+ menu = Polymer.dom(dropdownMenu).querySelector('.dropdown-content');
+ });
+
+ test('an `iron-deselect` event clears the current selection', () {
+ menu.selected = null;
+ expect(dropdownMenu.selectedItem, null);
+ });
+ });
+
+ group('validation', () {
+ var menu;
+
+ test('a non required dropdown is valid regardless of its selection', () {
+ PaperDropdownMenu dropdownMenu = fixture('TrivialDropdownMenu');
+ menu = Polymer.dom(dropdownMenu).querySelector('.dropdown-content');
+
+ // no selection.
+ expect(dropdownMenu.validate(null), isTrue);
+ expect(dropdownMenu.invalid, isFalse);
+ expect(dropdownMenu.value, isNull);
+
+ // some selection.
+ menu.selected = 1;
+ expect(dropdownMenu.validate(null), isTrue);
+ expect(dropdownMenu.invalid, isFalse);
+ expect(dropdownMenu.value, 'Bar');
+ });
+
+ test('a required dropdown is invalid without a selection', () {
+ PaperDropdownMenu dropdownMenu = fixture('TrivialDropdownMenu');
+ dropdownMenu.required = true;
+
+ // no selection.
+ expect(dropdownMenu.validate(null), isFalse);
+ expect(dropdownMenu.invalid, isTrue);
+ expect(dropdownMenu.value, isNull);
+ });
+
+ test('a required dropdown is valid with a selection', () {
+ PaperDropdownMenu dropdownMenu = fixture('PreselectedDropdownMenu');
+ dropdownMenu.required = true;
+
+ expect(dropdownMenu.validate(null), isTrue);
+ expect(dropdownMenu.invalid, isFalse);
+ expect(dropdownMenu.value, 'Bar');
+ });
+ });
});
}
« no previous file with comments | « test/paper_checked_element_behavior_test.html ('k') | test/paper_inky_focus_behavior_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698