jellyfin-web/dashboard-ui/bower_components/paper-progress/test/basic.html

149 lines
4.4 KiB
HTML
Raw Normal View History

2015-06-26 20:27:38 -07:00
<!doctype html>
<!--
@license
Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
2015-07-13 14:26:11 -07:00
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
2015-06-26 20:27:38 -07:00
Code distributed by Google as part of the polymer project is also
2015-07-13 14:26:11 -07:00
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
2015-06-26 20:27:38 -07:00
-->
<html>
<head>
<meta charset="UTF-8">
<title>paper-progress test</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
<script src="../../webcomponentsjs/webcomponents-lite.js"></script>
<script src="../../web-component-tester/browser.js"></script>
<script src="../../test-fixture/test-fixture-mocha.js"></script>
<link rel="import" href="../paper-progress.html">
<link rel="import" href="../../test-fixture/test-fixture.html">
</head>
<body>
<test-fixture id="trivialProgress">
<template>
<paper-progress></paper-progress>
</template>
</test-fixture>
2015-09-21 08:43:10 -07:00
<test-fixture id="transitingProgress">
<template>
<paper-progress class="transiting"></paper-progress>
</template>
</test-fixture>
2015-06-26 20:27:38 -07:00
<script>
2015-09-21 08:43:10 -07:00
suite('basic features', function() {
var progress;
2015-06-26 20:27:38 -07:00
setup(function() {
2015-09-21 08:43:10 -07:00
progress = fixture('trivialProgress');
2015-06-26 20:27:38 -07:00
});
test('check default', function() {
2015-09-21 08:43:10 -07:00
assert.equal(progress.min, 0);
assert.equal(progress.max, 100);
assert.equal(progress.value, 0);
2015-06-26 20:27:38 -07:00
});
test('set value', function(done) {
2015-09-21 08:43:10 -07:00
progress.value = 50;
2015-06-26 20:27:38 -07:00
asyncPlatformFlush(function() {
2015-09-21 08:43:10 -07:00
assert.equal(progress.value, 50);
2015-06-26 20:27:38 -07:00
// test clamp value
2015-09-21 08:43:10 -07:00
progress.value = 60.1;
2015-06-26 20:27:38 -07:00
asyncPlatformFlush(function() {
2015-09-21 08:43:10 -07:00
assert.equal(progress.value, 60);
2015-06-26 20:27:38 -07:00
done();
});
});
});
test('set max', function(done) {
2015-09-21 08:43:10 -07:00
progress.max = 10;
progress.value = 11;
2015-06-26 20:27:38 -07:00
asyncPlatformFlush(function() {
2015-09-21 08:43:10 -07:00
assert.equal(progress.value, progress.max);
2015-06-26 20:27:38 -07:00
done();
});
});
test('test ratio', function(done) {
2015-09-21 08:43:10 -07:00
progress.max = 10;
progress.value = 5;
2015-06-26 20:27:38 -07:00
asyncPlatformFlush(function() {
2015-09-21 08:43:10 -07:00
assert.equal(progress.ratio, 50);
2015-06-26 20:27:38 -07:00
done();
});
});
test('test secondary ratio', function(done) {
2015-09-21 08:43:10 -07:00
progress.max = 10;
progress.secondaryProgress = 5;
2015-06-26 20:27:38 -07:00
asyncPlatformFlush(function() {
2015-09-21 08:43:10 -07:00
assert.equal(progress.secondaryRatio, 50);
2015-06-26 20:27:38 -07:00
done();
});
});
test('set min', function(done) {
2015-09-21 08:43:10 -07:00
progress.min = 10
progress.max = 50;
progress.value = 30;
2015-06-26 20:27:38 -07:00
asyncPlatformFlush(function() {
2015-09-21 08:43:10 -07:00
assert.equal(progress.ratio, 50);
progress.value = 0;
2015-06-26 20:27:38 -07:00
asyncPlatformFlush(function() {
2015-09-21 08:43:10 -07:00
assert.equal(progress.value, progress.min);
2015-06-26 20:27:38 -07:00
done();
});
});
});
test('set step', function(done) {
2015-09-21 08:43:10 -07:00
progress.min = 0;
progress.max = 10;
progress.value = 5.1;
2015-06-26 20:27:38 -07:00
asyncPlatformFlush(function() {
2015-09-21 08:43:10 -07:00
assert.equal(progress.value, 5);
progress.step = 0.1;
progress.value = 5.1;
2015-06-26 20:27:38 -07:00
asyncPlatformFlush(function() {
2015-09-21 08:43:10 -07:00
assert.equal(progress.value, 5.1);
2015-06-26 20:27:38 -07:00
done();
});
});
});
2015-09-21 08:43:10 -07:00
});
suite('transiting class', function() {
var progress;
2015-06-26 20:27:38 -07:00
2015-09-21 08:43:10 -07:00
setup(function() {
progress = fixture('transitingProgress');
});
test('progress bars', function() {
var stylesForPrimaryProgress = window.getComputedStyle(progress.$.primaryProgress);
var stylesForSecondaryProgress = window.getComputedStyle(progress.$.secondaryProgress);
var transitionProp = stylesForPrimaryProgress['transition-property'];
assert.isTrue(transitionProp === 'transform' || transitionProp === '-webkit-transform');
assert.equal(stylesForPrimaryProgress['transition-duration'], '0.08s');
transitionProp = stylesForSecondaryProgress['transition-property'];
assert.isTrue(transitionProp === 'transform' || transitionProp === '-webkit-transform');
assert.equal(stylesForSecondaryProgress['transition-duration'], '0.08s');
});
2015-06-26 20:27:38 -07:00
});
</script>
</body>
</html>