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

Side by Side Diff: lib/src/iron-range-behavior/test/basic.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
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 27 matching lines...) Expand all
38 }); 38 });
39 39
40 test('check default', function() { 40 test('check default', function() {
41 assert.equal(range.min, 0); 41 assert.equal(range.min, 0);
42 assert.equal(range.max, 100); 42 assert.equal(range.max, 100);
43 assert.equal(range.value, 0); 43 assert.equal(range.value, 0);
44 }); 44 });
45 45
46 test('set value', function(done) { 46 test('set value', function(done) {
47 range.value = 50; 47 range.value = 50;
48 asyncPlatformFlush(function() { 48 flush(function() {
49 assert.equal(range.value, 50); 49 assert.equal(range.value, 50);
50 // test clamp value 50 // test clamp value
51 range.value = 60.1; 51 range.value = 60.1;
52 asyncPlatformFlush(function() { 52 flush(function() {
53 assert.equal(range.value, 60); 53 assert.equal(range.value, 60);
54 done(); 54 done();
55 }); 55 });
56 }); 56 });
57 }); 57 });
58 58
59 test('set max', function(done) { 59 test('set max', function(done) {
60 range.max = 10; 60 range.max = 10;
61 range.value = 11; 61 range.value = 11;
62 asyncPlatformFlush(function() { 62 flush(function() {
63 assert.equal(range.value, range.max); 63 assert.equal(range.value, range.max);
64 done(); 64 done();
65 }); 65 });
66 }); 66 });
67 67
68 test('test ratio', function(done) { 68 test('test ratio', function(done) {
69 range.max = 10; 69 range.max = 10;
70 range.value = 5; 70 range.value = 5;
71 asyncPlatformFlush(function() { 71 flush(function() {
72 assert.equal(range.ratio, 50); 72 assert.equal(range.ratio, 50);
73 done(); 73 done();
74 }); 74 });
75 }); 75 });
76 76
77 test('set min', function(done) { 77 test('set min', function(done) {
78 range.min = 10 78 range.min = 10
79 range.max = 50; 79 range.max = 50;
80 range.value = 30; 80 range.value = 30;
81 asyncPlatformFlush(function() { 81 flush(function() {
82 assert.equal(range.ratio, 50); 82 assert.equal(range.ratio, 50);
83 range.value = 0; 83 range.value = 0;
84 asyncPlatformFlush(function() { 84 flush(function() {
85 assert.equal(range.value, range.min); 85 assert.equal(range.value, range.min);
86 done(); 86 done();
87 }); 87 });
88 }); 88 });
89 }); 89 });
90 90
91 test('set step', function(done) { 91 test('set step', function(done) {
92 range.min = 0; 92 range.min = 0;
93 range.max = 10; 93 range.max = 10;
94 range.value = 5.1; 94 range.value = 5.1;
95 asyncPlatformFlush(function() { 95 flush(function() {
96 assert.equal(range.value, 5); 96 assert.equal(range.value, 5);
97 range.step = 0.1; 97 range.step = 0.1;
98 range.value = 5.1; 98 range.value = 5.1;
99 asyncPlatformFlush(function() { 99 flush(function() {
100 assert.equal(range.value, 5.1); 100 assert.equal(range.value, 5.1);
101 done(); 101 done();
102 }); 102 });
103 }); 103 });
104 }); 104 });
105 105
106 test('odd values', function(done) {
107 range.min = 1;
108 range.max = 7;
109 range.step = 2;
110 range.value = 3;
111
112 flush(function() {
113 assert.equal(range.value, 3);
114
115 range.value += range.step;
116 assert.equal(range.value, 5);
117
118 range.value += range.step;
119 assert.equal(range.value, 7);
120 done();
121 });
122 });
123
124 test('negative values should round up', function(done) {
125 range.min = -10;
126 range.max = 10;
127 range.step = 0.1;
128 range.value = -8.4252;
129
130 flush(function() {
131 assert.equal(range.value, -8.4);
132 done();
133 });
134 });
135
136 test('positive values should round up', function(done) {
137 range.min = 10;
138 range.max = 100;
139 range.step = 0.25;
140 range.value = 19.34567;
141
142 flush(function() {
143 assert.equal(range.value, 19.25);
144 done();
145 });
146 });
147
106 }); 148 });
107 149
108 </script> 150 </script>
109 151
110 </body> 152 </body>
111 </html> 153 </html>
OLDNEW
« no previous file with comments | « lib/src/iron-range-behavior/iron-range-behavior.html ('k') | lib/src/iron-selector/iron-multi-selectable.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698