|
173 | 173 | assert.equal(xbooboo.style.fontSize, '32pt'); |
174 | 174 | }); |
175 | 175 |
|
176 | | - |
177 | 176 | test('document.register [created|attached|detached]Callbacks in prototype', function(done) { |
178 | 177 | var ready, inserted, removed; |
179 | 178 | var XBooPrototype = Object.create(HTMLElement.prototype); |
|
243 | 242 | xboo.setAttribute('foo', 'zot'); |
244 | 243 | }); |
245 | 244 |
|
246 | | -test('document.register detachedCallbacks in prototype', function(done) { |
| 245 | + test('document.register attachedCallbacks in prototype', function(done) { |
| 246 | + var inserted = 0; |
| 247 | + var XBooPrototype = Object.create(HTMLElement.prototype); |
| 248 | + XBooPrototype.attachedCallback = function() { |
| 249 | + inserted++; |
| 250 | + }; |
| 251 | + var XBoo = document.registerElement('x-boo-at', { |
| 252 | + prototype: XBooPrototype |
| 253 | + }); |
| 254 | + var xboo = new XBoo(); |
| 255 | + assert.equal(inserted, 0, 'inserted must be 0'); |
| 256 | + work.appendChild(xboo); |
| 257 | + CustomElements.takeRecords(); |
| 258 | + assert.equal(inserted, 1, 'inserted must be 1'); |
| 259 | + work.removeChild(xboo); |
| 260 | + CustomElements.takeRecords(); |
| 261 | + assert(!xboo.parentNode); |
| 262 | + work.appendChild(xboo); |
| 263 | + CustomElements.takeRecords(); |
| 264 | + assert.equal(inserted, 2, 'inserted must be 2'); |
| 265 | + done(); |
| 266 | + }); |
| 267 | + |
| 268 | + test('document.register detachedCallbacks in prototype', function(done) { |
247 | 269 | var ready, inserted, removed; |
248 | 270 | var XBooPrototype = Object.create(HTMLElement.prototype); |
249 | 271 | XBooPrototype.detachedCallback = function() { |
|
0 commit comments