fix(page-data): trust live API smoke and WeChat survey submit compat
Stop blocking WeChat delivery when Page Data insert works but publish quota blocks h5_publish_records; fix smoke URL missing /api; patch survey radios for WeChat X5 and detect dataset constants in admin pages. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
import assert from 'node:assert/strict';
|
||||
import test from 'node:test';
|
||||
import {
|
||||
applyWechatSurveyCompat,
|
||||
htmlNeedsWechatSurveyCompat,
|
||||
} from './mindspace-page-data-wechat-survey-compat.mjs';
|
||||
|
||||
const SURVEY_HTML = `<!doctype html><html><head><style>
|
||||
.genre-option input { position: absolute; opacity: 0; pointer-events: none; }
|
||||
</style>
|
||||
<script src="/assets/page-data-client.js"></script></head><body>
|
||||
<script>MindSpacePageData.createClient({ apiBase: '/api' }).insertRow('reading_survey', {});</script>
|
||||
</body></html>`;
|
||||
|
||||
test('htmlNeedsWechatSurveyCompat detects pointer-events none on survey radios', () => {
|
||||
assert.equal(htmlNeedsWechatSurveyCompat(SURVEY_HTML), true);
|
||||
assert.equal(htmlNeedsWechatSurveyCompat('<html><body>plain</body></html>'), false);
|
||||
});
|
||||
|
||||
test('applyWechatSurveyCompat removes pointer-events none from radio inputs', () => {
|
||||
const result = applyWechatSurveyCompat(SURVEY_HTML);
|
||||
assert.equal(result.patched, true);
|
||||
assert.doesNotMatch(result.html, /\.genre-option\s+input\s*\{[^}]*pointer-events\s*:\s*none/i);
|
||||
assert.match(result.html, /mindspace-wechat-survey-compat/);
|
||||
assert.match(result.html, /z-index:\s*2/);
|
||||
});
|
||||
Reference in New Issue
Block a user