validation.js 654 B

12345678910111213141516171819202122232425
  1. casper.test.begin('Validation', 4, function (test) {
  2. casper
  3. .start('./fixtures/validation.html', function () {
  4. test.assertElementCount('.valid', 0)
  5. this.sendKeys('input', '@hello.com')
  6. })
  7. .then(function () {
  8. test.assertElementCount('.valid', 1)
  9. })
  10. .thenEvaluate(function () {
  11. document.querySelector('input').setSelectionRange(4,4)
  12. })
  13. .then(function () {
  14. this.sendKeys('input', 'hoho')
  15. })
  16. .then(function () {
  17. test.assertElementCount('.valid', 1)
  18. test.assertField('email', 'hihihoho@hello.com')
  19. })
  20. .run(function () {
  21. test.done()
  22. })
  23. })