feat: 增加下载任务中心与断点续传
This commit is contained in:
+24
-1
@@ -165,9 +165,32 @@ test('书库页提供可管理标签目录和整理多选下拉', () => {
|
||||
assert.doesNotMatch(library, /id="libraryBookTags" type="text"/);
|
||||
});
|
||||
|
||||
test('下载区展示进度且完成按钮使用高对比绿色底色', () => {
|
||||
test('下载区接入全局任务中心且完成按钮使用高对比绿色底色', () => {
|
||||
const html = fs.readFileSync(path.join(__dirname, '..', 'ui', 'index.html'), 'utf8');
|
||||
const browse = fs.readFileSync(path.join(__dirname, '..', 'ui', 'views', 'browse.js'), 'utf8');
|
||||
const center = fs.readFileSync(path.join(__dirname, '..', 'ui', 'download-center.js'), 'utf8');
|
||||
const preload = fs.readFileSync(path.join(__dirname, '..', '..', 'preload.js'), 'utf8');
|
||||
const app = fs.readFileSync(path.join(__dirname, '..', 'ui', 'app.js'), 'utf8');
|
||||
const css = fs.readFileSync(path.join(__dirname, '..', 'ui', 'style.css'), 'utf8');
|
||||
assert.match(html, /id="taskCenterBtn"/);
|
||||
assert.match(html, /id="taskCenterPanel"/);
|
||||
assert.ok(html.indexOf('download-center.js') < html.indexOf('views/browse.js'));
|
||||
assert.match(app, /DownloadCenter\.init\(\)/);
|
||||
assert.match(browse, /window\.DownloadCenter\.start\(\{/);
|
||||
assert.doesNotMatch(browse, /await window\.api\.downloadFile/);
|
||||
assert.match(center, /window\.api\.downloads\.run\(/);
|
||||
assert.match(center, /window\.api\.downloads\.pause\(/);
|
||||
assert.match(center, /window\.api\.downloads\.delete\(/);
|
||||
assert.match(center, /data-task-action="pause"/);
|
||||
assert.match(center, /data-task-action="resume"/);
|
||||
assert.match(center, /data-task-action="delete"/);
|
||||
assert.match(preload, /pause:\s*\(requestId\)\s*=>\s*ipcRenderer\.invoke\('download:pause'/);
|
||||
assert.match(preload, /delete:\s*\(requestId\)\s*=>\s*ipcRenderer\.invoke\('download:delete'/);
|
||||
assert.match(center, /task\.status = 'complete'/);
|
||||
assert.match(center, /task\.status = 'failed'/);
|
||||
assert.match(center, /data-task-action="open"/);
|
||||
assert.match(css, /\.task-center-panel\s*\{/);
|
||||
assert.match(css, /\.task-center-badge\s*\{/);
|
||||
assert.match(browse, /createDownloadProgress/);
|
||||
assert.match(browse, /updateDownloadProgress/);
|
||||
assert.match(browse, /classList\.add\('downloaded'\)/);
|
||||
|
||||
Reference in New Issue
Block a user