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

Side by Side Diff: third_party/polymer/v0_8/components/paper-ripple/test/paper-ripple.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, 7 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 <html>
11 <head>
12
13 <meta charset="UTF-8">
14 <title>paper-ripple</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 href="../../test-fixture/test-fixture.html" rel="import">
22 <link href="../paper-ripple.html" rel="import">
23
24 <style>
25 #RippleContainer {
26 display: block;
27 position: relative;
28 width: 100px;
29 height: 50px;
30 }
31 </style>
32 </head>
33 <body>
34 <test-fixture id="TrivialRipple">
35 <template>
36 <div id="RippleContainer">
37 <paper-ripple></paper-ripple>
38 </div>
39 </template>
40 </test-fixture>
41
42 <test-fixture id="RecenteringRipple">
43 <template>
44 <div id="RippleContainer">
45 <paper-ripple recenters></paper-ripple>
46 </div>
47 </template>
48 </test-fixture>
49
50 <script>
51 function FakeMouseEvent (target, relativeX, relativeX) {
52 var rect = target.getBoundingClientRect()
53
54 return {
55 x: rect.left + relativeX,
56 y: rect.top + relativeX
57 };
58 }
59
60 suite('<paper-ripple>', function () {
61 var mouseEvent;
62 var rippleContainer;
63 var ripple;
64
65 suite('when tapped', function () {
66 setup(function () {
67 rippleContainer = fixture('TrivialRipple');
68 ripple = rippleContainer.firstElementChild;
69
70 mouseEvent = new FakeMouseEvent(ripple, 10, 10);
71 });
72
73 test('creates a ripple', function () {
74 expect(ripple.ripples.length).to.be.eql(0);
75 ripple.mousedownAction(mouseEvent);
76 expect(ripple.ripples.length).to.be.eql(1);
77 });
78
79 test('may create multiple ripples that overlap', function () {
80 expect(ripple.ripples.length).to.be.eql(0);
81
82 for (var i = 0; i < 3; ++i) {
83 ripple.mousedownAction(mouseEvent);
84 expect(ripple.ripples.length).to.be.eql(i + 1);
85 }
86 });
87 });
88
89 suite('with the `recenters` attribute set to true', function () {
90 setup(function () {
91 rippleContainer = fixture('RecenteringRipple');
92 ripple = rippleContainer.firstElementChild;
93
94 mouseEvent = new FakeMouseEvent(ripple, 10, 10);
95 });
96
97 test('ripples will gravitate towards the center', function (done) {
98 var waveContainerElement;
99 var waveTranslateString;
100
101 ripple.mousedownAction(mouseEvent);
102
103 waveContainerElement = ripple.ripples[0].waveContainer;
104 waveTranslateString = waveContainerElement.style.transform;
105
106 ripple.mouseupAction(mouseEvent);
107
108 window.requestAnimationFrame(function () {
109 try {
110 expect(waveTranslateString).to.be.ok;
111 expect(waveContainerElement.style.transform).to.be.ok;
112 expect(waveContainerElement.style.transform).to.not.be.eql(waveTra nslateString);
113
114 done();
115 } catch (e) {
116 done(e);
117 }
118 });
119 });
120 });
121 });
122 </script>
123
124 </body>
125 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698