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

Side by Side Diff: polymer_0.5.4/bower_components/paper-button/test/paper-button.html

Issue 895523005: Added Polymer 0.5.4 (Closed) Base URL: https://chromium.googlesource.com/infra/third_party/npm_modules.git@master
Patch Set: Created 5 years, 10 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) 2014 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 <meta charset="UTF-8">
13 <title>paper-button basic tests</title>
14 <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum- scale=1.0">
15
16 <script src="../../webcomponentsjs/webcomponents.js"></script>
17 <script src="../../web-component-tester/browser.js"></script>
18 <script src="../../polymer-gestures/test/js/fake.js"></script>
19
20 <link href="../paper-button.html" rel="import">
21
22 </head>
23 <body>
24
25 <paper-button id="button1">button</paper-button>
26
27 <paper-button id="button2">button</paper-button>
28
29 <paper-button id="disabled" disabled>disabled</paper-button>
30
31 <script>
32
33 var fake = new Fake();
34
35 var b1 = document.getElementById('button1');
36
37 test('can set raised imperatively', function(done) {
38 assert.ok(!b1.shadowRoot.querySelector('paper-shadow'));
39 b1.raised = true;
40 flush(function() {
41 setTimeout(function() {
42 var shadow = b1.shadowRoot.querySelector('paper-shadow');
43 assert.ok(shadow);
44 done();
45 }, 600);
46 });
47 });
48
49 test('can set noink dynamically', function(done) {
50 var button = document.getElementById('button2');
51 button.lastEvent = {x: 100, y: 100};
52 button.$.ripple = {
53 downAction: function() {
54 assert.ok(false);
55 },
56 upAction: function() {
57 assert.ok(false);
58 }
59 };
60 button.setAttribute('noink', '');
61 fake.downOnNode(button);
62 fake.upOnNode(button);
63 // would throw if it tries to ripple
64 setTimeout(done, 10);
65 });
66
67 suite('a11y', function() {
68
69 test('aria role is a button', function() {
70 assert.strictEqual('button', b1.getAttribute('role'));
71 });
72
73 test('aria-disabled is set', function(done) {
74 var button = document.getElementById('disabled');
75 assert.ok(button.hasAttribute('aria-disabled'));
76 button.removeAttribute('disabled');
77 flush(function() {
78 assert.ok(!button.hasAttribute('aria-disabled'));
79 done();
80 });
81 });
82
83 test('space triggers the button', function() {
84 var ev = new CustomEvent('keydown', {detail: {key: 'space'}});
85 var sawClick = false;
86 function clickListener() {
87 sawClick = true;
88 }
89 b1.addEventListener('click', clickListener);
90 b1.dispatchEvent(ev);
91 assert.ok(sawClick);
92 b1.removeEventListener(clickListener);
93 });
94
95 test('enter triggers the button', function() {
96 var ev = new CustomEvent('keydown', {detail: {key: 'enter'}});
97 var sawClick = false;
98 function clickListener() {
99 sawClick = true;
100 }
101 b1.addEventListener('click', clickListener);
102 b1.dispatchEvent(ev);
103 assert.ok(sawClick);
104 b1.removeEventListener(clickListener);
105 });
106
107 });
108
109 </script>
110
111 </body>
112 </html>
OLDNEW
« no previous file with comments | « polymer_0.5.4/bower_components/paper-button/test/index.html ('k') | polymer_0.5.4/bower_components/paper-checkbox/.bower.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698