|
| 1 | +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html |
| 2 | + |
| 3 | +exports[`compiler: v-for > codegen > basic v-for 1`] = ` |
| 4 | +"const _Vue = Vue |
| 5 | +
|
| 6 | +return function render(_ctx, _cache) { |
| 7 | + with (_ctx) { |
| 8 | + const { renderList: _renderList, Fragment: _Fragment, openBlock: _openBlock, createElementBlock: _createElementBlock } = _Vue |
| 9 | +
|
| 10 | + return (_openBlock(true), _createElementBlock(_Fragment, null, _renderList(items, (item) => { |
| 11 | + return (_openBlock(), _createElementBlock("span")) |
| 12 | + }), 256 /* UNKEYED_FRAGMENT */)) |
| 13 | + } |
| 14 | +}" |
| 15 | +`; |
| 16 | + |
| 17 | +exports[`compiler: v-for > codegen > keyed template v-for 1`] = ` |
| 18 | +"const _Vue = Vue |
| 19 | +
|
| 20 | +return function render(_ctx, _cache) { |
| 21 | + with (_ctx) { |
| 22 | + const { renderList: _renderList, Fragment: _Fragment, openBlock: _openBlock, createElementBlock: _createElementBlock, createElementVNode: _createElementVNode } = _Vue |
| 23 | +
|
| 24 | + return (_openBlock(true), _createElementBlock(_Fragment, null, _renderList(items, (item) => { |
| 25 | + return (_openBlock(), _createElementBlock(_Fragment, { key: item }, [ |
| 26 | + "hello", |
| 27 | + _createElementVNode("span") |
| 28 | + ], 64 /* STABLE_FRAGMENT */)) |
| 29 | + }), 128 /* KEYED_FRAGMENT */)) |
| 30 | + } |
| 31 | +}" |
| 32 | +`; |
| 33 | + |
| 34 | +exports[`compiler: v-for > codegen > keyed v-for 1`] = ` |
| 35 | +"const _Vue = Vue |
| 36 | +
|
| 37 | +return function render(_ctx, _cache) { |
| 38 | + with (_ctx) { |
| 39 | + const { renderList: _renderList, Fragment: _Fragment, openBlock: _openBlock, createElementBlock: _createElementBlock } = _Vue |
| 40 | +
|
| 41 | + return (_openBlock(true), _createElementBlock(_Fragment, null, _renderList(items, (item) => { |
| 42 | + return (_openBlock(), _createElementBlock("span", { key: item })) |
| 43 | + }), 128 /* KEYED_FRAGMENT */)) |
| 44 | + } |
| 45 | +}" |
| 46 | +`; |
| 47 | + |
| 48 | +exports[`compiler: v-for > codegen > skipped key 1`] = ` |
| 49 | +"const _Vue = Vue |
| 50 | +
|
| 51 | +return function render(_ctx, _cache) { |
| 52 | + with (_ctx) { |
| 53 | + const { renderList: _renderList, Fragment: _Fragment, openBlock: _openBlock, createElementBlock: _createElementBlock } = _Vue |
| 54 | +
|
| 55 | + return (_openBlock(true), _createElementBlock(_Fragment, null, _renderList(items, (item, __, index) => { |
| 56 | + return (_openBlock(), _createElementBlock("span")) |
| 57 | + }), 256 /* UNKEYED_FRAGMENT */)) |
| 58 | + } |
| 59 | +}" |
| 60 | +`; |
| 61 | + |
| 62 | +exports[`compiler: v-for > codegen > skipped value & key 1`] = ` |
| 63 | +"const _Vue = Vue |
| 64 | +
|
| 65 | +return function render(_ctx, _cache) { |
| 66 | + with (_ctx) { |
| 67 | + const { renderList: _renderList, Fragment: _Fragment, openBlock: _openBlock, createElementBlock: _createElementBlock } = _Vue |
| 68 | +
|
| 69 | + return (_openBlock(true), _createElementBlock(_Fragment, null, _renderList(items, (_, __, index) => { |
| 70 | + return (_openBlock(), _createElementBlock("span")) |
| 71 | + }), 256 /* UNKEYED_FRAGMENT */)) |
| 72 | + } |
| 73 | +}" |
| 74 | +`; |
| 75 | + |
| 76 | +exports[`compiler: v-for > codegen > skipped value 1`] = ` |
| 77 | +"const _Vue = Vue |
| 78 | +
|
| 79 | +return function render(_ctx, _cache) { |
| 80 | + with (_ctx) { |
| 81 | + const { renderList: _renderList, Fragment: _Fragment, openBlock: _openBlock, createElementBlock: _createElementBlock } = _Vue |
| 82 | +
|
| 83 | + return (_openBlock(true), _createElementBlock(_Fragment, null, _renderList(items, (_, key, index) => { |
| 84 | + return (_openBlock(), _createElementBlock("span")) |
| 85 | + }), 256 /* UNKEYED_FRAGMENT */)) |
| 86 | + } |
| 87 | +}" |
| 88 | +`; |
| 89 | + |
| 90 | +exports[`compiler: v-for > codegen > template v-for 1`] = ` |
| 91 | +"const _Vue = Vue |
| 92 | +
|
| 93 | +return function render(_ctx, _cache) { |
| 94 | + with (_ctx) { |
| 95 | + const { renderList: _renderList, Fragment: _Fragment, openBlock: _openBlock, createElementBlock: _createElementBlock, createElementVNode: _createElementVNode } = _Vue |
| 96 | +
|
| 97 | + return (_openBlock(true), _createElementBlock(_Fragment, null, _renderList(items, (item) => { |
| 98 | + return (_openBlock(), _createElementBlock(_Fragment, null, [ |
| 99 | + "hello", |
| 100 | + _createElementVNode("span") |
| 101 | + ], 64 /* STABLE_FRAGMENT */)) |
| 102 | + }), 256 /* UNKEYED_FRAGMENT */)) |
| 103 | + } |
| 104 | +}" |
| 105 | +`; |
| 106 | + |
| 107 | +exports[`compiler: v-for > codegen > template v-for key injection with single child 1`] = ` |
| 108 | +"const _Vue = Vue |
| 109 | +
|
| 110 | +return function render(_ctx, _cache) { |
| 111 | + with (_ctx) { |
| 112 | + const { renderList: _renderList, Fragment: _Fragment, openBlock: _openBlock, createElementBlock: _createElementBlock } = _Vue |
| 113 | +
|
| 114 | + return (_openBlock(true), _createElementBlock(_Fragment, null, _renderList(items, (item) => { |
| 115 | + return (_openBlock(), _createElementBlock("span", { |
| 116 | + key: item.id, |
| 117 | + id: item.id |
| 118 | + }, null, 8 /* PROPS */, ["id"])) |
| 119 | + }), 128 /* KEYED_FRAGMENT */)) |
| 120 | + } |
| 121 | +}" |
| 122 | +`; |
| 123 | + |
| 124 | +exports[`compiler: v-for > codegen > template v-for w/ <slot/> 1`] = ` |
| 125 | +"const _Vue = Vue |
| 126 | +
|
| 127 | +return function render(_ctx, _cache) { |
| 128 | + with (_ctx) { |
| 129 | + const { renderList: _renderList, Fragment: _Fragment, openBlock: _openBlock, createElementBlock: _createElementBlock, renderSlot: _renderSlot } = _Vue |
| 130 | +
|
| 131 | + return (_openBlock(true), _createElementBlock(_Fragment, null, _renderList(items, (item) => { |
| 132 | + return _renderSlot($slots, "default") |
| 133 | + }), 256 /* UNKEYED_FRAGMENT */)) |
| 134 | + } |
| 135 | +}" |
| 136 | +`; |
| 137 | + |
| 138 | +exports[`compiler: v-for > codegen > v-for on <slot/> 1`] = ` |
| 139 | +"const _Vue = Vue |
| 140 | +
|
| 141 | +return function render(_ctx, _cache) { |
| 142 | + with (_ctx) { |
| 143 | + const { renderList: _renderList, Fragment: _Fragment, openBlock: _openBlock, createElementBlock: _createElementBlock, renderSlot: _renderSlot } = _Vue |
| 144 | +
|
| 145 | + return (_openBlock(true), _createElementBlock(_Fragment, null, _renderList(items, (item) => { |
| 146 | + return _renderSlot($slots, "default") |
| 147 | + }), 256 /* UNKEYED_FRAGMENT */)) |
| 148 | + } |
| 149 | +}" |
| 150 | +`; |
| 151 | + |
| 152 | +exports[`compiler: v-for > codegen > v-for on element with custom directive 1`] = ` |
| 153 | +"const _Vue = Vue |
| 154 | +
|
| 155 | +return function render(_ctx, _cache) { |
| 156 | + with (_ctx) { |
| 157 | + const { renderList: _renderList, Fragment: _Fragment, openBlock: _openBlock, createElementBlock: _createElementBlock, resolveDirective: _resolveDirective, withDirectives: _withDirectives } = _Vue |
| 158 | +
|
| 159 | + const _directive_foo = _resolveDirective("foo") |
| 160 | +
|
| 161 | + return (_openBlock(true), _createElementBlock(_Fragment, null, _renderList(list, (i) => { |
| 162 | + return _withDirectives((_openBlock(), _createElementBlock("div", null, null, 512 /* NEED_PATCH */)), [ |
| 163 | + [_directive_foo] |
| 164 | + ]) |
| 165 | + }), 256 /* UNKEYED_FRAGMENT */)) |
| 166 | + } |
| 167 | +}" |
| 168 | +`; |
| 169 | + |
| 170 | +exports[`compiler: v-for > codegen > v-for with constant expression 1`] = ` |
| 171 | +"const _Vue = Vue |
| 172 | +
|
| 173 | +return function render(_ctx, _cache) { |
| 174 | + with (_ctx) { |
| 175 | + const { renderList: _renderList, Fragment: _Fragment, openBlock: _openBlock, createElementBlock: _createElementBlock, toDisplayString: _toDisplayString, createElementVNode: _createElementVNode } = _Vue |
| 176 | +
|
| 177 | + return (_openBlock(), _createElementBlock(_Fragment, null, _renderList(10, (item) => { |
| 178 | + return _createElementVNode("p", null, _toDisplayString(item), 1 /* TEXT */) |
| 179 | + }), 64 /* STABLE_FRAGMENT */)) |
| 180 | + } |
| 181 | +}" |
| 182 | +`; |
| 183 | + |
| 184 | +exports[`compiler: v-for > codegen > v-if + v-for 1`] = ` |
| 185 | +"const _Vue = Vue |
| 186 | +
|
| 187 | +return function render(_ctx, _cache) { |
| 188 | + with (_ctx) { |
| 189 | + const { renderList: _renderList, Fragment: _Fragment, openBlock: _openBlock, createElementBlock: _createElementBlock, createCommentVNode: _createCommentVNode } = _Vue |
| 190 | +
|
| 191 | + return ok |
| 192 | + ? (_openBlock(true), _createElementBlock(_Fragment, { key: 0 }, _renderList(list, (i) => { |
| 193 | + return (_openBlock(), _createElementBlock("div")) |
| 194 | + }), 256 /* UNKEYED_FRAGMENT */)) |
| 195 | + : _createCommentVNode("v-if", true) |
| 196 | + } |
| 197 | +}" |
| 198 | +`; |
| 199 | + |
| 200 | +exports[`compiler: v-for > codegen > v-if + v-for on <template> 1`] = ` |
| 201 | +"const _Vue = Vue |
| 202 | +
|
| 203 | +return function render(_ctx, _cache) { |
| 204 | + with (_ctx) { |
| 205 | + const { renderList: _renderList, Fragment: _Fragment, openBlock: _openBlock, createElementBlock: _createElementBlock, createCommentVNode: _createCommentVNode } = _Vue |
| 206 | +
|
| 207 | + return ok |
| 208 | + ? (_openBlock(true), _createElementBlock(_Fragment, { key: 0 }, _renderList(list, (i) => { |
| 209 | + return (_openBlock(), _createElementBlock(_Fragment, null, [], 64 /* STABLE_FRAGMENT */)) |
| 210 | + }), 256 /* UNKEYED_FRAGMENT */)) |
| 211 | + : _createCommentVNode("v-if", true) |
| 212 | + } |
| 213 | +}" |
| 214 | +`; |
| 215 | +
|
| 216 | +exports[`compiler: v-for > codegen > value + key + index 1`] = ` |
| 217 | +"const _Vue = Vue |
| 218 | +
|
| 219 | +return function render(_ctx, _cache) { |
| 220 | + with (_ctx) { |
| 221 | + const { renderList: _renderList, Fragment: _Fragment, openBlock: _openBlock, createElementBlock: _createElementBlock } = _Vue |
| 222 | +
|
| 223 | + return (_openBlock(true), _createElementBlock(_Fragment, null, _renderList(items, (item, key, index) => { |
| 224 | + return (_openBlock(), _createElementBlock("span")) |
| 225 | + }), 256 /* UNKEYED_FRAGMENT */)) |
| 226 | + } |
| 227 | +}" |
| 228 | +`; |
0 commit comments