From 5aa88fe8af53384bbc00ceb01265f11621641ae5 Mon Sep 17 00:00:00 2001 From: btea <2356281422@qq.com> Date: Fri, 30 May 2025 09:30:47 +0800 Subject: [PATCH 1/2] test(compiler-sfc): direct descendant wildcard rule selector --- .../__tests__/compileStyle.spec.ts | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/packages/compiler-sfc/__tests__/compileStyle.spec.ts b/packages/compiler-sfc/__tests__/compileStyle.spec.ts index 78fd52425e8..8f0858c9e76 100644 --- a/packages/compiler-sfc/__tests__/compileStyle.spec.ts +++ b/packages/compiler-sfc/__tests__/compileStyle.spec.ts @@ -39,6 +39,32 @@ describe('SFC scoped CSS', () => { expect(compileScoped(`h1 .foo { color: red; }`)).toMatch( `h1 .foo[data-v-test] { color: red;`, ) + + // https://github.com/vuejs/core/issues/13387 + expect( + compileScoped(`main { + display: flex; + flex-direction: column; + background: yellowgreen; + width: 100%; + > * { + max-width: 200px; + background-color: yellow; + } +}`), + ).toMatchInlineSnapshot(` + "main { +&[data-v-test] { + display: flex; + flex-direction: column; + background: yellowgreen; + width: 100%; +} +> *[data-v-test] { + max-width: 200px; + background-color: yellow; +} +}"`) }) test('nesting selector', () => { From 65de7f470c3910b606ab88c185f3c3de14d886cc Mon Sep 17 00:00:00 2001 From: daiwei Date: Fri, 30 May 2025 10:30:56 +0800 Subject: [PATCH 2/2] chore: simplify test --- packages/compiler-sfc/__tests__/compileStyle.spec.ts | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/packages/compiler-sfc/__tests__/compileStyle.spec.ts b/packages/compiler-sfc/__tests__/compileStyle.spec.ts index 8f0858c9e76..9b7e7c53710 100644 --- a/packages/compiler-sfc/__tests__/compileStyle.spec.ts +++ b/packages/compiler-sfc/__tests__/compileStyle.spec.ts @@ -40,29 +40,21 @@ describe('SFC scoped CSS', () => { `h1 .foo[data-v-test] { color: red;`, ) - // https://github.com/vuejs/core/issues/13387 + // #13387 expect( compileScoped(`main { - display: flex; - flex-direction: column; - background: yellowgreen; width: 100%; > * { max-width: 200px; - background-color: yellow; } }`), ).toMatchInlineSnapshot(` "main { &[data-v-test] { - display: flex; - flex-direction: column; - background: yellowgreen; width: 100%; } > *[data-v-test] { max-width: 200px; - background-color: yellow; } }"`) })