| OLD | NEW |
| (Empty) | |
| 1 <!doctype html> |
| 2 <!-- |
| 3 @license |
| 4 Copyright (c) 2016 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 |
| 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 |
| 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 |
| 10 --> |
| 11 <html> |
| 12 <head> |
| 13 <title>Integration Test</title> |
| 14 <script src="../webcomponents-loader.js"></script> |
| 15 <script src="../../web-component-tester/browser.js"></script> |
| 16 <link rel="import" href="imports/simple-element.html"> |
| 17 </head> |
| 18 <body> |
| 19 |
| 20 <!-- Don't break this into multiple lines or you'll have to count text nodes
--> |
| 21 <simple-element id="basic"><span>Light DOM</span></simple-element> |
| 22 |
| 23 <script> |
| 24 suite('integration', function() { |
| 25 var el; |
| 26 |
| 27 setup(function() { |
| 28 el = document.querySelector('#basic'); |
| 29 }); |
| 30 |
| 31 test('element is imported & upgraded', function() { |
| 32 assert.equal(el.bestName, 'batman', |
| 33 'doesn\'t have property set in constructor'); |
| 34 }); |
| 35 |
| 36 test('element has shadow DOM content', function() { |
| 37 var shadowRoot = el.shadowRoot; |
| 38 |
| 39 assert.ok(shadowRoot, 'does not have a shadow root'); |
| 40 assert.equal(shadowRoot.querySelector('p').textContent, 'Shadow DOM', |
| 41 'does not have <p> in the shadow dom'); |
| 42 assert.equal(getComputedStyle(shadowRoot.querySelector('p')).color, 'r
gb(255, 0, 0)', |
| 43 'does not style <p> in the shadow dom'); |
| 44 }); |
| 45 |
| 46 test('element has distributed content', function() { |
| 47 var slot = el.shadowRoot.querySelector('slot'); |
| 48 assert.ok(slot, 'does not have a slot'); |
| 49 |
| 50 var distributedNodes = slot.assignedNodes() |
| 51 assert.equal(distributedNodes.length, 1, |
| 52 'does not have exactly one element distributed'); |
| 53 assert.equal(distributedNodes[0].textContent, 'Light DOM', |
| 54 'does not have the right content distributed'); |
| 55 assert.equal(getComputedStyle(distributedNodes[0]).color, 'rgb(0, 0, 2
55)', |
| 56 'does not style light dom'); |
| 57 }); |
| 58 }); |
| 59 </script> |
| 60 </body> |
| 61 </html> |
| OLD | NEW |