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

Side by Side Diff: third_party/polymer/v0_8/components-chromium/iron-iconset-svg/test/iron-iconset-svg.html

Issue 1082403004: Import Polymer 0.8 and several key elements. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rerun reproduce.sh Created 5 years, 8 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 Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
4 This code may only be used under the BSD style license found at http://polymer.g ithub.io/LICENSE.txt
5 The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
6 The complete set of contributors may be found at http://polymer.github.io/CONTRI BUTORS.txt
7 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 -->
10
11 <html>
12 <head>
13
14 <title>iron-iconset-svg</title>
15 <meta charset="utf-8">
16 <meta name="viewport" content="width=device-width, initial-scale=1.0">
17
18 <script src="../../webcomponentsjs/webcomponents-lite.js"></script>
19 <script src="../../web-component-tester/browser.js"></script>
20 <script src="../../test-fixture/test-fixture-mocha.js"></script>
21
22 <link rel="import" href="../iron-iconset-svg.html">
23 <link rel="import" href="../../iron-meta/iron-meta.html">
24 <link rel="import" href="../../test-fixture/test-fixture.html">
25
26 </head>
27 <body>
28
29 <test-fixture id="TrivialIconsetSvg">
30 <template>
31 <iron-iconset-svg name="foo"></iron-iconset-svg>
32 <iron-meta type="iconset"></iron-meta>
33 </template>
34 </test-fixture>
35
36 <test-fixture id="StandardIconsetSvg">
37 <template>
38 <iron-iconset-svg name="my-icons" size="20">
39 <svg>
40 <defs>
41 <circle id="circle" cx="20" cy="20" r="10"></circle>
42 <rect id="square" x="0" y="0" width="20" height="20"></rect>
43 </defs>
44 </svg>
45 </iron-iconset-svg>
46 <div></div>
47 </template>
48 </test-fixture>
49
50 <script>
51 suite('<iron-iconset>', function () {
52 suite('basic behavior', function () {
53 var iconset;
54 var meta;
55
56 setup(function () {
57 var elements = fixture('TrivialIconsetSvg');
58
59 iconset = elements[0];
60 meta = elements[1];
61 });
62
63 test('it can be accessed via iron-meta', function () {
64 expect(meta.byKey('foo')).to.be.equal(iconset);
65 });
66 });
67
68 suite('when paired with a size and SVG definition', function () {
69 var iconset;
70 var div;
71
72 setup(function () {
73 var elements = fixture('StandardIconsetSvg');
74
75 iconset = elements[0];
76 div = elements[1];
77 });
78
79 test('appends a child to the target element', function () {
80 expect(div.firstElementChild).to.not.be.ok;
81
82 iconset.applyIcon(div, 'circle');
83
84 expect(div.firstElementChild).to.be.ok;
85 });
86
87 test('can be queried for all available icons', function () {
88 expect(iconset.iconNames).to.deep.eql(['my-icons:circle', 'my-icons:square ']);
89 });
90
91 test('supports any icon defined in the svg', function () {
92 var lastSvgIcon;
93
94 iconset.iconNames.forEach(function (iconName) {
95 // TODO(cdata): Ask Scott about why iconNames include their
96 // iconset name.
97 iconset.applyIcon(div, iconName.split(':').pop());
98
99 expect(div.firstElementChild).to.not.be.eql(lastSvgIcon);
100
101 lastSvgIcon = div.firstElementChild;
102 });
103 });
104 });
105 });
106 </script>
107
108 </body>
109 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698