import { beHidden, beVisible, haveAttribute, html, test } from '../../utils'
test('x-show toggles display: none; with no other style attributes',
html`
thing
`,
({ get }) => {
get('span').should(beVisible())
get('button').click()
get('span').should(beHidden())
}
)
test('x-show (with true default) toggles display: none; even if it exists with the page load',
html`
thing
`,
({ get }) => {
get('span').should(beVisible())
get('button').click()
get('span').should(beHidden())
}
)
test('x-show (with false default) toggles display: none; even if it exists with the page load',
html`
thing
`,
({ get }) => {
get('span').should(beHidden())
get('button').click()
get('span').should(beVisible())
}
)
test('x-show toggles display: none; with other style attributes',
html`
thing
`,
({ get }) => {
get('span').should(beVisible())
get('span').should(haveAttribute('style', 'color: blue;'))
get('button').click()
get('span').should(beHidden())
get('span').should(haveAttribute('style', 'color: blue; display: none;'))
}
)
test('x-show waits for transitions within it to finish before hiding an elements',
html`
thing
`,
({ get }) => {
get('span').should(beVisible())
get('button').click()
get('span').should(beVisible())
get('h1').should(beHidden())
get('span').should(beHidden())
}
)
test('x-show does NOT wait for transitions to finish if .immediate is present',
html`
thing
`,
({ get }) => {
get('span').should(beVisible())
get('button').click()
get('span').should(beHidden())
}
)
test('x-show with x-bind:style inside x-for works correctly',
html`