镜像自地址
https://github.com/lhly/cloud-drive-renamer.git
已同步 2026-10-20 13:47:47 +08:00
test: cover preview list old-to-new mapping
这个提交包含在:
父节点
09e77bf599
当前提交
7fa74c754e
@ -98,6 +98,9 @@ export class VirtualPreviewList extends LitElement {
|
|||||||
return html`
|
return html`
|
||||||
<div class="preview-item ${statusClass}">
|
<div class="preview-item ${statusClass}">
|
||||||
<div class="preview-content">
|
<div class="preview-content">
|
||||||
|
<div class="old-name" title=${item.file.name}>
|
||||||
|
${item.file.name}
|
||||||
|
</div>
|
||||||
<div class="new-name ${statusClass}" title=${item.newName}>
|
<div class="new-name ${statusClass}" title=${item.newName}>
|
||||||
${item.newName}
|
${item.newName}
|
||||||
${statusBadge}
|
${statusBadge}
|
||||||
@ -229,6 +232,15 @@ export class VirtualPreviewList extends LitElement {
|
|||||||
min-width: 0;
|
min-width: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.old-name {
|
||||||
|
font-size: 12px;
|
||||||
|
color: var(--cdr-text-secondary, #595959);
|
||||||
|
margin-bottom: 4px;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
.new-name {
|
.new-name {
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
color: var(--cdr-text, #262626);
|
color: var(--cdr-text, #262626);
|
||||||
|
|||||||
@ -0,0 +1,32 @@
|
|||||||
|
import { describe, expect, it } from 'vitest';
|
||||||
|
import { VirtualPreviewList } from '../../src/content/components/virtual-preview-list';
|
||||||
|
|
||||||
|
describe('VirtualPreviewList pending preview mapping', () => {
|
||||||
|
it('renders original name and new name for a pending preview item', async () => {
|
||||||
|
const element = new VirtualPreviewList();
|
||||||
|
element.items = [
|
||||||
|
{
|
||||||
|
file: {
|
||||||
|
id: 'file-1',
|
||||||
|
name: 'old-episode.mkv',
|
||||||
|
ext: 'mkv',
|
||||||
|
size: 42,
|
||||||
|
mtime: Date.now(),
|
||||||
|
isDir: false,
|
||||||
|
},
|
||||||
|
newName: 'new-episode.mkv',
|
||||||
|
conflict: false,
|
||||||
|
done: false,
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
document.body.appendChild(element);
|
||||||
|
await element.updateComplete;
|
||||||
|
|
||||||
|
const textContent = element.shadowRoot?.textContent ?? '';
|
||||||
|
expect(textContent).toContain('old-episode.mkv');
|
||||||
|
expect(textContent).toContain('new-episode.mkv');
|
||||||
|
|
||||||
|
element.remove();
|
||||||
|
});
|
||||||
|
});
|
||||||
正在加载...
在新工单中引用
屏蔽一个用户