|
15 | 15 | <script src="../../web-component-tester/browser.js"></script>
|
16 | 16 | <script src="../test-fixture-mocha.js"></script>
|
17 | 17 |
|
18 |
| - <link rel="import" href="../../polymer/polymer.html"> |
19 | 18 | <link rel="import" href="../test-fixture.html">
|
20 | 19 | </head>
|
21 | 20 | <body>
|
| 21 | + <script> |
| 22 | + (function() { |
| 23 | + var proto = Object.create(HTMLElement.prototype); |
| 24 | + |
| 25 | + proto.onDetached = function() {}; |
| 26 | + |
| 27 | + proto.detachedCallback = function() { |
| 28 | + this.onDetached(); |
| 29 | + }; |
| 30 | + |
| 31 | + document.registerElement('x-custom', { |
| 32 | + prototype: proto |
| 33 | + }); |
| 34 | + })(); |
| 35 | + </script> |
22 | 36 | <test-fixture id="TrivialFixture">
|
23 | 37 | <template>
|
24 | 38 | <div id="Foo"></div>
|
|
41 | 55 | <div id="QuxSibling"></div>
|
42 | 56 | </template>
|
43 | 57 | </test-fixture>
|
| 58 | + <test-fixture id="AttachedFixture"> |
| 59 | + <template> |
| 60 | + <x-custom></x-custom> |
| 61 | + </template> |
| 62 | + </test-fixture> |
44 | 63 | <script>
|
45 | 64 | describe('<test-fixture>', function () {
|
46 | 65 | var trivialFixture;
|
|
59 | 78 | multiTemplateFixture.restore();
|
60 | 79 | });
|
61 | 80 |
|
| 81 | + describe('an stamped-out fixture', function () { |
| 82 | + var attachedFixture; |
| 83 | + var element; |
| 84 | + |
| 85 | + beforeEach(function () { |
| 86 | + attachedFixture = document.getElementById('AttachedFixture'); |
| 87 | + element = attachedFixture.create(); |
| 88 | + }); |
| 89 | + |
| 90 | + afterEach(function () { |
| 91 | + attachedFixture.restore(); |
| 92 | + }); |
| 93 | + |
| 94 | + // TODO(cdata): Make this test pass somehow. Currently it fails in |
| 95 | + // not-Chrome due to an implementation detail of the Web Components |
| 96 | + // polyfill. |
| 97 | + xit('detaches the fixtured DOM when it is restored', function () { |
| 98 | + var detached = false; |
| 99 | + |
| 100 | + element.onDetached = function () { |
| 101 | + detached = true; |
| 102 | + }; |
| 103 | + |
| 104 | + attachedFixture.restore(); |
| 105 | + expect(detached).to.be.eql(true); |
| 106 | + }); |
| 107 | + }); |
| 108 | + |
62 | 109 | describe('when create is called', function () {
|
63 | 110 | var el;
|
64 | 111 |
|
|
0 commit comments