import { beEqualTo, beVisible, haveText, html, notBeVisible, test } from '../../utils' test('can use a portal', [html`
`], ({ get }) => { get('#b span').should(haveText('1')) get('button').click() get('#b span').should(haveText('2')) }, ) test('can send multiple to a portal', [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('portal targets forward events to portal 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 portal source removes portal target', [html`
`], ({ get }) => { get('#b h1').should(beVisible()) get('button').click() get('#b h1').should(notBeVisible()) }, ) test('$refs inside portal can be accessed outside', [html`
`], ({ get }) => { get('#b h1').should(beVisible()) get('button').click() get('#b h1').should(notBeVisible()) }, ) // Portal can only have one root. // works with transition groups // works with $ids // works with refs // works with root