fix: 长分类名称省略时保留数量
This commit is contained in:
@@ -593,6 +593,35 @@ app.whenReady().then(async () => {
|
||||
});
|
||||
})()`)
|
||||
);
|
||||
const longShelfName = 'TheArtOfComputerProgramming超长分类名称';
|
||||
library.updateShelf(researchShelf.id, { name: longShelfName });
|
||||
await pollJs(
|
||||
'超长分类名称刷新',
|
||||
`Array.from(document.querySelectorAll('#libraryShelfList .library-filter'))
|
||||
.some((button) => button.firstElementChild.textContent === ${JSON.stringify(longShelfName)})`
|
||||
);
|
||||
check(
|
||||
'超长分类只省略名称并完整保留数量与操作区',
|
||||
await js(`(() => {
|
||||
const button = Array.from(document.querySelectorAll('#libraryShelfList .library-filter'))
|
||||
.find((candidate) => candidate.firstElementChild.textContent === ${JSON.stringify(longShelfName)});
|
||||
const name = button.firstElementChild;
|
||||
const count = button.querySelector('.library-filter-count');
|
||||
const actions = button.closest('.library-shelf-row').querySelector('.library-shelf-actions');
|
||||
return getComputedStyle(button).display === 'flex'
|
||||
&& getComputedStyle(name).textOverflow === 'ellipsis'
|
||||
&& name.scrollWidth > name.clientWidth
|
||||
&& count.textContent === '(1)'
|
||||
&& count.getBoundingClientRect().width > 0
|
||||
&& count.getBoundingClientRect().right <= actions.getBoundingClientRect().left + 1;
|
||||
})()`)
|
||||
);
|
||||
library.updateShelf(researchShelf.id, { name: researchShelf.name });
|
||||
await pollJs(
|
||||
'恢复研究书架名称',
|
||||
`Array.from(document.querySelectorAll('#libraryShelfList .library-filter'))
|
||||
.some((button) => button.firstElementChild.textContent === ${JSON.stringify(researchShelf.name)})`
|
||||
);
|
||||
check(
|
||||
'标签侧栏显示真实聚合计数',
|
||||
await js(`(() => {
|
||||
|
||||
Reference in New Issue
Block a user