feat: 更新作业纸 footer
This commit is contained in:
@@ -306,3 +306,64 @@ test('体验版与正式版均校验公开详情,404 和网络故障不能降
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
test('体验/正式版兼容旧接口缺少 rendering,十种纸张保持独立分享、收藏及下载归属', async () => {
|
||||
for (const version of ['trial', 'release']) {
|
||||
const requested = [];
|
||||
const { page, wx, favorites, downloads, toasts } = createPage({
|
||||
getWorksheet: async (id) => {
|
||||
requested.push(id);
|
||||
return { id, path: config.getPublishMetaByMode(id).path };
|
||||
},
|
||||
});
|
||||
wx.getAccountInfoSync = () => ({
|
||||
miniProgram: { envVersion: version },
|
||||
});
|
||||
for (const paper of config.PAPER_TYPE_OPTIONS) {
|
||||
const id = config.getWorksheetIdForPaperType(paper.id);
|
||||
await page.openEntry({ id });
|
||||
assert.equal(page.data.hasContent, true);
|
||||
assert.equal(page.data.selectedPaperType, paper.id);
|
||||
assert.equal(page.data.functionId, id);
|
||||
assert.equal(page.onShareAppMessage().path, `/${route}?id=${id}`);
|
||||
await page.onPreviewFavorite();
|
||||
assert.deepEqual(favorites.at(-1), ['add', id]);
|
||||
await page.exportToPrint();
|
||||
assert.equal(downloads.at(-1).worksheetId, id);
|
||||
}
|
||||
assert.equal(requested.length, 10);
|
||||
assert.equal(
|
||||
toasts.filter((title) => title.includes('配置')).length,
|
||||
0,
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
test('兼容只允许缺省配置,错误路由、空/残缺/冲突配置仍阻止生成', async () => {
|
||||
const path = config.getPublishMetaByMode('paper-mi').path;
|
||||
for (const version of ['trial', 'release']) {
|
||||
for (const remote of [
|
||||
{ path: `/${route}?id=paper-square` },
|
||||
{ path: '/mathPages/mathDraw/mathDraw?id=paper-mi' },
|
||||
{},
|
||||
{ path, rendering: null },
|
||||
{ path, rendering: {} },
|
||||
{ path, rendering: { rendererKey: 'unknown', paperType: 'mi' } },
|
||||
{
|
||||
path,
|
||||
rendering: { rendererKey: 'paper-sheet', paperType: 'square' },
|
||||
},
|
||||
]) {
|
||||
const { page, wx, toasts } = createPage({
|
||||
getWorksheet: async () => remote,
|
||||
});
|
||||
wx.getAccountInfoSync = () => ({
|
||||
miniProgram: { envVersion: version },
|
||||
});
|
||||
await page.onLoad({ id: 'paper-mi' });
|
||||
assert.equal(page.data.hasContent, false);
|
||||
assert.equal(page.data.isWorksheetReady, false);
|
||||
assert.ok(toasts.includes('作业纸配置异常,请稍后重试'));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user