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