|
| 1 | +<!doctype html> |
| 2 | +<!-- |
| 3 | +@license |
| 4 | +Copyright (c) 2014 The Polymer Project Authors. All rights reserved. |
| 5 | +This code may only be used under the BSD style license found at http://polymer.github.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/CONTRIBUTORS.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/PATENTS.txt |
| 10 | +--> |
| 11 | +<html> |
| 12 | +<head> |
| 13 | + <meta charset="utf-8"> |
| 14 | + <script src="../../../webcomponentsjs/webcomponents-lite.js"></script> |
| 15 | + <script src="../../../web-component-tester/browser.js"></script> |
| 16 | + <link rel="import" href="../../polymer.html"> |
| 17 | + <link rel="import" href="dom-module-elements.html"> |
| 18 | +</head> |
| 19 | +<body> |
| 20 | + |
| 21 | + <dom-module id="foo"> |
| 22 | + <div>foo</div> |
| 23 | + </dom-module> |
| 24 | + |
| 25 | + <script> |
| 26 | + |
| 27 | + suite('dom-module', function() { |
| 28 | + |
| 29 | + test('import dom-module', function() { |
| 30 | + var i = Polymer.DomModule.import('import'); |
| 31 | + assert.ok(i); |
| 32 | + assert.equal(i.textContent, 'import'); |
| 33 | + var i2 = document.createElement('dom-module').import('import'); |
| 34 | + assert.equal(i, i2); |
| 35 | + }); |
| 36 | + |
| 37 | + test('find elements in dom-module', function() { |
| 38 | + var e = Polymer.DomModule.import('element', 'div'); |
| 39 | + assert.ok(e); |
| 40 | + assert.equal(e.textContent, 'element'); |
| 41 | + }); |
| 42 | + |
| 43 | + test('find dom-module in main document', function() { |
| 44 | + var e = Polymer.DomModule.import('foo', 'div'); |
| 45 | + assert.ok(e); |
| 46 | + assert.equal(e.textContent, 'foo'); |
| 47 | + }); |
| 48 | + |
| 49 | + test('import mixed case modules', function() { |
| 50 | + assert.equal(Polymer.DomModule.import('case').textContent, 'case'); |
| 51 | + assert.equal(Polymer.DomModule.import('Case').textContent, 'Case'); |
| 52 | + }); |
| 53 | + |
| 54 | + }); |
| 55 | + |
| 56 | + </script> |
| 57 | + |
| 58 | +</body> |
| 59 | +</html> |
0 commit comments