1
0

intersect.spec.js 645 B

123456789101112131415161718192021
  1. import { haveText, test, html } from '../../utils'
  2. test('can intersect',
  3. [html`
  4. <div x-data="{ count: 0 }" x-init="setTimeout(() => count++, 300)">
  5. <span x-text="count"></span>
  6. <div x-intersect="count++" style="margin-top: 100vh;" id="1">hi</div>
  7. </div>
  8. `],
  9. ({ get }, reload) => {
  10. get('span').should(haveText('0'))
  11. get('span').should(haveText('1'))
  12. get('#1').scrollIntoView()
  13. get('span').should(haveText('1'))
  14. get('span').scrollIntoView()
  15. get('span').should(haveText('1'))
  16. get('#1').scrollIntoView()
  17. get('span').should(haveText('2'))
  18. },
  19. )