repeated-vms.js 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. /* global app */
  2. casper.test.begin('Repeated ViewModels', 8, function (test) {
  3. casper
  4. .start('./fixtures/repeated-vms.html')
  5. .then(function () {
  6. test.assertSelectorHasText('.item:nth-child(1)', 'msg a init')
  7. test.assertSelectorHasText('.item:nth-child(2)', 'msg b init')
  8. test.assertSelectorHasText('.item:nth-child(3)', 'msg c init')
  9. })
  10. // click everything to test event handlers (delegated)
  11. .thenClick('.item:nth-child(1)', function () {
  12. test.assertSelectorHasText('.item:nth-child(1)', 'msg a init click')
  13. })
  14. .thenClick('.item:nth-child(2)', function () {
  15. test.assertSelectorHasText('.item:nth-child(2)', 'msg b init click')
  16. })
  17. .thenClick('.item:nth-child(3)', function () {
  18. test.assertSelectorHasText('.item:nth-child(3)', 'msg c init click')
  19. })
  20. // more clicks
  21. .thenClick('.item:nth-child(1)', function () {
  22. test.assertSelectorHasText('.item:nth-child(1)', 'msg a init click click')
  23. })
  24. .then(function () {
  25. test.assertEvalEquals(
  26. function () {
  27. return app.$.items[0].reversed
  28. },
  29. 'a init click click'.split('').reverse().join(''),
  30. 'should be able to access repeated vms with v-ref'
  31. )
  32. })
  33. .run(function () {
  34. test.done()
  35. })
  36. })