Blame view

bower_components/iron-collapse/test/basic.html 3.28 KB
73bcce88   luigser   COMPONENTS
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
  <!doctype html>
  <!--
  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>
  
      <title>iron-collapse-basic</title>
      <meta charset="utf-8">
      <meta name="viewport" content="width=device-width, initial-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>
  
      <link rel="import" href="../../test-fixture/test-fixture.html">
      <link rel="import" href="../iron-collapse.html">
  
    </head>
    <body>
  
      <test-fixture id="test">
        <template>
          <iron-collapse id="collapse" opened>
c5169e0e   Renato De Donato   a new hope
31
32
            <div>
              Forma temperiemque cornua sidera dissociata cornua recessit innabilis ligavit: solidumque coeptis nullus caelum sponte phoebe di regat mentisque tanta austro capacius amphitrite sui quin postquam semina fossae liquidum umor galeae coeptis 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 scythiam in pondus ensis tegit caecoque poena lapidosos humanas coeperunt poena aetas totidem nec natura aethera locavit caelumque distinxit animalibus phoebe cingebant moderantum porrexerat terrae possedit sua sole diu summaque obliquis melioris orbem
73bcce88   luigser   COMPONENTS
33
34
35
36
37
38
39
40
41
42
            </div>
          </iron-collapse>
        </template>
      </test-fixture>
  
      <script>
  
        suite('basic', function() {
  
          var collapse;
c5169e0e   Renato De Donato   a new hope
43
          var delay = 500;
73bcce88   luigser   COMPONENTS
44
45
          var collapseHeight;
  
c5169e0e   Renato De Donato   a new hope
46
          setup(function () {
73bcce88   luigser   COMPONENTS
47
            collapse = fixture('test');
73bcce88   luigser   COMPONENTS
48
49
50
51
52
53
          });
  
          test('opened attribute', function() {
            assert.equal(collapse.opened, true);
          });
  
73bcce88   luigser   COMPONENTS
54
55
56
57
          test('horizontal attribute', function() {
            assert.equal(collapse.horizontal, false);
          });
  
c5169e0e   Renato De Donato   a new hope
58
59
60
61
62
63
64
65
          test('default opened height', function(done) {
            setTimeout(function() {
              // store height
              collapseHeight = getComputedStyle(collapse).height;
              // verify height not 0px
              assert.notEqual(collapseHeight, '0px');
              done();
            }, delay);
73bcce88   luigser   COMPONENTS
66
67
          });
  
c5169e0e   Renato De Donato   a new hope
68
          test('set opened to false', function(done) {
73bcce88   luigser   COMPONENTS
69
            collapse.opened = false;
c5169e0e   Renato De Donato   a new hope
70
71
72
73
            setTimeout(function() {
              var h = getComputedStyle(collapse).height;
              // verify height is 0px
              assert.equal(h, '0px');
73bcce88   luigser   COMPONENTS
74
              done();
c5169e0e   Renato De Donato   a new hope
75
            }, delay);
73bcce88   luigser   COMPONENTS
76
77
          });
  
c5169e0e   Renato De Donato   a new hope
78
79
80
81
82
83
84
85
          test('set opened to true', function(done) {
            collapse.opened = true;
            setTimeout(function() {
              var h = getComputedStyle(collapse).height;
              // verify height
              assert.equal(h, collapseHeight);
              done();
            }, delay);
73bcce88   luigser   COMPONENTS
86
87
88
89
90
91
92
93
          });
  
        });
  
      </script>
  
    </body>
  </html>