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

Side by Side Diff: polymer_1.0.4/bower_components/paper-fab/test/basic.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 <html>
12 <head>
13 <meta charset="UTF-8">
14 <title>paper-fab basic tests</title>
15 <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum- scale=1.0">
16
17 <script src="../../webcomponentsjs/webcomponents-lite.js"></script>
18 <script src="../../web-component-tester/browser.js"></script>
19 <script src="../../test-fixture/test-fixture-mocha.js"></script>
20
21 <link rel="import" href="../../test-fixture/test-fixture.html">
22 <link rel="import" href="../../iron-icons/iron-icons.html">
23 <link rel="import" href="../paper-fab.html">
24
25 </head>
26 <body>
27
28 <test-fixture id="TrivialFab">
29 <template>
30 <div style="line-height:30px;">
31 <paper-fab id="fab1" icon="add"></paper-fab>
32 </div>
33 </template>
34 </test-fixture>
35
36 <test-fixture id="SrcFab">
37 <template>
38 <paper-fab src="add.png"></paper-fab>
39 </template>
40 </test-fixture>
41
42 <script>
43
44 var f1;
45 var f2;
46
47 function centerOf(element) {
48 var rect = element.getBoundingClientRect();
49 return {left: rect.left + rect.width / 2, top: rect.top + rect.height / 2} ;
50 }
51
52 function approxEqual(p1, p2) {
53 return Math.round(p1.left) == Math.round(p2.left) && Math.round(p1.top) == Math.round(p2.top);
54 }
55
56 setup(function() {
57 f1 = fixture('TrivialFab').querySelector('#fab1');
58 f2 = fixture('SrcFab');
59 });
60
61 test('applies an icon specified by the `icon` attribute', function() {
62 assert.strictEqual(!!f1.$.icon.usesSrcAttribute, false);
63 assert.ok(Polymer.dom(f1.$.icon.root).querySelector('svg'));
64 });
65
66 test('applies an icon specified by the `src` attribute', function() {
67 assert.strictEqual(f2.$.icon._usesIconset(), false);
68 assert.ok(f2.$.icon._img);
69 });
70
71 test('renders correctly independent of line height', function() {
72 assert.ok(approxEqual(centerOf(f1.$.icon), centerOf(f1)));
73 });
74 </script>
75 </body>
76 </html>
OLDNEW
« no previous file with comments | « polymer_1.0.4/bower_components/paper-fab/test/a11y.html ('k') | polymer_1.0.4/bower_components/paper-fab/test/index.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698