Skip to content

Commit 1f4fcd3

Browse files
hi-ogawaOpenCode
andauthored
fix(ui): reveal explorer virtual scroller on resize (#10998)
Co-authored-by: Hiroshi Ogawa <4232207+hi-ogawa@users.noreply.github.com> Co-authored-by: OpenCode <noreply@opencode.ai>
1 parent ff9dcf4 commit 1f4fcd3

4 files changed

Lines changed: 32 additions & 8 deletions

File tree

packages/ui/client/components/explorer/Explorer.vue

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -235,8 +235,8 @@ const {
235235
<FilterStatus v-model="filter.slow" :label="`Slow${slowTime}`" />
236236
</div>
237237
</div>
238-
<div class="scrolls" flex-auto py-1 @scroll.passive="hideAllPoppers">
239-
<ResultsPanel>
238+
<div flex-auto py-1 overflow-hidden>
239+
<ResultsPanel h-full flex="~ col">
240240
<template v-if="initialized" #summary>
241241
<div grid="~ items-center gap-x-1 cols-[auto_min-content_auto] rows-[min-content_min-content]">
242242
<span text-red-700 dark:text-red-500>
@@ -314,11 +314,13 @@ const {
314314
</template>
315315
<template v-else>
316316
<RecycleScroller
317-
page-mode
317+
class="scrolls"
318+
flex-auto
318319
key-field="id"
319320
:item-size="28"
320321
:items="uiEntries"
321322
:buffer="100"
323+
@scroll.passive="hideAllPoppers"
322324
>
323325
<template #default="{ item }">
324326
<ExplorerItem
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import { expect, test } from 'vitest'
2+
3+
test('first test', () => {
4+
expect(true).toBe(true)
5+
})
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import { expect, test } from 'vitest'
2+
3+
test('last test', () => {
4+
expect(true).toBe(true)
5+
})

test/ui/test/ui.spec.ts

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ import { resolveApiToken } from '../../../packages/vitest/src/node/config/apiTok
88
import { assertDownloadAttachment, assertImageAttachment, assertTestCounts, getExplorerItem, openExplorerFileItem, openExplorerItem, startHtmlReportPreview, startVitestUi } from './helper'
99

1010
const TEST_COUNTS = {
11-
pass: 18,
11+
pass: 20,
1212
fail: 3,
1313
files: {
14-
pass: 7,
14+
pass: 9,
1515
},
1616
}
1717

@@ -157,6 +157,18 @@ test.describe('ui', () => {
157157
await testFilterInitiallyInvisibleItem(page)
158158
})
159159

160+
test('renders explorer items revealed by a viewport resize', async ({ page }) => {
161+
await page.setViewportSize({ width: 1000, height: 500 })
162+
await page.goto(pageUrl)
163+
164+
await expect(getExplorerItem(page, 'aa-first-file.test.ts')).toBeVisible()
165+
await expect(getExplorerItem(page, 'zz-last-file.test.ts')).not.toBeVisible()
166+
167+
await page.setViewportSize({ width: 1000, height: 1300 })
168+
169+
await expect(getExplorerItem(page, 'zz-last-file.test.ts')).toBeInViewport()
170+
})
171+
160172
test('tags filter', async ({ page }) => {
161173
await page.goto(pageUrl)
162174
await testTagsFilter(page)
@@ -600,9 +612,9 @@ async function testFilter(page: Page, options: { mode: 'ui' | 'static' }) {
600612
}
601613

602614
async function testFilterInitiallyInvisibleItem(page: Page) {
603-
await expect(getExplorerItem(page, 'sample.test.ts')).not.toBeVisible()
604-
await page.getByPlaceholder('Search...').fill('sample.test.ts')
605-
await expect(getExplorerItem(page, 'sample.test.ts')).toBeVisible()
615+
await expect(getExplorerItem(page, 'zz-last-file.test.ts')).not.toBeVisible()
616+
await page.getByPlaceholder('Search...').fill('zz-last-file.test.ts')
617+
await expect(getExplorerItem(page, 'zz-last-file.test.ts')).toBeVisible()
606618
}
607619

608620
async function testCrossOriginAccess(page: Page, pageUrl: string) {

0 commit comments

Comments
 (0)
Sponsor
SponsoredKunjungi sekarang
Promo