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

Side by Side Diff: test/iron_autogrow_textarea_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/iron_a11y_keys_behavior_test.html ('k') | test/iron_behavior_active_state_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.iron_autogrow_textarea_test; 5 library polymer_elements.test.iron_autogrow_textarea_test;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'package:polymer_elements/iron_autogrow_textarea.dart'; 8 import 'package:polymer_elements/iron_autogrow_textarea.dart';
9 import 'package:test/test.dart'; 9 import 'package:test/test.dart';
10 import 'package:web_components/web_components.dart'; 10 import 'package:web_components/web_components.dart';
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 43
44 test('removing rows shrinks the textarea', () { 44 test('removing rows shrinks the textarea', () {
45 IronAutogrowTextarea autogrow = fixture('basic'); 45 IronAutogrowTextarea autogrow = fixture('basic');
46 autogrow.bindValue = 'batman\nand\nrobin'; 46 autogrow.bindValue = 'batman\nand\nrobin';
47 var initialHeight = autogrow.offsetHeight; 47 var initialHeight = autogrow.offsetHeight;
48 autogrow.bindValue = 'batman'; 48 autogrow.bindValue = 'batman';
49 var finalHeight = autogrow.offsetHeight; 49 var finalHeight = autogrow.offsetHeight;
50 expect(finalHeight < initialHeight, isTrue); 50 expect(finalHeight < initialHeight, isTrue);
51 }); 51 });
52 52
53 test('an undefined bindValue is the empty string', () {
54 IronAutogrowTextarea autogrow = fixture('basic');
55 var initialHeight = autogrow.offsetHeight;
56
57 autogrow.bindValue = 'batman\nand\nrobin';
58 var finalHeight = autogrow.offsetHeight;
59 expect(finalHeight , greaterThan(initialHeight));
60
61 autogrow.bindValue = null;
62 expect(autogrow.offsetHeight, initialHeight);
63 expect(autogrow.textarea.value, '');
64 });
65
53 test('textarea selection works', () { 66 test('textarea selection works', () {
54 IronAutogrowTextarea autogrow = fixture('basic'); 67 IronAutogrowTextarea autogrow = fixture('basic');
55 var textarea = autogrow.textarea; 68 var textarea = autogrow.textarea;
56 autogrow.bindValue = 'batman\nand\nrobin'; 69 autogrow.bindValue = 'batman\nand\nrobin';
57 70
58 autogrow.selectionStart = 3; 71 autogrow.selectionStart = 3;
59 autogrow.selectionEnd = 5; 72 autogrow.selectionEnd = 5;
60 73
61 expect(textarea.selectionStart, 3); 74 expect(textarea.selectionStart, 3);
62 expect(textarea.selectionEnd, 5); 75 expect(textarea.selectionEnd, 5);
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 test('a required textarea with no text is invalid', () { 111 test('a required textarea with no text is invalid', () {
99 IronAutogrowTextarea input = fixture('basic'); 112 IronAutogrowTextarea input = fixture('basic');
100 input.required = true; 113 input.required = true;
101 expect(input.validate(), isFalse); 114 expect(input.validate(), isFalse);
102 input.bindValue = 'batman'; 115 input.bindValue = 'batman';
103 expect(input.validate(), isTrue); 116 expect(input.validate(), isTrue);
104 }); 117 });
105 }); 118 });
106 }); 119 });
107 } 120 }
OLDNEW
« no previous file with comments | « test/iron_a11y_keys_behavior_test.html ('k') | test/iron_behavior_active_state_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698