Merge pull request 'fix: 任务搜索与筛选提供空状态(#33 D4)' (#36) from codex/issue33-d4 into main
This commit was merged in pull request #36.
This commit is contained in:
commit
f80127e7bd
2 files changed
+37
-1
No files matched your search
@@ -27,6 +27,26 @@ def visible_ids(panel):
|
||||
return [panel.list.item(index).data(Qt.ItemDataRole.UserRole) for index in range(panel.list.count())]
|
||||
|
||||
|
||||
def test_empty_list_explains_search_filter_and_initial_state(navigation, qtbot):
|
||||
panel, tasks, opened = navigation
|
||||
panel.populate(tasks[:1])
|
||||
qtbot.keyClicks(panel.search, 'zzzz_no_match')
|
||||
assert panel.empty_hint.isVisible()
|
||||
assert 'zzzz_no_match' in panel.empty_hint.text()
|
||||
assert '匹配 0 / 共 1 个任务' in panel.count.text()
|
||||
panel.filter.setCurrentIndex(panel.filter.findData('completed'))
|
||||
assert '已完成' in panel.empty_hint.text() and 'zzzz_no_match' in panel.empty_hint.text()
|
||||
panel.search.clear()
|
||||
assert '已完成' in panel.empty_hint.text()
|
||||
panel.filter.setCurrentIndex(panel.filter.findData('all'))
|
||||
assert not panel.empty_hint.isVisible() and len(visible_ids(panel)) == 1
|
||||
panel.populate(())
|
||||
assert '新建任务' in panel.empty_hint.text()
|
||||
panel.recycle_button.setChecked(True)
|
||||
panel.populate(())
|
||||
assert '回收站' in panel.empty_hint.text()
|
||||
|
||||
|
||||
@pytest.mark.parametrize(('category','expected'),[
|
||||
('all',['draft','ready','running','paused','completed','failed','blocked']),
|
||||
('unfinished',['draft','ready','running','paused','failed','blocked']),
|
||||
|
||||
Reference in new issue
Block a user