Blame view

bower_components/iron-doc-viewer/test/iron-doc-viewer.html 3.66 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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
  <!--
  @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
  -->
  <!doctype html>
  <html>
    <head>
      <meta charset="utf-8">
      <meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1.0, user-scalable=yes">
      <title>Tests</title>
  
      <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="../../polymer/polymer.html">
      <link rel="import" href="../../test-fixture/test-fixture.html">
  
      <link rel="import" href="../iron-doc-viewer.html">
    </head>
    <body>
  
      <iron-doc-viewer>
        {
          "is": "awesome-sauce",
          "properties": [
            {"name": "isAwesome", "type": "boolean", "desc": "Is it awesome?"}
          ]
        }
      </iron-doc-viewer>
  
      <test-fixture id="bound">
        <template is="dom-template">
          <iron-doc-viewer descriptor="{{descriptor}}" bound></iron-doc-viewer>
        </template>
      </test-fixture>
  
      <test-fixture id="json">
        <template is="dom-template">
          <iron-doc-viewer json>
            {
              "is": "awesome-sauce",
              "properties": [
                {"name": "isAwesome", "type": "boolean", "desc": "Is it awesome?"}
              ]
            }
          </iron-doc-viewer>
        </template>
      </test-fixture>
  
      <test-fixture id="json-and-bound">
        <template is="dom-template">
          <iron-doc-viewer descriptor="{{descriptor}}" jsonbound>
            {
              "is": "awesome-sauce",
              "properties": [
                {"name": "isAwesome", "type": "boolean", "desc": "Is it awesome?"}
              ]
            }
          </iron-doc-viewer>
        </template>
      </test-fixture>
  
      <script>
  
        var ELEMENT = {
          "is": "awesome-sauce",
          "properties": [
            {"name": "isAwesome", "type": "boolean", "desc": "Is it awesome?"},
          ]
        };
  
        describe('<iron-doc-viewer>', function() {
  
          var page;
          afterEach(function() {
            page = null; // Make sure that we don't reuse another test's element.
          });
  
          describe('with a bound descriptor', function() {
  
            beforeEach(function() { page = fixture('bound', {descriptor: ELEMENT}); });
  
            it('loads the descriptor', function() {
              expect(page.descriptor.is).to.eq('awesome-sauce');
              expect(page.descriptor.properties.length).to.eq(1);
            });
  
          });
  
          describe('with a JSON descriptor', function() {
  
            beforeEach(function() { page = fixture('json'); });
  
            it('loads the descriptor', function() {
              expect(page.descriptor.is).to.eq('awesome-sauce');
              expect(page.descriptor.properties.length).to.eq(1);
            });
  
          });
  
          describe('edge cases', function() {
  
e619a3b0   Luigi Serra   Controllet cross ...
109
110
111
112
113
114
          //   // TODO(nevir): Cannot enable until https://github.com/Polymer/polymer/issues/1200
          //   it.skip('throws when a bound and JSON descriptor are provided', function() {
          //     expect(function() {
          //       fixture('json-and-bound', {descriptor: ELEMENT});
          //     }).to.throw(Error, /descriptor/i);
          //   });
73bcce88   luigser   COMPONENTS
115
116
117
118
119
120
121
122
123
  
          });
  
        });
  
      </script>
  
    </body>
  </html>