forms.js 995 B

123456789101112131415161718192021222324252627282930313233
  1. casper.test.begin('Forms', 10, function (test) {
  2. casper
  3. .start('./fixtures/forms.html')
  4. .then(function () {
  5. // test initial value binding
  6. test.assertField('text', 'some text')
  7. test.assertField('checkbox', true)
  8. test.assertField('radio', 'b')
  9. test.assertField('select', 'b')
  10. test.assertField('textarea', 'more text')
  11. })
  12. .then(function () {
  13. this.fill('#forms', {
  14. 'text': 'changed text',
  15. 'checkbox': false,
  16. 'radio': 'a',
  17. 'select': 'a',
  18. 'textarea': 'more changed text'
  19. })
  20. })
  21. .then(function () {
  22. test.assertSelectorHasText('.text', 'changed text')
  23. test.assertSelectorHasText('.checkbox', 'false')
  24. test.assertSelectorHasText('.radio', 'a')
  25. test.assertSelectorHasText('.select', 'a')
  26. test.assertSelectorHasText('.textarea', 'more changed text')
  27. })
  28. .run(function () {
  29. test.done()
  30. })
  31. })