Skip to content

Commit

Permalink
fix(ui): show file item when search filter matches only test cases (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
hi-ogawa authored Dec 19, 2023
1 parent fd5d7e6 commit f43fdd8
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/ui/client/components/TaskTree.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const { task, indent = 0, nested = false, search, onItemClick } = defineProps<{
<!-- maybe provide a KEEP STRUCTURE mode, do not filter by search keyword -->
<!-- v-if = keepStructure || (!search || caseInsensitiveMatch(task.name, search)) -->
<TaskItem
v-if="!search || caseInsensitiveMatch(task.name, search)"
v-if="!nested || !search || caseInsensitiveMatch(task.name, search)"
v-bind="$attrs"
:task="task"
:style="{ paddingLeft: `${indent * 0.75 + 1}rem` }"
Expand Down
18 changes: 18 additions & 0 deletions test/ui/test/ui.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,22 @@ test.describe('ui', () => {
await page.getByTestId('btn-console').click()
await page.getByText('/(?<char>\\w)/').click()
})

test('file-filter', async ({ page }) => {
await page.goto(pageUrl)

// match all files when no filter
await page.getByPlaceholder('Search...').fill('')
await page.getByText('PASS (3)').click()
await expect(page.getByText('fixtures/sample.test.ts', { exact: true })).toBeVisible()

// match nothing
await page.getByPlaceholder('Search...').fill('nothing')
await page.getByText('No matched test').click()

// searching "add" will match "sample.test.ts" since it includes a test case named "add"
await page.getByPlaceholder('Search...').fill('add')
await page.getByText('PASS (1)').click()
await expect(page.getByText('fixtures/sample.test.ts', { exact: true })).toBeVisible()
})
})

0 comments on commit f43fdd8

Please sign in to comment.