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

Side by Side Diff: polymer_1.0.4/bower_components/iron-iconset/test/iron-iconset.html

Issue 1205703007: Add polymer 1.0 to npm_modules (Closed) Base URL: https://chromium.googlesource.com/infra/third_party/npm_modules.git@master
Patch Set: Renamed folder to 1.0.4 Created 5 years, 6 months 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
(Empty)
1 <!doctype html>
2 <!--
3 @license
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
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
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
10 -->
11
12 <html>
13 <head>
14
15 <title>iron-iconset</title>
16 <meta charset="utf-8">
17 <meta name="viewport" content="width=device-width, initial-scale=1.0">
18
19 <script src="../../webcomponentsjs/webcomponents-lite.js"></script>
20 <script src="../../web-component-tester/browser.js"></script>
21 <script src="../../test-fixture/test-fixture-mocha.js"></script>
22
23 <link rel="import" href="../iron-iconset.html">
24 <link rel="import" href="../../iron-meta/iron-meta.html">
25 <link rel="import" href="../../test-fixture/test-fixture.html">
26
27 </head>
28 <body>
29
30 <test-fixture id="TrivialIconset">
31 <template>
32 <iron-iconset name="foo" src="../demo/my-icons.png"></iron-iconset>
33 <iron-meta type="iconset"></iron-meta>
34 </template>
35 </test-fixture>
36
37 <test-fixture id="StandardIconset">
38 <template>
39 <iron-iconset name="my-icons"
40 src="../demo/my-icons.png"
41 width="96"
42 size="24"
43 icons="location place starta stopb bus car train walk"></iro n-iconset>
44 <div></div>
45 </template>
46 </test-fixture>
47
48 <test-fixture id="ThemedIconset">
49 <template>
50 <iron-iconset name="my-icons"
51 src="../demo/my-icons.png"
52 width="96"
53 size="24"
54 icons="location place starta stopb bus car train walk">
55 <property theme="large" offset-x="10" offset-y="10"></property>
56 </iron-iconset>
57 <div></div>
58 </template>
59 </test-fixture>
60
61 <script>
62 suite('<iron-iconset>', function () {
63 suite('basic behavior', function () {
64 var iconset;
65 var meta;
66
67 setup(function () {
68 var elements = fixture('TrivialIconset');
69
70 iconset = elements[0];
71 meta = elements[1];
72 });
73
74 test('it can be accessed via iron-meta', function () {
75 expect(meta.byKey('foo')).to.be.equal(iconset);
76 });
77 });
78
79 suite('when src, width, iconSize and icons are assigned', function () {
80 var iconset;
81 var div;
82
83 setup(function () {
84 var elements = fixture('StandardIconset');
85
86 iconset = elements[0];
87 div = elements[1];
88 });
89
90 /*
91 test('appends a child to the target element', function () {
92 expect(div.firstElementChild).to.not.be.ok;
93
94 iconset.applyIcon(div, 'location');
95
96 expect(div.firstElementChild).to.be.ok;
97 });
98 */
99
100 test('sets the background image of the target element', function () {
101 var iconStyle;
102
103 iconset.applyIcon(div, 'location');
104 iconStyle = window.getComputedStyle(div);
105
106 expect(iconStyle.backgroundImage).to.match(/url\(.*demo\/my-icons.png["']? \)/);
107 });
108
109 test('offsets the background image to the icon\'s position', function () {
110 var iconStyle;
111
112 iconset.applyIcon(div, 'bus');
113 iconStyle = window.getComputedStyle(div);
114
115 expect(iconStyle.backgroundPosition).to.match(/0(px|%) -24px/);
116 });
117 });
118
119 suite('when an iconset is themed', function () {
120 var iconset;
121 var div;
122
123 setup(function () {
124 var elements = fixture('ThemedIconset');
125
126 iconset = elements[0];
127 div = elements[1];
128 });
129
130 test('can use a theme when applying icon', function () {
131 iconset.applyIcon(div, 'bus', 'large');
132
133 expect(div).to.be.ok;
134 });
135
136 test('adjusts the icon by the theme offset', function () {
137 var iconStyle;
138
139 iconset.applyIcon(div, 'bus', 'large');
140 iconStyle = window.getComputedStyle(div);
141
142 expect(iconStyle.backgroundPosition).to.match(/-10px -34px/);
143 });
144 });
145 });
146 </script>
147
148 </body>
149 </html>
OLDNEW
« no previous file with comments | « polymer_1.0.4/bower_components/iron-iconset/test/index.html ('k') | polymer_1.0.4/bower_components/iron-image/.bower.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698