-
-
Notifications
You must be signed in to change notification settings - Fork 98
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(vapor): merge inherited attrs with current attrs
- Loading branch information
Showing
33 changed files
with
497 additions
and
187 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
78 changes: 47 additions & 31 deletions
78
packages/compiler-vapor/__tests__/transforms/__snapshots__/vBind.spec.ts.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,177 +1,193 @@ | ||
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html | ||
|
||
exports[`compiler v-bind > .attr modifier 1`] = ` | ||
"import { renderEffect as _renderEffect, setAttr as _setAttr, template as _template } from 'vue/vapor'; | ||
"import { setInheritAttrs as _setInheritAttrs, renderEffect as _renderEffect, setAttr as _setAttr, template as _template } from 'vue/vapor'; | ||
const t0 = _template("<div></div>") | ||
export function render(_ctx) { | ||
const n0 = t0() | ||
_renderEffect(() => _setAttr(n0, "foo-bar", _ctx.id)) | ||
_setInheritAttrs(["foo-bar"]) | ||
_renderEffect(() => _setAttr(n0, "foo-bar", _ctx.id, true)) | ||
return n0 | ||
}" | ||
`; | ||
|
||
exports[`compiler v-bind > .attr modifier w/ no expression 1`] = ` | ||
"import { renderEffect as _renderEffect, setAttr as _setAttr, template as _template } from 'vue/vapor'; | ||
"import { setInheritAttrs as _setInheritAttrs, renderEffect as _renderEffect, setAttr as _setAttr, template as _template } from 'vue/vapor'; | ||
const t0 = _template("<div></div>") | ||
export function render(_ctx) { | ||
const n0 = t0() | ||
_renderEffect(() => _setAttr(n0, "foo-bar", _ctx.fooBar)) | ||
_setInheritAttrs(["foo-bar"]) | ||
_renderEffect(() => _setAttr(n0, "foo-bar", _ctx.fooBar, true)) | ||
return n0 | ||
}" | ||
`; | ||
|
||
exports[`compiler v-bind > .camel modifier 1`] = ` | ||
"import { renderEffect as _renderEffect, setDynamicProp as _setDynamicProp, template as _template } from 'vue/vapor'; | ||
"import { setInheritAttrs as _setInheritAttrs, renderEffect as _renderEffect, setDynamicProp as _setDynamicProp, template as _template } from 'vue/vapor'; | ||
const t0 = _template("<div></div>") | ||
export function render(_ctx) { | ||
const n0 = t0() | ||
_renderEffect(() => _setDynamicProp(n0, "fooBar", _ctx.id)) | ||
_setInheritAttrs(["fooBar"]) | ||
_renderEffect(() => _setDynamicProp(n0, "fooBar", _ctx.id, true)) | ||
return n0 | ||
}" | ||
`; | ||
|
||
exports[`compiler v-bind > .camel modifier w/ dynamic arg 1`] = ` | ||
"import { camelize as _camelize } from 'vue'; | ||
import { renderEffect as _renderEffect, setDynamicProps as _setDynamicProps, template as _template } from 'vue/vapor'; | ||
import { setInheritAttrs as _setInheritAttrs, renderEffect as _renderEffect, setDynamicProps as _setDynamicProps, template as _template } from 'vue/vapor'; | ||
const t0 = _template("<div></div>") | ||
export function render(_ctx) { | ||
const n0 = t0() | ||
_renderEffect(() => _setDynamicProps(n0, { [_camelize(_ctx.foo)]: _ctx.id })) | ||
_setInheritAttrs(true) | ||
_renderEffect(() => _setDynamicProps(n0, [{ [_camelize(_ctx.foo)]: _ctx.id }], true)) | ||
return n0 | ||
}" | ||
`; | ||
|
||
exports[`compiler v-bind > .camel modifier w/ no expression 1`] = ` | ||
"import { renderEffect as _renderEffect, setDynamicProp as _setDynamicProp, template as _template } from 'vue/vapor'; | ||
"import { setInheritAttrs as _setInheritAttrs, renderEffect as _renderEffect, setDynamicProp as _setDynamicProp, template as _template } from 'vue/vapor'; | ||
const t0 = _template("<div></div>") | ||
export function render(_ctx) { | ||
const n0 = t0() | ||
_renderEffect(() => _setDynamicProp(n0, "fooBar", _ctx.fooBar)) | ||
_setInheritAttrs(["fooBar"]) | ||
_renderEffect(() => _setDynamicProp(n0, "fooBar", _ctx.fooBar, true)) | ||
return n0 | ||
}" | ||
`; | ||
|
||
exports[`compiler v-bind > .prop modifier (shortband) w/ no expression 1`] = ` | ||
"import { renderEffect as _renderEffect, setDOMProp as _setDOMProp, template as _template } from 'vue/vapor'; | ||
"import { setInheritAttrs as _setInheritAttrs, renderEffect as _renderEffect, setDOMProp as _setDOMProp, template as _template } from 'vue/vapor'; | ||
const t0 = _template("<div></div>") | ||
export function render(_ctx) { | ||
const n0 = t0() | ||
_renderEffect(() => _setDOMProp(n0, "fooBar", _ctx.fooBar)) | ||
_setInheritAttrs(["fooBar"]) | ||
_renderEffect(() => _setDOMProp(n0, "fooBar", _ctx.fooBar, true)) | ||
return n0 | ||
}" | ||
`; | ||
|
||
exports[`compiler v-bind > .prop modifier (shorthand) 1`] = ` | ||
"import { renderEffect as _renderEffect, setDOMProp as _setDOMProp, template as _template } from 'vue/vapor'; | ||
"import { setInheritAttrs as _setInheritAttrs, renderEffect as _renderEffect, setDOMProp as _setDOMProp, template as _template } from 'vue/vapor'; | ||
const t0 = _template("<div></div>") | ||
export function render(_ctx) { | ||
const n0 = t0() | ||
_renderEffect(() => _setDOMProp(n0, "fooBar", _ctx.id)) | ||
_setInheritAttrs(["fooBar"]) | ||
_renderEffect(() => _setDOMProp(n0, "fooBar", _ctx.id, true)) | ||
return n0 | ||
}" | ||
`; | ||
|
||
exports[`compiler v-bind > .prop modifier 1`] = ` | ||
"import { renderEffect as _renderEffect, setDOMProp as _setDOMProp, template as _template } from 'vue/vapor'; | ||
"import { setInheritAttrs as _setInheritAttrs, renderEffect as _renderEffect, setDOMProp as _setDOMProp, template as _template } from 'vue/vapor'; | ||
const t0 = _template("<div></div>") | ||
export function render(_ctx) { | ||
const n0 = t0() | ||
_renderEffect(() => _setDOMProp(n0, "fooBar", _ctx.id)) | ||
_setInheritAttrs(["fooBar"]) | ||
_renderEffect(() => _setDOMProp(n0, "fooBar", _ctx.id, true)) | ||
return n0 | ||
}" | ||
`; | ||
|
||
exports[`compiler v-bind > .prop modifier w/ dynamic arg 1`] = ` | ||
"import { renderEffect as _renderEffect, setDynamicProps as _setDynamicProps, template as _template } from 'vue/vapor'; | ||
"import { setInheritAttrs as _setInheritAttrs, renderEffect as _renderEffect, setDynamicProps as _setDynamicProps, template as _template } from 'vue/vapor'; | ||
const t0 = _template("<div></div>") | ||
export function render(_ctx) { | ||
const n0 = t0() | ||
_renderEffect(() => _setDynamicProps(n0, { ["." + _ctx.fooBar]: _ctx.id })) | ||
_setInheritAttrs(true) | ||
_renderEffect(() => _setDynamicProps(n0, [{ ["." + _ctx.fooBar]: _ctx.id }], true)) | ||
return n0 | ||
}" | ||
`; | ||
|
||
exports[`compiler v-bind > .prop modifier w/ no expression 1`] = ` | ||
"import { renderEffect as _renderEffect, setDOMProp as _setDOMProp, template as _template } from 'vue/vapor'; | ||
"import { setInheritAttrs as _setInheritAttrs, renderEffect as _renderEffect, setDOMProp as _setDOMProp, template as _template } from 'vue/vapor'; | ||
const t0 = _template("<div></div>") | ||
export function render(_ctx) { | ||
const n0 = t0() | ||
_renderEffect(() => _setDOMProp(n0, "fooBar", _ctx.fooBar)) | ||
_setInheritAttrs(["fooBar"]) | ||
_renderEffect(() => _setDOMProp(n0, "fooBar", _ctx.fooBar, true)) | ||
return n0 | ||
}" | ||
`; | ||
|
||
exports[`compiler v-bind > basic 1`] = ` | ||
"import { renderEffect as _renderEffect, setDynamicProp as _setDynamicProp, template as _template } from 'vue/vapor'; | ||
"import { setInheritAttrs as _setInheritAttrs, renderEffect as _renderEffect, setDynamicProp as _setDynamicProp, template as _template } from 'vue/vapor'; | ||
const t0 = _template("<div></div>") | ||
export function render(_ctx) { | ||
const n0 = t0() | ||
_renderEffect(() => _setDynamicProp(n0, "id", _ctx.id)) | ||
_setInheritAttrs(["id"]) | ||
_renderEffect(() => _setDynamicProp(n0, "id", _ctx.id, true)) | ||
return n0 | ||
}" | ||
`; | ||
|
||
exports[`compiler v-bind > dynamic arg 1`] = ` | ||
"import { renderEffect as _renderEffect, setDynamicProps as _setDynamicProps, template as _template } from 'vue/vapor'; | ||
"import { setInheritAttrs as _setInheritAttrs, renderEffect as _renderEffect, setDynamicProps as _setDynamicProps, template as _template } from 'vue/vapor'; | ||
const t0 = _template("<div></div>") | ||
export function render(_ctx) { | ||
const n0 = t0() | ||
_renderEffect(() => _setDynamicProps(n0, { [_ctx.id]: _ctx.id, [_ctx.title]: _ctx.title })) | ||
_setInheritAttrs(true) | ||
_renderEffect(() => _setDynamicProps(n0, [{ [_ctx.id]: _ctx.id, [_ctx.title]: _ctx.title }], true)) | ||
return n0 | ||
}" | ||
`; | ||
|
||
exports[`compiler v-bind > dynamic arg w/ static attribute 1`] = ` | ||
"import { renderEffect as _renderEffect, setDynamicProps as _setDynamicProps, template as _template } from 'vue/vapor'; | ||
"import { setInheritAttrs as _setInheritAttrs, renderEffect as _renderEffect, setDynamicProps as _setDynamicProps, template as _template } from 'vue/vapor'; | ||
const t0 = _template("<div></div>") | ||
export function render(_ctx) { | ||
const n0 = t0() | ||
_renderEffect(() => _setDynamicProps(n0, { [_ctx.id]: _ctx.id, foo: "bar", checked: "" })) | ||
_setInheritAttrs(true) | ||
_renderEffect(() => _setDynamicProps(n0, [{ [_ctx.id]: _ctx.id, foo: "bar", checked: "" }], true)) | ||
return n0 | ||
}" | ||
`; | ||
|
||
exports[`compiler v-bind > no expression (shorthand) 1`] = ` | ||
"import { renderEffect as _renderEffect, setDynamicProp as _setDynamicProp, template as _template } from 'vue/vapor'; | ||
"import { setInheritAttrs as _setInheritAttrs, renderEffect as _renderEffect, setDynamicProp as _setDynamicProp, template as _template } from 'vue/vapor'; | ||
const t0 = _template("<div></div>") | ||
export function render(_ctx) { | ||
const n0 = t0() | ||
_renderEffect(() => _setDynamicProp(n0, "camel-case", _ctx.camelCase)) | ||
_setInheritAttrs(["camel-case"]) | ||
_renderEffect(() => _setDynamicProp(n0, "camel-case", _ctx.camelCase, true)) | ||
return n0 | ||
}" | ||
`; | ||
|
||
exports[`compiler v-bind > no expression 1`] = ` | ||
"import { renderEffect as _renderEffect, setDynamicProp as _setDynamicProp, template as _template } from 'vue/vapor'; | ||
"import { setInheritAttrs as _setInheritAttrs, renderEffect as _renderEffect, setDynamicProp as _setDynamicProp, template as _template } from 'vue/vapor'; | ||
const t0 = _template("<div></div>") | ||
export function render(_ctx) { | ||
const n0 = t0() | ||
_renderEffect(() => _setDynamicProp(n0, "id", _ctx.id)) | ||
_setInheritAttrs(["id"]) | ||
_renderEffect(() => _setDynamicProp(n0, "id", _ctx.id, true)) | ||
return n0 | ||
}" | ||
`; | ||
|
||
exports[`compiler v-bind > should error if empty expression 1`] = ` | ||
"import { template as _template } from 'vue/vapor'; | ||
"import { setInheritAttrs as _setInheritAttrs, template as _template } from 'vue/vapor'; | ||
const t0 = _template("<div arg></div>") | ||
export function render(_ctx) { | ||
const n0 = t0() | ||
_setInheritAttrs(false) | ||
return n0 | ||
}" | ||
`; |
Oops, something went wrong.