test(submit): align toast contract with unified media picker

f3fcfe45 moved featured/slide/video cover uploads into the shared
AksrtSubmitMedia picker, which owns the fixed-id load/success/danger
flow under aksrt-front-submit-editor-media-toast, and pay downloads now
only add a success confirmation with the resource-upload id. Update the
contract accordingly: drop the obsolete featured-upload/slide-upload/
video-cover ids and the image/slide/videoToastId variable assertions,
and assert instead that all three cover actions route through
AksrtSubmitMedia.open and that the picker keeps its fixed-id flow.
This commit is contained in:
2026-09-05 18:22:59 +08:00
parent 4f2d17f6ee
commit 9fa7190232
+8 -12
View File
@@ -379,9 +379,6 @@ test('front submit actions use direct fixed-id notyf flows', () => {
'aksrt-front-submit-draft-toast',
'aksrt-front-submit-publish-toast',
'aksrt-front-submit-delete-draft-toast',
'aksrt-front-submit-featured-upload-toast',
'aksrt-front-submit-slide-upload-toast',
'aksrt-front-submit-video-cover-toast',
'aksrt-front-submit-resource-upload-toast',
'aksrt-front-submit-editor-media-toast',
'aksrt-front-submit-ai-tags-toast',
@@ -391,17 +388,16 @@ test('front submit actions use direct fixed-id notyf flows', () => {
assert.match(submit, /submit: function[\s\S]*?notyf\([^;]+?'load'[^;]+?toastId[\s\S]*?notyf\([^;]+?'success'[^;]+?toastId[\s\S]*?notyf\([^;]+?'danger'[^;]+?toastId/);
assert.match(submit, /bindDraftDelete: function[\s\S]*?'aksrt-front-submit-delete-draft-toast'[\s\S]*?'load'[\s\S]*?'success'[\s\S]*?'danger'/);
[
'imageToastId',
'slideToastId',
'videoToastId',
].forEach((variable) => {
assert.match(submit, new RegExp("notyf\\([^;]+?'load'[^;]+?" + variable + "\\);"));
assert.match(submit, new RegExp("notyf\\([^;]+?'success'[^;]+?" + variable + "\\);"));
assert.match(submit, new RegExp("notyf\\([^;]+?'danger'[^;]+?" + variable + "\\);"));
// 封面(单图/多图/视频封面)选择统一走 AksrtSubmitMedia 选择器,
// 上传中的 load/success/danger 通知由选择器以固定 id 独立承载。
['image', 'slide', 'video'].forEach((type) => {
assert.match(submit, new RegExp("act === '" + type + "'[\\s\\S]{0,400}?self\\.openMediaPicker\\("));
});
assert.match(editor, /var toastId = 'aksrt-front-submit-editor-media-toast';/);
assert.match(editor, /notify\([^;]+?'load'[^;]+?toastId\);[\s\S]*?notify\([^;]+?'success'[^;]+?toastId\);[\s\S]*?notify\([^;]+?'danger'[^;]+?toastId\);/);
assert.match(downloads, /aksrt-front-submit-resource-upload-toast[\s\S]*?'load'[\s\S]*?'success'[\s\S]*?'danger'/);
// 付费下载附件选择后仅补一条成功确认,上传过程通知属于选择器。
assert.match(downloads, /AksrtSubmitMedia\.open\([\s\S]*?'success', 5, 'aksrt-front-submit-resource-upload-toast'/);
assert.match(editor, /aksrt-front-submit-editor-media-toast[\s\S]*?'load'[\s\S]*?'success'[\s\S]*?'danger'/);
assert.match(submit, /aksrt-front-submit-ai-tags-toast[\s\S]*?aksrt-front-submit-ai-summary-toast[\s\S]*?'load'[\s\S]*?'success'[\s\S]*?'danger'/);
assert.match(submit, /needContent[^;]+?'warning'/);