refactor: rename <portal> to <teleport>
BREAKING CHANGE: `<portal>` has been renamed to `<teleport>`.
`target` prop is also renmaed to `to`, so the new usage will be:
```html
<Teleport to="#modal-layer" :disabled="isMobile">
<div class="modal">
hello
</div>
</Teleport>
```
The primary reason for the renaming is to avoid potential naming
conflict with [native portals](https://wicg.github.io/portals/).
This commit is contained in:
@@ -11,7 +11,7 @@ import {
|
||||
RESOLVE_DIRECTIVE,
|
||||
TO_HANDLERS,
|
||||
helperNameMap,
|
||||
PORTAL,
|
||||
TELEPORT,
|
||||
RESOLVE_DYNAMIC_COMPONENT,
|
||||
SUSPENSE,
|
||||
KEEP_ALIVE,
|
||||
@@ -272,16 +272,16 @@ describe('compiler: element transform', () => {
|
||||
})
|
||||
})
|
||||
|
||||
test('should handle <Portal> with normal children', () => {
|
||||
test('should handle <Teleport> with normal children', () => {
|
||||
function assert(tag: string) {
|
||||
const { root, node } = parseWithElementTransform(
|
||||
`<${tag} target="#foo"><span /></${tag}>`
|
||||
)
|
||||
expect(root.components.length).toBe(0)
|
||||
expect(root.helpers).toContain(PORTAL)
|
||||
expect(root.helpers).toContain(TELEPORT)
|
||||
|
||||
expect(node).toMatchObject({
|
||||
tag: PORTAL,
|
||||
tag: TELEPORT,
|
||||
props: createObjectMatcher({
|
||||
target: '#foo'
|
||||
}),
|
||||
@@ -298,8 +298,8 @@ describe('compiler: element transform', () => {
|
||||
})
|
||||
}
|
||||
|
||||
assert(`portal`)
|
||||
assert(`Portal`)
|
||||
assert(`teleport`)
|
||||
assert(`Teleport`)
|
||||
})
|
||||
|
||||
test('should handle <Suspense>', () => {
|
||||
|
||||
Reference in New Issue
Block a user