markdown.js 1004 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. casper.test.begin('markdown', 4, function (test) {
  2. casper
  3. .start('../../examples/markdown/index.html')
  4. .then(function () {
  5. test.assertEval(function () {
  6. return document.querySelector('textarea').value === '# hello'
  7. })
  8. test.assertEval(function () {
  9. return document.querySelector('#editor div')
  10. .innerHTML === '<h1 id="hello">hello</h1>\n'
  11. })
  12. })
  13. .then(function () {
  14. this.sendKeys(
  15. 'textarea',
  16. '## yo\n\n' +
  17. '- test\n' +
  18. '- hi\n\n'
  19. )
  20. // keyUp(13)
  21. })
  22. .then(function () {
  23. test.assertEval(function () {
  24. return document.querySelector('textarea').value
  25. === '## yo\n\n- test\n- hi\n\n# hello'
  26. })
  27. test.assertEval(function () {
  28. return document.querySelector('#editor div')
  29. .innerHTML ===
  30. '<h2 id="yo">yo</h2>\n' +
  31. '<ul>\n<li>test</li>\n<li>hi</li>\n</ul>\n' +
  32. '<h1 id="hello">hello</h1>\n'
  33. })
  34. })
  35. // run
  36. .run(function () {
  37. test.done()
  38. })
  39. })