diff options
author | Kevin Decker <kpdecker@gmail.com> | 2013-12-26 13:58:04 -0800 |
---|---|---|
committer | Kevin Decker <kpdecker@gmail.com> | 2013-12-26 13:58:04 -0800 |
commit | 77fd7dcc1d995896b92e204ea1c77ba39bdb0f6e (patch) | |
tree | 15c8cc6e8b4dc15b0ceb5e8c32a7656b03608152 /spec/amd.html | |
parent | 9f1b3bcea09e9c7675b344044397ce7b49f1ccd9 (diff) | |
parent | 7311ab0b3f5e9e855f5c8817830a8a4950203964 (diff) | |
download | handlebars.js-77fd7dcc1d995896b92e204ea1c77ba39bdb0f6e.zip handlebars.js-77fd7dcc1d995896b92e204ea1c77ba39bdb0f6e.tar.gz handlebars.js-77fd7dcc1d995896b92e204ea1c77ba39bdb0f6e.tar.bz2 |
Merge pull request #686 from wycats/amd-tests
Falsy AMD module names in version 1.2.0
Diffstat (limited to 'spec/amd.html')
-rw-r--r-- | spec/amd.html | 73 |
1 files changed, 73 insertions, 0 deletions
diff --git a/spec/amd.html b/spec/amd.html new file mode 100644 index 0000000..544b576 --- /dev/null +++ b/spec/amd.html @@ -0,0 +1,73 @@ +<html> + <head> + <title>Mocha</title> + <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> + <meta name="viewport" content="width=device-width, initial-scale=1.0"> + + <link rel="stylesheet" href="/node_modules/mocha/mocha.css" /> + <style> + .headless .suite > h1, + .headless .test.pass { + display: none; + } + </style> + + <script> + // Show only errors in "headless", non-interactive mode. + if (/headless=true/.test(location.href)) { + document.documentElement.className = 'headless'; + } + </script> + <script src="/node_modules/mocha/mocha.js"></script> + <script> + mocha.setup('bdd'); + </script> + + <script src="/spec/env/require.js"></script> + + <script src="/spec/env/common.js"></script> + <script> + requirejs.config({ + paths: { + handlebars: '/dist/handlebars.amd', + tests: '/tmp/tests' + } + }); + + var CompilerContext = { + compile: function(template, options) { + var templateSpec = handlebarsEnv.precompile(template, options); + return handlebarsEnv.template(safeEval(templateSpec)); + }, + compileWithPartial: function(template, options) { + return handlebarsEnv.compile(template, options); + } + }; + + function safeEval(templateSpec) { + var ret; + eval('ret = ' + templateSpec); + return ret; + } + </script> + <script> + onload = function(){ + + require(['handlebars'], function(Handlebars) { + window.Handlebars = Handlebars['default']; + + require(['tests'], function(Handlebars) { + // The test harness leaks under FF. We should have decent global leak coverage from other tests + if (!navigator.userAgent.match(/Firefox\/([\d.]+)/)) { + mocha.checkLeaks(); + } + mocha.run(); + }); + }); + }; + </script> + </head> + <body> + <div id="mocha"></div> + </body> +</html> |