import { beVisible, haveText, html, notBeVisible, test } from '../../utils' test('x-if', html`
`, ({ get }) => { get('h1').should(notBeVisible()) get('button').click() get('h1').should(beVisible()) get('button').click() get('h1').should(notBeVisible()) } ) test('x-if inside x-for allows nested directives', html`
`, ({ get }) => { get('span').should(haveText('1')) } ) test('x-if initializes after being added to the DOM to allow x-ref to work', html`
`, ({ get }) => { get('li').should(haveText('bar')) } ) // If x-if evaluates to false, the expectation is that no sub-expressions will be evaluated. test('x-if removed dom does not evaluate reactive expressions in dom tree', html`
`, ({ get }) => { get('span').should(haveText('lebowski')) // Clicking button sets user=null and thus x-if="user" will evaluate to false. // If the sub-expression x-text="user.name" is evaluated, the button click // will produce an error because user is no longer defined and the test will fail get('button').click() get('span').should('not.exist') } )