Posted By

brianyang on 12/11/09


Tagged


Versions (?)

QUnit TDD snippet


 / Published in: HTML
 

  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  2. <head>
  3. <link rel="stylesheet" href="core/qunit.css" type="text/css"/>
  4. <script src="http://code.jquery.com/jquery-latest.js">
  5. </script>
  6. <script type="text/javascript" src="core/qunit.js">
  7. </script>
  8. <script type="text/javascript">
  9. // --- Unittest Code goes here ---
  10. </script>
  11. $(document).ready(function(){
  12. module("Basic Unit Test");
  13. test("Sample test", function(){
  14. expect(1);
  15. equals(divide(4, 2), 2, 'Expected 2 as the result, result was: ' + divide(4, 2));
  16. });
  17. });
  18. </script>
  19. </head>
  20. <body>
  21. <h1 id="qunit-header">QUnit example</h1>
  22. <h2 id="qunit-banner"></h2>
  23. <h2 id="qunit-userAgent"></h2>
  24. <ol id="qunit-tests">
  25. </ol>
  26. </body>
  27. </html>

Report this snippet  

You need to login to post a comment.