Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 1 addition & 8 deletions app/components/Package/Versions.vue
Original file line number Diff line number Diff line change
Expand Up @@ -210,14 +210,7 @@ const visibleTagRows = computed(() => {
getTagVersions(row.tag).some(v => filteredVersionSet.value.has(v.version)),
)
: rowsMaybeFilteredForDeprecation
const first = rows.slice(0, MAX_VISIBLE_TAGS)
const latestTagRow = rows.find(row => row.tag === 'latest')
// Ensure 'latest' tag is always included (at the end) if not already present
if (latestTagRow && !first.includes(latestTagRow)) {
first.pop()
first.push(latestTagRow)
}
return first
Comment thread
joshuaisaact marked this conversation as resolved.
return rows.slice(0, MAX_VISIBLE_TAGS)
})

// Hidden tag rows (all other tags) - shown in "Other versions"
Expand Down
15 changes: 15 additions & 0 deletions test/nuxt/components/Package/Versions.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1281,6 +1281,21 @@ describe('PackageVersions', () => {
expect(text).not.toContain('0.5.0')
})
})

it('does not show latest tag when it does not match the filter', async () => {
const component = await mountSuspended(PackageVersions, { props: multiVersionProps })

const input = component.find('input[type="text"]')
await input.setValue('^1.0.0 <2.0.0')

const versionLinks = component.findAll('a').filter(isVersionLink)
const versions = versionLinks.map(l => l.text())

// 3.0.0 is latest but does NOT match the filter
expect(versions).not.toContain('3.0.0')
// 1.0.0 does match
expect(versions).toContain('1.0.0')
})
})

describe('error handling', () => {
Expand Down
Loading