OLD | NEW |
| (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 <title>core-collapse</title> | |
13 | |
14 <script src="../../../platform/platform.js"></script> | |
15 <script src="../../../polymer-test-tools/chai/chai.js"></script> | |
16 <script src="../../../polymer-test-tools/htmltest.js"></script> | |
17 | |
18 | |
19 <link rel="import" href="../../core-collapse.html"> | |
20 | |
21 </head> | |
22 <body unresolved> | |
23 | |
24 <button onclick="document.querySelector('#collapse').toggle()">toggle collapse
</button> | |
25 | |
26 <core-collapse id="collapse" duration="0.1" opened> | |
27 <div> | |
28 Forma temperiemque cornua sidera dissociata cornua recessit innabilis ligavi
t: solidumque coeptis nullus caelum sponte phoebe di regat mentisque tanta austr
o capacius amphitrite sui quin postquam semina fossae liquidum umor galeae coept
is caligine liberioris quin liquidum matutinis invasit posset: flexi glomeravit
radiis certis invasit oppida postquam onerosior inclusum dominari opifex terris
pace finxit quam aquae nunc sine altae auroram quam habentem homo totidemque scy
thiam in pondus ensis tegit caecoque poena lapidosos humanas coeperunt poena aet
as totidem nec natura aethera locavit caelumque distinxit animalibus phoebe cing
ebant moderantum porrexerat terrae possedit sua sole diu summaque obliquis melio
ris orbem | |
29 </div> | |
30 </core-collapse> | |
31 | |
32 <script> | |
33 | |
34 var delay = 200; | |
35 document.addEventListener('polymer-ready', function() { | |
36 var assert = chai.assert; | |
37 var c = document.querySelector('#collapse'); | |
38 // verify take attribute for opened is correct | |
39 assert.equal(c.opened, true); | |
40 setTimeout(function() { | |
41 // get the height for the opened state | |
42 var h = getCollapseComputedStyle().height; | |
43 // verify the height is not 0px | |
44 assert.notEqual(getCollapseComputedStyle().height, '0px'); | |
45 // close it | |
46 c.opened = false; | |
47 Platform.flush(); | |
48 setTimeout(function() { | |
49 // verify is closed | |
50 assert.notEqual(getCollapseComputedStyle().height, h); | |
51 // open it | |
52 c.opened = true; | |
53 Platform.flush(); | |
54 setTimeout(function() { | |
55 // verify is opened | |
56 assert.equal(getCollapseComputedStyle().height, h); | |
57 done(); | |
58 }, delay); | |
59 }, delay); | |
60 }, delay); | |
61 }); | |
62 | |
63 function getCollapseComputedStyle() { | |
64 var b = document.querySelector('#collapse'); | |
65 return getComputedStyle(b); | |
66 } | |
67 | |
68 </script> | |
69 | |
70 </body> | |
71 </html> | |
OLD | NEW |