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`
`,
({ get }) => {
get('span:nth-of-type(1)').should(haveAttribute('style', 'color: red; display: none;'))
get('span:nth-of-type(2)').should(haveAttribute('style', 'color: red; display: none;'))
}
)
test('x-show executes consecutive state changes in correct order',
html`
`,
({ get }) => {
get('button#enable').should(beVisible())
get('button#disable').should(beHidden())
}
)
test('x-show toggles display: none; with the !important property when using the .important modifier while respecting other style attributes',
html`