return [n0, n6]
}"
`;
+
+exports[`compiler: v-if > v-if with v-once 1`] = `
+"import { txt as _txt, toDisplayString as _toDisplayString, setText as _setText, createIf as _createIf, template as _template } from 'vue';
+const t0 = _template("<div> </div>", true)
+
+export function render(_ctx) {
+ const n0 = _createIf(() => (_ctx.ok), () => {
+ const n2 = t0()
+ const x2 = _txt(n2)
+ _setText(x2, _toDisplayString(_ctx.msg))
+ return n2
+ }, null, true)
+ return n0
+}"
+`;
expect(ir.block.returns).toEqual([0, 3])
})
- test.todo('v-if with v-once')
+ test('v-if with v-once', () => {
+ const { code, ir, helpers } = compileWithVIf(
+ `<div v-if="ok" v-once>{{ msg }}</div>`,
+ )
+ expect(code).matchSnapshot()
+ expect(helpers).contains('createIf')
+ expect([...ir.template.keys()]).toEqual(['<div> </div>'])
+ })
test('component v-if', () => {
const { code, ir, helpers } = compileWithVIf(