repeated-vms.js 976 B

123456789101112131415161718192021222324252627
  1. casper.test.begin('Repeated ViewModels', 7, function (test) {
  2. casper
  3. .start('./fixtures/repeated-vms.html', function () {
  4. test.assertSelectorHasText('.item:nth-child(1)', 'msg a init')
  5. test.assertSelectorHasText('.item:nth-child(2)', 'msg b init')
  6. test.assertSelectorHasText('.item:nth-child(3)', 'msg c init')
  7. // click everything to test event handlers (delegated)
  8. this.click('.item:nth-child(1)')
  9. test.assertSelectorHasText('.item:nth-child(1)', 'msg a init click')
  10. this.click('.item:nth-child(2)')
  11. test.assertSelectorHasText('.item:nth-child(2)', 'msg b init click')
  12. this.click('.item:nth-child(3)')
  13. test.assertSelectorHasText('.item:nth-child(3)', 'msg c init click')
  14. // more clicks
  15. this.click('.item:nth-child(1)')
  16. test.assertSelectorHasText('.item:nth-child(1)', 'msg a init click click')
  17. })
  18. .run(function () {
  19. test.done()
  20. })
  21. })