OLD | NEW |
| (Empty) |
1 <!doctype html> | |
2 <!-- | |
3 Copyright (c) 2014 The Polymer Project Authors. All rights reserved. | |
4 This code may only be used under the BSD style license found at http://polymer.g
ithub.io/LICENSE.txt | |
5 The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt | |
6 The complete set of contributors may be found at http://polymer.github.io/CONTRI
BUTORS.txt | |
7 Code distributed by Google as part of the polymer project is also | |
8 subject to an additional IP rights grant found at http://polymer.github.io/PATEN
TS.txt | |
9 --> | |
10 <html> | |
11 <head> | |
12 <meta charset="UTF-8"> | |
13 <title>core-range-basic</title> | |
14 <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-
scale=1.0"> | |
15 | |
16 <script src="../../webcomponentsjs/webcomponents.js"></script> | |
17 <script src="../../web-component-tester/browser.js"></script> | |
18 | |
19 <link rel="import" href="../core-range.html"> | |
20 | |
21 </head> | |
22 <body> | |
23 | |
24 <core-range></core-range> | |
25 | |
26 <script> | |
27 | |
28 var range = document.querySelector('core-range'); | |
29 | |
30 suite('basic', function() { | |
31 | |
32 test('check default', function() { | |
33 assert.equal(range.min, 0); | |
34 assert.equal(range.max, 100); | |
35 assert.equal(range.value, 0); | |
36 }); | |
37 | |
38 test('set value', function(done) { | |
39 range.value = 50; | |
40 asyncPlatformFlush(function() { | |
41 assert.equal(range.value, 50); | |
42 // test clamp value | |
43 range.value = 60.1; | |
44 asyncPlatformFlush(function() { | |
45 assert.equal(range.value, 60); | |
46 done(); | |
47 }); | |
48 }); | |
49 }); | |
50 | |
51 test('set max', function(done) { | |
52 range.max = 10; | |
53 range.value = 11; | |
54 asyncPlatformFlush(function() { | |
55 assert.equal(range.value, range.max); | |
56 done(); | |
57 }); | |
58 }); | |
59 | |
60 test('test ratio', function(done) { | |
61 range.max = 10; | |
62 range.value = 5; | |
63 asyncPlatformFlush(function() { | |
64 assert.equal(range.ratio, 50); | |
65 done(); | |
66 }); | |
67 }); | |
68 | |
69 test('set min', function(done) { | |
70 range.min = 10 | |
71 range.max = 50; | |
72 range.value = 30; | |
73 asyncPlatformFlush(function() { | |
74 assert.equal(range.ratio, 50); | |
75 range.value = 0; | |
76 asyncPlatformFlush(function() { | |
77 assert.equal(range.value, range.min); | |
78 done(); | |
79 }); | |
80 }); | |
81 }); | |
82 | |
83 test('set step', function(done) { | |
84 range.min = 0; | |
85 range.max = 10; | |
86 range.value = 5.1; | |
87 asyncPlatformFlush(function() { | |
88 assert.equal(range.value, 5); | |
89 range.step = 0.1; | |
90 range.value = 5.1; | |
91 asyncPlatformFlush(function() { | |
92 assert.equal(range.value, 5.1); | |
93 done(); | |
94 }); | |
95 }); | |
96 }); | |
97 | |
98 }); | |
99 | |
100 </script> | |
101 | |
102 </body> | |
103 </html> | |
OLD | NEW |