paper-material.html
2.68 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
<!doctype html>
<!--
@license
Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
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
Code distributed by Google as part of the polymer project is also
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
-->
<html>
<head>
<meta charset="UTF-8">
<title>paper-material basic tests</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
<script src="../../webcomponentsjs/webcomponents.js"></script>
<script src="../../web-component-tester/browser.js"></script>
<link href="../paper-material.html" rel="import">
</head>
<body>
<test-fixture id="TrivialCard">
<template>
<paper-material elevation="1"></paper-material>
</template>
</test-fixture>
<test-fixture id="ProgressiveElevations">
<template>
<paper-material elevation="1"></paper-material>
<paper-material elevation="2"></paper-material>
<paper-material elevation="3"></paper-material>
<paper-material elevation="4"></paper-material>
<paper-material elevation="5"></paper-material>
</template>
</test-fixture>
<script>
suite('<paper-material>', function() {
suite('with a non-zero elevation attribute', function() {
var style;
var card;
setup(function() {
card = fixture('TrivialCard');
style = window.getComputedStyle(card);
});
test('has a shadow', function() {
expect(style.boxShadow).to.be.ok;
expect(style.boxShadow).to.not.be.eql('none');
});
test('loses shadow with elevation value 0', function() {
card.elevation = 0;
expect(style.boxShadow).to.be.eql('none');
});
});
suite('progressively increasing values of elevation', function() {
var cards;
setup(function() {
cards = fixture('ProgressiveElevations');
});
test('yield progressively "deeper" cards', function() {
var lastStyle;
var style;
expect(cards.length).to.be.eql(5);
cards.forEach(function (card) {
style = window.getComputedStyle(card);
expect(style.boxShadow).to.be.ok;
expect(style.boxShadow).to.not.be.eql('none');
expect(style.boxShadow).to.not.be.eql(lastStyle && lastStyle.boxShadow);
lastStyle = style;
});
});
});
});
</script>
</body>
</html>