run.php 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. <?php
  2. /**
  3. * Created by JetBrains PhpStorm.
  4. * User: dongyancen
  5. * Date: 13-10-10
  6. * Time: 上午1:17
  7. * To change this template use File | Settings | File Templates.
  8. */
  9. header( "Content-type: text/html; charset=utf-8" );
  10. header( "Cache-Control: no-cache, max-age=10, must-revalidate" );
  11. if ( !array_key_exists( 'quirk' , $_GET ) ) {
  12. print '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">';
  13. }
  14. ;
  15. require_once "caseSource.php";
  16. $c = new Kiss( $_GET[ 'case' ] );
  17. $title = $c->name;
  18. $cov = array_key_exists( 'cov' , $_GET );
  19. ?>
  20. <html>
  21. <head>
  22. <title>Jasmine Spec Runner</title>
  23. <link rel="shortcut icon" type="image/png" href="lib/jasmine-1.3.0/jasmine_favicon.png">
  24. <link rel="stylesheet" type="text/css" href="lib/jasmine-1.3.0/jasmine.css">
  25. <script type="text/javascript" src="lib/jasmine-1.3.0/jasmine.js"></script>
  26. <script type="text/javascript" src="lib/jasmine-1.3.0/jasmine-html.js"></script>
  27. <script type="text/javascript" src="js/ext_jasmine.js"></script>
  28. <?php $c->print_js($cov); ?>
  29. </head>
  30. <script type="text/javascript">
  31. //todo
  32. // if (parent && parent.brtest) {
  33. // parent.$(parent.brtest).trigger('done', [ new Date().getTime(), {
  34. // failed : args[0],
  35. // passed : args[1],
  36. // detail:args[2]
  37. // }, window._$jscoverage || null ]);
  38. // }
  39. (function() {
  40. var jasmineEnv = jasmine.getEnv();
  41. jasmineEnv.updateInterval = 1000;
  42. var htmlReporter = new jasmine.HtmlReporter();
  43. jasmineEnv.addReporter(htmlReporter);
  44. jasmineEnv.specFilter = function(spec) {
  45. return htmlReporter.specFilter(spec);
  46. };
  47. var currentWindowOnload = window.onload;
  48. window.onload = function() {
  49. if (currentWindowOnload) {
  50. currentWindowOnload();
  51. }
  52. execJasmine();
  53. };
  54. function execJasmine() {
  55. // jasmineEnv.beforeEach(function(){console.log(12)});
  56. // jasmine.Suite.beforeEach(function(){console.log(123)});
  57. // console.log(jasmineEnv.currentSpec);
  58. // jasmineEnv.currentSpec.start=function(){console.log(123)};
  59. jasmineEnv.execute();
  60. }
  61. })();
  62. </script>
  63. <body>
  64. </body>
  65. </html>