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

Unified Diff: tests/html/selectelement_test.dart

Issue 11035032: Fixing SelectElement.selectedOptions to work on all platforms. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Moved selectelement.darttemplate. Created 8 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/html/templates/html/dart2js/impl_SelectElement.darttemplate ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/html/selectelement_test.dart
diff --git a/tests/html/selectelement_test.dart b/tests/html/selectelement_test.dart
new file mode 100644
index 0000000000000000000000000000000000000000..4f375510a09fa6af35c5446a84e415fada2b36dd
--- /dev/null
+++ b/tests/html/selectelement_test.dart
@@ -0,0 +1,40 @@
+// Copyright (c) 2012, 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.
+
+#library('selectelement_test');
+#import('../../pkg/unittest/unittest.dart');
+#import('../../pkg/unittest/html_config.dart');
+#import('dart:html');
+
+main() {
+ useHtmlConfiguration();
+
+ test('selectedOptions', () {
+ var element = new SelectElement();
+ var options = [
+ new OptionElement(),
+ new OptionElement('data', 'two', false, true),
+ new OptionElement('data', 'two', false, true),
+ new OptionElement(),
+ ];
+ element.elements.addAll(options);
+ expect(element.selectedOptions.length, 1);
+ expect(element.selectedOptions[0] == options[2]);
+ });
+
+ test('multiple selectedOptions', () {
+ var element = new SelectElement();
+ element.multiple = true;
+ var options = [
+ new OptionElement(),
+ new OptionElement('data', 'two', false, true),
+ new OptionElement('data', 'two', false, true),
+ new OptionElement(),
+ ];
+ element.elements.addAll(options);
+ expect(element.selectedOptions.length, 2);
+ expect(element.selectedOptions[0] == options[1]);
+ expect(element.selectedOptions[1] == options[2]);
+ });
+}
« no previous file with comments | « lib/html/templates/html/dart2js/impl_SelectElement.darttemplate ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698