| Index: polymer_1.0.4/bower_components/paper-tooltip/test/basic.html
|
| diff --git a/polymer_1.0.4/bower_components/paper-tooltip/test/basic.html b/polymer_1.0.4/bower_components/paper-tooltip/test/basic.html
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..4cf85311e10b25548e8879565d74fba5a22fb26a
|
| --- /dev/null
|
| +++ b/polymer_1.0.4/bower_components/paper-tooltip/test/basic.html
|
| @@ -0,0 +1,98 @@
|
| +<!doctype html>
|
| +<!--
|
| +@license
|
| +Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
|
| +This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
|
| +The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
|
| +The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
|
| +Code distributed by Google as part of the polymer project is also
|
| +subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
|
| +-->
|
| +<html>
|
| +<head>
|
| + <meta charset="UTF-8">
|
| + <title>paper-tooltip tests</title>
|
| + <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
|
| +
|
| + <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-tooltip.html">
|
| +
|
| +</head>
|
| +<body>
|
| +
|
| + <test-fixture id="basic">
|
| + <template>
|
| + <div>
|
| + <div id="target"></div>
|
| + <paper-tooltip for="target">Tooltip text</paper-tooltip>
|
| + </div>
|
| + </template>
|
| + </test-fixture>
|
| +
|
| + <script>
|
| + suite('basic', function() {
|
| + var f, tooltip, target;
|
| +
|
| + setup(function() {
|
| + f = fixture('basic');
|
| + target = f.querySelector('#target');
|
| + tooltip = f.querySelector('paper-tooltip');
|
| + });
|
| +
|
| + test('tooltip is shown when target is focused', function() {
|
| + var actualTooltip = Polymer.dom(tooltip.root).querySelector('#tooltip');
|
| + assert.isTrue(actualTooltip.hidden);
|
| +
|
| + MockInteractions.focus(target);
|
| + assert.isFalse(actualTooltip.hidden);
|
| + });
|
| +
|
| + test('tooltip is hidden after target is blurred', function(done) {
|
| + var actualTooltip = Polymer.dom(tooltip.root).querySelector('#tooltip');
|
| + assert.isTrue(actualTooltip.hidden);
|
| + MockInteractions.focus(target);
|
| + assert.isFalse(actualTooltip.hidden);
|
| +
|
| + tooltip.addEventListener('neon-animation-finish', function() {
|
| + assert.isTrue(actualTooltip.hidden);
|
| + done();
|
| + });
|
| + MockInteractions.blur(target);
|
| + });
|
| +
|
| + test('tooltip unlistens to target on detach', function(done) {
|
| + sinon.spy(tooltip, 'show');
|
| +
|
| + MockInteractions.focus(target);
|
| + expect(tooltip.show.callCount).to.be.equal(1);
|
| +
|
| + MockInteractions.focus(target);
|
| + expect(tooltip.show.callCount).to.be.equal(2);
|
| +
|
| + f.removeChild(tooltip);
|
| +
|
| + setTimeout(function() {
|
| + // No more listener means no more calling show.
|
| + MockInteractions.focus(target);
|
| + expect(tooltip.show.callCount).to.be.equal(2);
|
| + done();
|
| + }, 200);
|
| + });
|
| + });
|
| +
|
| + suite('a11y', function() {
|
| + test('has aria role "tooltip"', function() {
|
| + var f = fixture('basic');
|
| + var tooltip = f.querySelector('paper-tooltip');
|
| +
|
| + assert.isTrue(tooltip.getAttribute('role') == 'tooltip');
|
| + });
|
| + });
|
| + </script>
|
| +</body>
|
| +</html>
|
|
|