Skip to content

Commit 2e20622

Browse files
Apply test selector fixes to current test file
Co-authored-by: NullVoxPopuli <199018+NullVoxPopuli@users.noreply.github.com>
1 parent fe1ea89 commit 2e20622

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 #)
76+
// Find version links (exclude anchor links that start with # and external links)
7777
const versionLinks = component
7878
.findAll('a')
79-
.filter(a => !a.attributes('href')?.startsWith('#'))
79+
.filter(a => !a.attributes('href')?.startsWith('#') && a.attributes('target') !== '_blank')
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 #)
96+
// Find version links (exclude anchor links that start with # and external links)
9797
const versionLinks = component
9898
.findAll('a')
99-
.filter(a => !a.attributes('href')?.startsWith('#'))
99+
.filter(a => !a.attributes('href')?.startsWith('#') && a.attributes('target') !== '_blank')
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 #)
190+
// Find version links (exclude anchor links that start with # and external links)
191191
const versionLinks = component
192192
.findAll('a')
193-
.filter(a => !a.attributes('href')?.startsWith('#'))
193+
.filter(a => !a.attributes('href')?.startsWith('#') && a.attributes('target') !== '_blank')
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 #)
213+
// Find version links (exclude anchor links that start with # and external links)
214214
const versionLinks = component
215215
.findAll('a')
216-
.filter(a => !a.attributes('href')?.startsWith('#'))
216+
.filter(a => !a.attributes('href')?.startsWith('#') && a.attributes('target') !== '_blank')
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 #)
233+
// Find version links (exclude anchor links that start with # and external links)
234234
const versionLinks = component
235235
.findAll('a')
236-
.filter(a => !a.attributes('href')?.startsWith('#'))
236+
.filter(a => !a.attributes('href')?.startsWith('#') && a.attributes('target') !== '_blank')
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 #)
565+
// Count visible version links (excluding anchor links that start with # and external links)
566566
const visibleLinks = component
567567
.findAll('a')
568-
.filter(a => !a.attributes('href')?.startsWith('#'))
568+
.filter(a => !a.attributes('href')?.startsWith('#') && a.attributes('target') !== '_blank')
569569
// Should have max 10 visible links in the main section
570570
expect(visibleLinks.length).toBeLessThanOrEqual(10)
571571
})

0 commit comments

Comments
 (0)