mirror of https://github.com/vuejs/core.git
Merge cb299290e2
into 56be3dd4db
This commit is contained in:
commit
135982fb8b
|
@ -542,6 +542,22 @@ describe('KeepAlive', () => {
|
||||||
await assertNameMatch({ include: 'one,two', exclude: 'two' })
|
await assertNameMatch({ include: 'one,two', exclude: 'two' })
|
||||||
})
|
})
|
||||||
|
|
||||||
|
test('include + exclude with space before commas', async () => {
|
||||||
|
await assertNameMatch({ include: 'one ,two', exclude: 'two' })
|
||||||
|
})
|
||||||
|
|
||||||
|
test('include + exclude with space after commas', async () => {
|
||||||
|
await assertNameMatch({ include: 'one, two', exclude: 'two' })
|
||||||
|
})
|
||||||
|
|
||||||
|
test('include + exclude with space around comma', async () => {
|
||||||
|
await assertNameMatch({ include: 'one , two', exclude: 'two' })
|
||||||
|
})
|
||||||
|
|
||||||
|
test('include + exclude with space at both ends', async () => {
|
||||||
|
await assertNameMatch({ include: ' one , two ', exclude: ' two ' })
|
||||||
|
})
|
||||||
|
|
||||||
test('max', async () => {
|
test('max', async () => {
|
||||||
const spyAC = vi.fn()
|
const spyAC = vi.fn()
|
||||||
const spyBC = vi.fn()
|
const spyBC = vi.fn()
|
||||||
|
|
|
@ -390,7 +390,10 @@ function matches(pattern: MatchPattern, name: string): boolean {
|
||||||
if (isArray(pattern)) {
|
if (isArray(pattern)) {
|
||||||
return pattern.some((p: string | RegExp) => matches(p, name))
|
return pattern.some((p: string | RegExp) => matches(p, name))
|
||||||
} else if (isString(pattern)) {
|
} else if (isString(pattern)) {
|
||||||
return pattern.split(',').includes(name)
|
return pattern
|
||||||
|
.trim()
|
||||||
|
.split(/\s*,\s*/)
|
||||||
|
.includes(name)
|
||||||
} else if (isRegExp(pattern)) {
|
} else if (isRegExp(pattern)) {
|
||||||
pattern.lastIndex = 0
|
pattern.lastIndex = 0
|
||||||
return pattern.test(name)
|
return pattern.test(name)
|
||||||
|
|
Loading…
Reference in New Issue