github.com/insionng/yougam@v0.0.0-20170714101924-2bc18d833463/public/libs/vue-1.0.24/test/e2e/markdown.js (about) 1 casper.test.begin('markdown', 5, 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 '## foo\n\n' + 17 '- bar\n' + 18 '- baz\n\n', 19 { keepFocus: true } 20 ) 21 // keyUp(13) 22 }) 23 .then(function () { 24 // assert the output is not updated yet because of 25 // debounce 26 test.assertEval(function () { 27 return document.querySelector('#editor div') 28 .innerHTML === '<h1 id="hello">hello</h1>\n' 29 }) 30 }) 31 .wait(300) // wait for debounce 32 .then(function () { 33 test.assertEval(function () { 34 return document.querySelector('textarea').value === 35 '## foo\n\n- bar\n- baz\n\n# hello' 36 }) 37 test.assertEval(function () { 38 return document.querySelector('#editor div') 39 .innerHTML === 40 '<h2 id="foo">foo</h2>\n' + 41 '<ul>\n<li>bar</li>\n<li>baz</li>\n</ul>\n' + 42 '<h1 id="hello">hello</h1>\n' 43 }) 44 }) 45 // run 46 .run(function () { 47 test.done() 48 }) 49 })