2
0

test1-script.html 646 B

123456789101112131415161718192021
  1. <script language="javascript">
  2. var TestFixture = {
  3. test_button: function() {
  4. JSUnit_BindElement ("text");
  5. Assert.NotNull ("JSUnit_GetElement()", "text element exists");
  6. Assert.NotNull ("JSUnit_GetElement('button')", "button element exists");
  7. Assert.AreEqual ("you haven't clicked me...", "JSUnit_GetElement().innerHTML", "initial text");
  8. var button = JSUnit_GetElement ("button");
  9. JSUnit_Click(button);
  10. /* it's okay to put stuff after this JSUnit_Click call since
  11. * we didn't call JSUnit_TestCausesPageLoad */
  12. Assert.AreEqual ("you clicked me!", "JSUnit_GetElement().innerHTML", "text after button click");
  13. }
  14. };
  15. </script>