|
| 1 | +<!doctype html> |
| 2 | +<html lang="en"> |
| 3 | + <head> |
| 4 | + <meta charset="utf-8"> |
| 5 | + <meta name="viewport" content="width=device-width, minimum-scale=1, initial-scale=1, user-scalable=yes"> |
| 6 | + |
| 7 | + <title>deep-intersection-observer test</title> |
| 8 | + |
| 9 | + <script src="../../webcomponentsjs/webcomponents-lite.js"></script> |
| 10 | + <script src="../../web-component-tester/browser.js"></script> |
| 11 | + |
| 12 | + <link rel="import" href="../deep-intersection-observer.html"> |
| 13 | + </head> |
| 14 | + <body> |
| 15 | + |
| 16 | + <test-fixture id="BasicTestFixture"> |
| 17 | + <template> |
| 18 | + <deep-intersection-observer></deep-intersection-observer> |
| 19 | + </template> |
| 20 | + </test-fixture> |
| 21 | + |
| 22 | + <test-fixture id="ChangedPropertyTestFixture"> |
| 23 | + <template> |
| 24 | + <deep-intersection-observer prop1="new-prop1"></deep-intersection-observer> |
| 25 | + </template> |
| 26 | + </test-fixture> |
| 27 | + |
| 28 | + <script> |
| 29 | + suite('deep-intersection-observer', () => { |
| 30 | + |
| 31 | + test('instantiating the element with default properties works', () => { |
| 32 | + const element = fixture('BasicTestFixture'); |
| 33 | + assert.equal(element.prop1, 'deep-intersection-observer'); |
| 34 | + const elementShadowRoot = element.shadowRoot; |
| 35 | + const elementHeader = elementShadowRoot.querySelector('h2'); |
| 36 | + assert.equal(elementHeader.innerHTML, 'Hello deep-intersection-observer!'); |
| 37 | + }); |
| 38 | + |
| 39 | + test('setting a property on the element works', () => { |
| 40 | + // Create a test fixture |
| 41 | + const element = fixture('ChangedPropertyTestFixture'); |
| 42 | + assert.equal(element.prop1, 'new-prop1'); |
| 43 | + const elementShadowRoot = element.shadowRoot; |
| 44 | + const elementHeader = elementShadowRoot.querySelector('h2'); |
| 45 | + assert.equal(elementHeader.innerHTML, 'Hello new-prop1!'); |
| 46 | + }); |
| 47 | + |
| 48 | + }); |
| 49 | + </script> |
| 50 | + |
| 51 | + </body> |
| 52 | +</html> |
0 commit comments