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

Side by Side Diff: polymer_1.0.4/bower_components/iron-iconset-svg/test/iron-iconset-svg.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, 5 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-svg</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-svg.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="TrivialIconsetSvg">
31 <template>
32 <iron-iconset-svg name="foo"></iron-iconset-svg>
33 <iron-meta type="iconset"></iron-meta>
34 </template>
35 </test-fixture>
36
37 <test-fixture id="StandardIconsetSvg">
38 <template>
39 <iron-iconset-svg name="my-icons" size="20">
40 <svg>
41 <defs>
42 <circle id="circle" cx="20" cy="20" r="10"></circle>
43 <rect id="square" x="0" y="0" width="20" height="20"></rect>
44 </defs>
45 </svg>
46 </iron-iconset-svg>
47 <div></div>
48 </template>
49 </test-fixture>
50
51 <script>
52
53 suite('<iron-iconset>', function () {
54
55 suite('basic behavior', function () {
56 var iconset;
57 var meta;
58
59 setup(function () {
60 var elements = fixture('TrivialIconsetSvg');
61 iconset = elements[0];
62 meta = elements[1];
63 });
64
65 test('it can be accessed via iron-meta', function () {
66 expect(meta.byKey('foo')).to.be.equal(iconset);
67 });
68 });
69
70 suite('when paired with a size and SVG definition', function () {
71 var iconset;
72 var div;
73
74 setup(function () {
75 var elements = fixture('StandardIconsetSvg');
76 iconset = elements[0];
77 div = elements[1];
78 });
79
80 test('appends a child to the target element', function () {
81 expect(div.firstElementChild).to.not.be.ok;
82 iconset.applyIcon(div, 'circle');
83 expect(div.firstElementChild).to.be.ok;
84 });
85
86 test('can be queried for all available icons', function () {
87 expect(iconset.getIconNames()).to.deep.eql(['my-icons:circle', 'my-ico ns:square']);
88 });
89
90 test('supports any icon defined in the svg', function () {
91 var lastSvgIcon;
92
93 iconset.getIconNames().forEach(function (iconName) {
94 iconset.applyIcon(div, iconName.split(':').pop());
95 expect(div.firstElementChild).to.not.be.equal(lastSvgIcon);
96 lastSvgIcon = div.firstElementChild;
97 });
98 });
99
100 });
101
102 });
103
104 </script>
105
106 </body>
107 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698