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