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

Side by Side Diff: lib/src/paper-tooltip/test/basic.html

Issue 1418513006: update elements and fix some bugs (Closed) Base URL: git@github.com:dart-lang/polymer_elements.git@master
Patch Set: code review updates Created 5 years, 1 month 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
« no previous file with comments | « lib/src/paper-tooltip/paper-tooltip.html ('k') | lib/src/paper-tooltip/test/test-button.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 <!doctype html> 1 <!doctype html>
2 <!-- 2 <!--
3 @license 3 @license
4 Copyright (c) 2015 The Polymer Project Authors. All rights reserved. 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 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 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 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 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 9 subject to an additional IP rights grant found at http://polymer.github.io/PATEN TS.txt
10 --> 10 -->
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 } 44 }
45 45
46 </style> 46 </style>
47 47
48 <body> 48 <body>
49 49
50 <test-fixture id="basic"> 50 <test-fixture id="basic">
51 <template> 51 <template>
52 <div> 52 <div>
53 <div id="target"></div> 53 <div id="target"></div>
54 <paper-tooltip for="target">Tooltip text</paper-tooltip> 54 <paper-tooltip for="target" animation-delay="0">Tooltip text</paper-tool tip>
55 </div> 55 </div>
56 </template> 56 </template>
57 </test-fixture> 57 </test-fixture>
58 58
59 <test-fixture id="fitted"> 59 <test-fixture id="fitted">
60 <template> 60 <template>
61 <div> 61 <div>
62 <div id="target" style="position:absolute"></div> 62 <div id="target" style="position:absolute"></div>
63 <paper-tooltip for="target" class="wide" fit-to-visible-bounds>Tooltip t ext</paper-tooltip> 63 <paper-tooltip for="target" class="wide" fit-to-visible-bounds>Tooltip t ext</paper-tooltip>
64 </div> 64 </div>
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
299 expect(contentRect.top).to.be.equal(20 + 14); 299 expect(contentRect.top).to.be.equal(20 + 14);
300 }); 300 });
301 301
302 test('tooltip is hidden after target is blurred', function(done) { 302 test('tooltip is hidden after target is blurred', function(done) {
303 var f = fixture('basic'); 303 var f = fixture('basic');
304 var target = f.querySelector('#target'); 304 var target = f.querySelector('#target');
305 var tooltip = f.querySelector('paper-tooltip'); 305 var tooltip = f.querySelector('paper-tooltip');
306 306
307 var actualTooltip = Polymer.dom(tooltip.root).querySelector('#tooltip'); 307 var actualTooltip = Polymer.dom(tooltip.root).querySelector('#tooltip');
308 assert.isTrue(isHidden(actualTooltip)); 308 assert.isTrue(isHidden(actualTooltip));
309 MockInteractions.focus(target); 309 // Simulate but don't actually run the entry animation.
310 tooltip.toggleClass('hidden', false, actualTooltip);
311 tooltip._showing = true;
310 assert.isFalse(isHidden(actualTooltip)); 312 assert.isFalse(isHidden(actualTooltip));
311 313
312 tooltip.addEventListener('neon-animation-finish', function() { 314 tooltip.addEventListener('neon-animation-finish', function() {
313 assert.isTrue(isHidden(actualTooltip)); 315 assert.isTrue(isHidden(actualTooltip));
314 done(); 316 done();
315 }); 317 });
316 MockInteractions.blur(target); 318 MockInteractions.blur(target);
317 }); 319 });
318 320
319 test('tooltip unlistens to target on detach', function(done) { 321 test('tooltip unlistens to target on detach', function(done) {
(...skipping 19 matching lines...) Expand all
339 }, 200); 341 }, 200);
340 }); 342 });
341 }); 343 });
342 344
343 suite('tooltip is inside a custom element', function() { 345 suite('tooltip is inside a custom element', function() {
344 var f, tooltip, target; 346 var f, tooltip, target;
345 347
346 setup(function() { 348 setup(function() {
347 f = fixture('custom'); 349 f = fixture('custom');
348 target = f.$.button; 350 target = f.$.button;
349 tooltip = f.$.tooltip; 351 tooltip = f.$.buttonTooltip;
350 }); 352 });
351 353
352 test('tooltip is shown when target is focused', function() { 354 test('tooltip is shown when target is focused', function() {
353 var actualTooltip = Polymer.dom(tooltip.root).querySelector('#tooltip'); 355 var actualTooltip = Polymer.dom(tooltip.root).querySelector('#tooltip');
354 assert.isTrue(isHidden(actualTooltip)); 356 assert.isTrue(isHidden(actualTooltip));
355 357
356 MockInteractions.focus(target); 358 MockInteractions.focus(target);
357 assert.isFalse(isHidden(actualTooltip)); 359 assert.isFalse(isHidden(actualTooltip));
358 }); 360 });
359 361
(...skipping 24 matching lines...) Expand all
384 }); 386 });
385 }); 387 });
386 388
387 suite('a11y', function() { 389 suite('a11y', function() {
388 test('has aria role "tooltip"', function() { 390 test('has aria role "tooltip"', function() {
389 var f = fixture('basic'); 391 var f = fixture('basic');
390 var tooltip = f.querySelector('paper-tooltip'); 392 var tooltip = f.querySelector('paper-tooltip');
391 393
392 assert.isTrue(tooltip.getAttribute('role') == 'tooltip'); 394 assert.isTrue(tooltip.getAttribute('role') == 'tooltip');
393 }); 395 });
396
397 a11ySuite('basic');
398 a11ySuite('fitted');
399 a11ySuite('no-text');
400 a11ySuite('dynamic');
401 a11ySuite('custom');
394 }); 402 });
395 </script> 403 </script>
396 </body> 404 </body>
397 </html> 405 </html>
OLDNEW
« no previous file with comments | « lib/src/paper-tooltip/paper-tooltip.html ('k') | lib/src/paper-tooltip/test/test-button.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698