Skip to content

Commit 11d26af

Browse files
committed
fix: update test selectors to exclude external links
1 parent eb3ea4c commit 11d26af

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

test/nuxt/components/PackageVersions.spec.ts

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -73,10 +73,10 @@ describe('PackageVersions', () => {
7373
},
7474
})
7575

76-
// Find version links (exclude anchor links that start with # and external links)
76+
// Find version links (exclude anchor links that start with #)
7777
const versionLinks = component
7878
.findAll('a')
79-
.filter(a => !a.attributes('href')?.startsWith('#') && a.attributes('target') !== '_blank')
79+
.filter(a => !a.attributes('href')?.startsWith('#'))
8080
expect(versionLinks.length).toBeGreaterThan(0)
8181
expect(versionLinks[0]?.text()).toBe('2.0.0')
8282
})
@@ -93,10 +93,10 @@ describe('PackageVersions', () => {
9393
},
9494
})
9595

96-
// Find version links (exclude anchor links that start with # and external links)
96+
// Find version links (exclude anchor links that start with #)
9797
const versionLinks = component
9898
.findAll('a')
99-
.filter(a => !a.attributes('href')?.startsWith('#') && a.attributes('target') !== '_blank')
99+
.filter(a => !a.attributes('href')?.startsWith('#'))
100100
expect(versionLinks.length).toBeGreaterThan(0)
101101
expect(versionLinks[0]?.text()).toBe('1.0.0')
102102
})
@@ -187,10 +187,10 @@ describe('PackageVersions', () => {
187187
},
188188
})
189189

190-
// Find version links (exclude anchor links that start with # and external links)
190+
// Find version links (exclude anchor links that start with #)
191191
const versionLinks = component
192192
.findAll('a')
193-
.filter(a => !a.attributes('href')?.startsWith('#') && a.attributes('target') !== '_blank')
193+
.filter(a => !a.attributes('href')?.startsWith('#'))
194194
const versions = versionLinks.map(l => l.text())
195195
// Should be sorted by version descending
196196
expect(versions[0]).toBe('2.0.0')
@@ -210,10 +210,10 @@ describe('PackageVersions', () => {
210210
},
211211
})
212212

213-
// Find version links (exclude anchor links that start with # and external links)
213+
// Find version links (exclude anchor links that start with #)
214214
const versionLinks = component
215215
.findAll('a')
216-
.filter(a => !a.attributes('href')?.startsWith('#') && a.attributes('target') !== '_blank')
216+
.filter(a => !a.attributes('href')?.startsWith('#'))
217217
expect(versionLinks.length).toBeGreaterThan(0)
218218
expect(versionLinks[0]?.classes()).toContain('text-red-400')
219219
})
@@ -230,10 +230,10 @@ describe('PackageVersions', () => {
230230
},
231231
})
232232

233-
// Find version links (exclude anchor links that start with # and external links)
233+
// Find version links (exclude anchor links that start with #)
234234
const versionLinks = component
235235
.findAll('a')
236-
.filter(a => !a.attributes('href')?.startsWith('#') && a.attributes('target') !== '_blank')
236+
.filter(a => !a.attributes('href')?.startsWith('#'))
237237
expect(versionLinks.length).toBeGreaterThan(0)
238238
expect(versionLinks[0]?.attributes('title')).toContain('deprecated')
239239
})
@@ -562,10 +562,10 @@ describe('PackageVersions', () => {
562562
},
563563
})
564564

565-
// Count visible version links (excluding anchor links that start with # and external links)
565+
// Count visible version links (excluding anchor links that start with #)
566566
const visibleLinks = component
567567
.findAll('a')
568-
.filter(a => !a.attributes('href')?.startsWith('#') && a.attributes('target') !== '_blank')
568+
.filter(a => !a.attributes('href')?.startsWith('#'))
569569
// Should have max 10 visible links in the main section
570570
expect(visibleLinks.length).toBeLessThanOrEqual(10)
571571
})

0 commit comments

Comments
 (0)