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

Unified Diff: polymer_1.2.3/bower_components/paper-ripple/test/paper-ripple.html

Issue 1581713003: [third_party] add polymer 1.2.3 (Closed) Base URL: https://chromium.googlesource.com/infra/third_party/npm_modules.git@master
Patch Set: 1.2.3 Created 4 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: polymer_1.2.3/bower_components/paper-ripple/test/paper-ripple.html
diff --git a/polymer_1.0.4/bower_components/paper-ripple/test/paper-ripple.html b/polymer_1.2.3/bower_components/paper-ripple/test/paper-ripple.html
similarity index 71%
copy from polymer_1.0.4/bower_components/paper-ripple/test/paper-ripple.html
copy to polymer_1.2.3/bower_components/paper-ripple/test/paper-ripple.html
index 81232069acb25324fb820294017745333a0d8e2f..fdee96f9c70b92e5dcf537f60e53623c9d97169a 100644
--- a/polymer_1.0.4/bower_components/paper-ripple/test/paper-ripple.html
+++ b/polymer_1.2.3/bower_components/paper-ripple/test/paper-ripple.html
@@ -17,9 +17,8 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
<script src="../../webcomponentsjs/webcomponents-lite.js"></script>
<script src="../../web-component-tester/browser.js"></script>
- <script src="../../test-fixture/test-fixture-mocha.js"></script>
+ <script src="../../iron-test-helpers/mock-interactions.js"></script>
- <link rel="import" href="../../test-fixture/test-fixture.html">
<link rel="import" href="../paper-ripple.html">
<style>
@@ -56,18 +55,15 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
</template>
</test-fixture>
- <script>
- function FakeMouseEvent (target, relativeX, relativeX) {
- var rect = target.getBoundingClientRect();
-
- return {
- detail: {
- x: rect.left + relativeX,
- y: rect.top + relativeX
- }
- };
- }
+ <test-fixture id="NoinkTarget">
+ <template>
+ <div id="RippleContainer">
+ <paper-ripple noink></paper-ripple>
+ </div>
+ </template>
+ </test-fixture>
+ <script>
suite('<paper-ripple>', function () {
var mouseEvent;
var rippleContainer;
@@ -77,13 +73,11 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
setup(function () {
rippleContainer = fixture('TrivialRipple');
ripple = rippleContainer.firstElementChild;
-
- mouseEvent = new FakeMouseEvent(ripple, 10, 10);
});
test('creates a ripple', function () {
expect(ripple.ripples.length).to.be.eql(0);
- ripple.downAction(mouseEvent);
+ MockInteractions.down(ripple);
expect(ripple.ripples.length).to.be.eql(1);
});
@@ -91,18 +85,57 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
expect(ripple.ripples.length).to.be.eql(0);
for (var i = 0; i < 3; ++i) {
- ripple.downAction(mouseEvent);
+ MockInteractions.down(ripple);
expect(ripple.ripples.length).to.be.eql(i + 1);
}
});
});
+ suite('when holdDown is togggled', function() {
+ setup(function () {
+ rippleContainer = fixture('TrivialRipple');
+ ripple = rippleContainer.firstElementChild;
+ });
+
+ test('generates a ripple', function() {
+ ripple.holdDown = true;
+ expect(ripple.ripples.length).to.be.eql(1);
+ });
+
+ test('generates a ripple when noink', function() {
+ ripple.noink = true;
+ ripple.holdDown = true;
+ expect(ripple.ripples.length).to.be.eql(1);
+
+ });
+
+ });
+
+ suite('when target is noink', function () {
+ setup(function () {
+ rippleContainer = fixture('NoinkTarget');
+ ripple = rippleContainer.firstElementChild;
+ });
+
+ test('tapping does not create a ripple', function () {
+ expect(ripple.ripples.length).to.be.eql(0);
+ MockInteractions.down(ripple);
+ expect(ripple.ripples.length).to.be.eql(0);
+ });
+
+ test('ripples can be manually created', function () {
+ expect(ripple.ripples.length).to.be.eql(0);
+ ripple.simulatedRipple()
+ expect(ripple.ripples.length).to.be.eql(1);
+ });
+ });
+
+
+
suite('with the `center` attribute set to true', function () {
setup(function () {
rippleContainer = fixture('CenteringRipple');
ripple = rippleContainer.firstElementChild;
-
- mouseEvent = new FakeMouseEvent(ripple, 10, 10);
});
test('ripples will center', function (done) {
@@ -112,11 +145,11 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
div.style.webkitTransform = 'translate3d(0px, 0px, 0px)';
div.style.transform = 'translate3d(0px, 0px, 0)';
- ripple.downAction(mouseEvent);
+ MockInteractions.down(ripple);
waveContainerElement = ripple.ripples[0].waveContainer;
- ripple.upAction(mouseEvent);
+ MockInteractions.up(ripple);
window.requestAnimationFrame(function () {
var currentTransform = waveContainerElement.style.transform;
@@ -137,15 +170,14 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
setup(function () {
rippleContainer = fixture('RecenteringRipple');
ripple = rippleContainer.firstElementChild;
- mouseEvent = new FakeMouseEvent(ripple, 10, 10);
});
test('ripples will gravitate towards the center', function (done) {
var waveContainerElement;
var waveTranslateString;
- ripple.downAction(mouseEvent);
+ MockInteractions.down(ripple, {x: 10, y: 10});
waveContainerElement = ripple.ripples[0].waveContainer;
waveTranslateString = waveContainerElement.style.transform;
- ripple.upAction(mouseEvent);
+ MockInteractions.up(ripple);
window.requestAnimationFrame(function () {
try {
expect(waveTranslateString).to.be.ok;
« no previous file with comments | « polymer_1.2.3/bower_components/paper-ripple/test/index.html ('k') | polymer_1.2.3/bower_components/paper-spinner/.bower.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698