Skip to content

Commit

Permalink
Add failing test
Browse files Browse the repository at this point in the history
  • Loading branch information
SimoTod committed Nov 29, 2024
1 parent 2c2bdb6 commit fff5c3a
Showing 1 changed file with 22 additions and 2 deletions.
24 changes: 22 additions & 2 deletions tests/cypress/integration/directives/x-ignore.spec.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { haveText, html, notHaveClasses, notHaveText, test } from '../../utils'
import { haveClasses, haveText, html, notHaveClasses, notHaveText, test } from '../../utils'

test('x-ignore',
html`
Expand All @@ -8,7 +8,9 @@ test('x-ignore',
</div>
</div>
`,
({ get }) => get('span').should(notHaveText('bar'))
({ get }) => {
get('span').should(notHaveText('bar'))
}
)

test('x-ignore.self',
Expand All @@ -24,3 +26,21 @@ test('x-ignore.self',
get('h1').should(notHaveClasses(['bar']))
}
)

test('can lazyload component',
html`
<div x-data="{ lazyLoad() {$el.querySelector('#lazy').removeAttribute('x-ignore'); Alpine.nextTick(() => Alpine.initTree($el.querySelector('#lazy')))} }">
<button @click="lazyLoad">Load</button>
<div x-data="{ foo: 'bar' }" id="lazy" x-ignore :class="foo">
<span x-text="foo"></span>
</div>
</div>
`,
({ get }) => {
get('span').should(notHaveText('bar'))
get('div#lazy').should(notHaveClasses(['bar']))
get('button').click()
get('span').should(haveText('bar'))
get('div#lazy').should(haveClasses(['bar']))
}
)

0 comments on commit fff5c3a

Please sign in to comment.