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('button:nth-of-type(1)').should(beVisible()) get('button:nth-of-type(1)').should(haveAttribute('style', 'background: #999')) get('button:nth-of-type(2)').should(beVisible()) get('button:nth-of-type(2)').should(haveAttribute('style', 'background: #999')) get('button:nth-of-type(1)').click() get('button:nth-of-type(1)').should(beHidden()) get('button:nth-of-type(1)').should(haveAttribute('style', 'background: rgb(153, 153, 153); display: none;')) get('button:nth-of-type(2)').should(beVisible()) get('button:nth-of-type(2)').should(haveAttribute('style', 'background: #999')) } ) test('x-show takes precedence over style bindings for display property', html`
thing thing
`, ({ 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;')) } )