repeated-vms.js 1.0 KB

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