|
|
|
|
@ -59,9 +59,8 @@ $assert(str_contains($javascript, "activeTab: 'page'")
|
|
|
|
|
&& str_contains($javascript, "query.set('per_page', '100')")
|
|
|
|
|
&& str_contains($javascript, "query.set('q', requestedQuery)")
|
|
|
|
|
&& str_contains($javascript, "document.querySelectorAll('[data-user-copy-key]')")
|
|
|
|
|
&& str_contains($javascript, "state.bindings.has(String(entry.key || ''))")
|
|
|
|
|
&& str_contains($javascript, "entry.editor_surface !== 'page'")
|
|
|
|
|
&& str_contains($javascript, "entry.editor_surface !== 'shared'")
|
|
|
|
|
&& str_contains($javascript, "entry.editor_surface === 'page'")
|
|
|
|
|
&& str_contains($javascript, "entry.editor_surface === 'shared'")
|
|
|
|
|
&& str_contains($javascript,
|
|
|
|
|
"sharedGroups.has(String(entry.editor_group || ''))")
|
|
|
|
|
&& str_contains($javascript, "'/admin/user-copy/entries/'")
|
|
|
|
|
@ -71,6 +70,47 @@ $assert(str_contains($javascript, "activeTab: 'page'")
|
|
|
|
|
&& str_contains($javascript, 'hidden: false')
|
|
|
|
|
&& substr_count($javascript, 'transport.mutate(') === 1,
|
|
|
|
|
'The page editor does not use constrained page/shared workspaces and draft-only mutation.');
|
|
|
|
|
$visibleEntriesStart = strpos($javascript, 'function visibleEntries()');
|
|
|
|
|
$visibleEntriesEnd = strpos(
|
|
|
|
|
$javascript,
|
|
|
|
|
'function paginationFor(',
|
|
|
|
|
$visibleEntriesStart
|
|
|
|
|
);
|
|
|
|
|
$visibleEntriesBody = substr(
|
|
|
|
|
$javascript,
|
|
|
|
|
$visibleEntriesStart,
|
|
|
|
|
$visibleEntriesEnd - $visibleEntriesStart
|
|
|
|
|
);
|
|
|
|
|
$renderEntryStart = strpos($javascript, 'function renderEntry(');
|
|
|
|
|
$renderEntryEnd = strpos($javascript, 'function renderEntries(', $renderEntryStart);
|
|
|
|
|
$renderEntryBody = substr(
|
|
|
|
|
$javascript,
|
|
|
|
|
$renderEntryStart,
|
|
|
|
|
$renderEntryEnd - $renderEntryStart
|
|
|
|
|
);
|
|
|
|
|
$assert(!str_contains(
|
|
|
|
|
$visibleEntriesBody,
|
|
|
|
|
"if (!state.bindings.has(String(entry.key || ''))) return false;"
|
|
|
|
|
)
|
|
|
|
|
&& str_contains($visibleEntriesBody, "state.activeTab === 'page'")
|
|
|
|
|
&& str_contains($visibleEntriesBody, "entry.editor_surface === 'page'")
|
|
|
|
|
&& str_contains($visibleEntriesBody, "entry.editor_surface === 'shared'")
|
|
|
|
|
&& str_contains(
|
|
|
|
|
$visibleEntriesBody,
|
|
|
|
|
"&& state.bindings.has(String(entry.key || ''))"
|
|
|
|
|
),
|
|
|
|
|
'Unbound page copy is hidden instead of limiting DOM bindings to shared copy.');
|
|
|
|
|
$assert(str_contains(
|
|
|
|
|
$renderEntryBody,
|
|
|
|
|
"state.bindings.has(String(entry.key || ''))"
|
|
|
|
|
)
|
|
|
|
|
&& str_contains($renderEntryBody, 'if (bound)')
|
|
|
|
|
&& str_contains($renderEntryBody, 'meta.append(locateButton)')
|
|
|
|
|
&& str_contains($renderEntryBody, "textarea.addEventListener('input'")
|
|
|
|
|
&& str_contains($renderEntryBody, 'card.append(save)'),
|
|
|
|
|
'Unbound page copy cannot stay editable while omitting its locate action.');
|
|
|
|
|
$assert(!str_contains($javascript, 'if (state.bindings.size === 0) return;'),
|
|
|
|
|
'A mapped page without DOM bindings cannot open its page-copy catalog.');
|
|
|
|
|
$assert(str_contains($javascript, 'reads: {')
|
|
|
|
|
&& str_contains($javascript, 'new AbortController()')
|
|
|
|
|
&& str_contains($javascript, '{ signal: controller.signal }')
|
|
|
|
|
@ -158,13 +198,17 @@ $assert(str_contains($javascript,
|
|
|
|
|
&& str_contains($javascript,
|
|
|
|
|
"if (requestedLocale && requestedLocale !== 'zh-CN')"),
|
|
|
|
|
'The first page-editor locale does not follow the non-Chinese runtime locale.');
|
|
|
|
|
$assert(str_contains($javascript,
|
|
|
|
|
'草稿已保存,但最新状态读取失败,请刷新页面核对。')
|
|
|
|
|
&& preg_match(
|
|
|
|
|
'/catch \(error\) \{\s*button\.disabled = true;\s*textarea\.readOnly = true;/s',
|
|
|
|
|
$javascript
|
|
|
|
|
$assert(str_contains($saveBody,
|
|
|
|
|
"if (!saved || typeof saved.version !== 'number')")
|
|
|
|
|
&& str_contains($saveBody,
|
|
|
|
|
'草稿可能已保存,但响应协议无效,请刷新页面核对;请勿重复提交。')
|
|
|
|
|
&& str_contains($saveBody, 'entry.draft = saved')
|
|
|
|
|
&& str_contains($saveBody, 'entry.draft_version = saved.version')
|
|
|
|
|
&& substr_count(
|
|
|
|
|
$saveBody,
|
|
|
|
|
'loadWorkspace(state.activeTab, state.locale)'
|
|
|
|
|
) === 1,
|
|
|
|
|
'A confirmed draft save can be mistaken for a retryable mutation when refresh fails.');
|
|
|
|
|
'A confirmed draft save resets pagination or accepts an invalid receipt.');
|
|
|
|
|
$assert(str_contains($javascript,
|
|
|
|
|
"saved = result && result.entry ? result.entry : null")
|
|
|
|
|
&& str_contains($javascript,
|
|
|
|
|
|