fix(ads): [PKG-ADS-05] preserve ownership and verify native browser lifecycle

This commit is contained in:
Harvey Zhao committed 2026-09-12 08:52:51 +08:00
1 parent fb1cfa701d
commit 29692d2815
22 files changed
+1060 -29

No files matched your search

+11
View File
@@ -10,6 +10,17 @@ const skips = host => host.calls.filter(call => call[0] === 'emit' && call[1] ==
const contentPlays = host => host.calls.filter(call => call[0] === 'content.play')
for (const { name, factory } of implementations) {
test(`${name}: destroy before initialization preserves caller-owned undefined template property`, (t) => {
const env = adsEnvironment(t)
const host = env.host()
Object.defineProperty(host.art.template, '$ads', { configurable: true, enumerable: true, writable: true, value: undefined })
const before = Object.getOwnPropertyDescriptor(host.art.template, '$ads')
factory({ html: 'ad' })(host.art)
host.art.destroy()
assert.deepEqual(Object.getOwnPropertyDescriptor(host.art.template, '$ads'), before)
assert.equal(env.timers.size, 0)
})
test(`${name}: repeated play owns one timer and pause clears all countdown work`, (t) => {
const env = adsEnvironment(t)
const host = env.host()