nested-props.js 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. casper.test.begin('Nested Properties', 20, function (test) {
  2. casper
  3. .start('./fixtures/nested-props.html', function () {
  4. test.assertSelectorHasText('h1 span', '')
  5. test.assertSelectorHasText('h2 span', '555')
  6. test.assertSelectorHasText('h3 span', 'Yoyoyo555')
  7. this.click('.one')
  8. test.assertSelectorHasText('h1 span', 'one')
  9. test.assertSelectorHasText('h2 span', '1')
  10. test.assertSelectorHasText('h3 span', 'Yoyoyoone1')
  11. this.click('.two')
  12. test.assertSelectorHasText('h1 span', 'two')
  13. test.assertSelectorHasText('h2 span', '2')
  14. test.assertSelectorHasText('h3 span', 'Yoyoyotwo2')
  15. this.click('.three')
  16. test.assertSelectorHasText('h1 span', 'three')
  17. test.assertSelectorHasText('h2 span', '3')
  18. test.assertSelectorHasText('h3 span', 'Yoyoyothree3')
  19. this.fill('#form', {
  20. msg: 'Oh yeah '
  21. })
  22. test.assertSelectorHasText('h3 span', 'Oh yeah three3')
  23. // hidden scope variables
  24. // i.e. nested under an object, not explicitly
  25. // bound in the template, but is depended upon
  26. // by an expression or a computed property
  27. test.assertSelectorHasText('.hidden', '3')
  28. this.click('.four')
  29. test.assertSelectorHasText('.hidden', '4')
  30. // set a nested object to {}
  31. this.click('.empty1')
  32. test.assertSelectorHasText('h1 span', '')
  33. test.assertSelectorHasText('h3 span', 'Oh yeah 3')
  34. this.click('.empty2')
  35. test.assertSelectorHasText('h1 span', '')
  36. test.assertSelectorHasText('h2 span', '')
  37. test.assertSelectorHasText('h3 span', 'Oh yeah ')
  38. })
  39. .run(function () {
  40. test.done()
  41. })
  42. })