validation.js 636 B

123456789101112131415161718192021222324
  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. this.evaluate(function () {
  10. document.querySelector('input').setSelectionRange(4,4)
  11. })
  12. this.sendKeys('input', 'hoho')
  13. })
  14. .then(function () {
  15. test.assertElementCount('.valid', 1)
  16. test.assertField('email', 'hihihoho@hello.com')
  17. })
  18. .run(function () {
  19. test.done()
  20. })
  21. })