import { beEqualTo, beVisible, haveText, html, notBeVisible, test } from '../../utils'
test('can use a x-teleport',
[html`
`],
({ get }) => {
get('#b span').should(haveText('1'))
get('button').click()
get('#b span').should(haveText('2'))
},
)
test('can teleport multiple',
[html`
`],
({ get }) => {
get('#b h1').should(haveText('1'))
get('#b h2').should(haveText('2'))
get('button').click()
get('#b h1').should(haveText('2'))
get('#b h2').should(haveText('3'))
},
)
test('teleported targets forward events to teleport source if listeners are attached',
[html`
`],
({ get }) => {
get('#b h1').should(haveText('1'))
get('button').click()
get('#b h1').should(haveText('2'))
get('h1').click()
get('#b h1').should(haveText('3'))
},
)
test('removing teleport source removes teleported target',
[html`
`],
({ get }) => {
get('#b h1').should(beVisible())
get('button').click()
get('#b h1').should(notBeVisible())
},
)
test('$refs inside teleport can be accessed outside',
[html`
`],
({ get }) => {
get('#b h1').should(beVisible())
get('button').click()
get('#b h1').should(notBeVisible())
},
)
test('$root is accessed outside teleport',
[html`
`],
({ get }) => {
get('#b h1').should(beVisible())
get('#b h1').should(haveText('a'))
},
)
test('$id honors x-id outside teleport',
[html`
`],
({ get }) => {
get('#b h1').should(haveText('foo-1'))
},
)