tree.js 929 B

12345678910111213141516171819202122232425262728
  1. casper.test.begin('Tree View', 11, function (test) {
  2. casper
  3. .start('./fixtures/tree.html')
  4. .then(function () {
  5. test.assertElementCount('.item', 12)
  6. test.assertElementCount('ul', 5)
  7. test.assertSelectorHasText('.item.folder', 'My Tree')
  8. test.assertSelectorHasText('li:nth-child(1) .item.file', 'hello')
  9. test.assertSelectorHasText('li:nth-child(2) .item.file', 'wat')
  10. test.assertVisible('#root')
  11. test.assertNotVisible('#root li > ul')
  12. })
  13. .thenClick('.item.folder', function () {
  14. test.assertVisible('#root li > ul')
  15. test.assertNotVisible('#root li > ul li > ul')
  16. })
  17. .thenClick('#root li > ul .item.folder', function () {
  18. test.assertVisible('#root li > ul li > ul')
  19. })
  20. .thenClick('.item.folder', function () {
  21. test.assertNotVisible('#root li > ul')
  22. })
  23. .run(function () {
  24. test.done()
  25. })
  26. })