Skip to content

Commit dce2e83

Browse files
committed
fix(compiler): remove empty modifiers
1 parent 2fae757 commit dce2e83

File tree

3 files changed

+10
-8
lines changed

3 files changed

+10
-8
lines changed

packages/compiler/src/utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ export function resolveDirectiveNode(
300300
if (name.type !== 'JSXNamespacedName' && !argString) {
301301
const [newName, modifiers] = nameString.split('_')
302302
nameString = newName
303-
argString = `_${modifiers}`
303+
modifiers && (argString = `_${modifiers}`)
304304
}
305305

306306
let modifiers: string[] = []

packages/compiler/test/transforms/__snapshots__/vModel.spec.ts.snap

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,11 @@ exports[`compiler: vModel transform > modifiers > .trim 1`] = `
2323
return n0
2424
"
2525
`;
26+
27+
exports[`compiler: vModel transform > should support simple expression 1`] = `
28+
"
29+
const n0 = t0()
30+
_applyTextModel(n0, () => (model), _value => (model = _value))
31+
return n0
32+
"
33+
`;

packages/compiler/test/transforms/vModel.spec.ts

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,7 @@ const compileWithVModel = makeCompile({
1818
describe('compiler: vModel transform', () => {
1919
test('should support simple expression', () => {
2020
const { code, helpers } = compileWithVModel('<input v-model={model} />')
21-
expect(code).toMatchInlineSnapshot(`
22-
"
23-
const n0 = t0()
24-
_applyTextModel(n0, () => (model), _value => (model = _value), { undefined: true })
25-
return n0
26-
"
27-
`)
21+
expect(code).toMatchSnapshot()
2822
expect(helpers).toContain('applyTextModel')
2923
})
3024

0 commit comments

Comments
 (0)