/);
assert.doesNotMatch(result.html, //);
// Non-Plaza actions must remain available to visitors.
assert.match(result.html, /data-action="capture"/);
assert.match(result.html, /data-action="share"/);
assert.match(result.html, /公开分享/);
assert.equal(result.scriptHashes.length, 1);
});
test('injectPublicFileShareButton upgrades stale baked widget markup', () => {
const stale = injectPublicFileShareButton('
Hi ', {
isOwner: false,
}).html;
const upgraded = injectPublicFileShareButton(stale, { isOwner: true });
assert.match(upgraded.html, /data-action="wechat-draft"/);
assert.match(upgraded.html, /data-is-owner="true"/);
assert.match(upgraded.html, /data-action="plaza"/);
assert.doesNotMatch(upgraded.html, /data-is-owner="false"/);
assert.equal(upgraded.scriptHashes.length, 1);
});
test('injectPublicFileShareButton keeps Plaza entry when isOwner explicitly true', () => {
const result = injectPublicFileShareButton(
'Hi ',
{ isOwner: true },
);
assert.match(result.html, /data-action="plaza"/);
assert.match(result.html, /data-mindspace-public-share-dialog/);
});
test('stripPublicFileShareWidget removes injected share chrome', () => {
const injected = injectPublicFileShareButton('Hi ');
const stripped = stripPublicFileShareWidget(injected.html);
assert.doesNotMatch(stripped, /data-mindspace-public-share/);
assert.doesNotMatch(stripped, /公众号/);
assert.doesNotMatch(stripped, /保存长图/);
});