Skip to content

Instantly share code, notes, and snippets.

@NorthDecoder
Last active April 10, 2018 20:26
Show Gist options
  • Save NorthDecoder/0a4ef12b4169ffe05c774563afeed3a7 to your computer and use it in GitHub Desktop.
Save NorthDecoder/0a4ef12b4169ffe05c774563afeed3a7 to your computer and use it in GitHub Desktop.
Jasmine TDD specification runner html template
<!DOCTYPE html>
<html>
<head>
<title>Jasmine SpecRunner</title>
<!-- https://jasmine.github.io/ -->
<meta charset="utf-8">
<!-- cdnjs.cloudflare.com -->
<!-- Jasmine -->
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/jasmine/3.1.0/jasmine.min.css"/>
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/jasmine/3.1.0/jasmine.min.js"></script>
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/jasmine/3.1.0/jasmine-html.min.js"></script>
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/jasmine/3.1.0/boot.min.js"></script>
</head>
<body>
<!-- The order of loading here matters; FIFO, so put lib loader first! -->
<!-- Loads stuff like jQuery and bootstrap and theme css into the html head tag -->
<script type="text/javascript" src="../js/loaders/load_requisite_libraries_for_this_app.js" defer></script>
<!-- Loads the application specific scripts into the html head tag -->
<!-- code to be tested -->
<script type="text/javascript" src="../js/loaders/load_requisite_modules_for_this_app.js" defer></script>
<!-- test specs -->
<script type="text/javascript" src="./specs/loaders/load_specifications_into_SpecRunner.js" defer></script>
<!-- test results auto populate here ;) -->
</body>
</html>
/**
* Load the requisit scripts for this application
* Usage:
* Put the script links for url or path in an array for scripts
* and for css files respectively. There is a separate
* section for each.
*
* ['//my/path/to/lib1.js',
* '//another/url/to/lib2.js'
* ]
*
* Reference:
* https://www.html5rocks.com/en/tutorials/speed/script-loading/
*
*/
/** Chose the scripts and themes depending on your application,
maybe you will have a completely different requirement. Do NOT
blindly copy and paste. Think about what scripts are needed
here.
*/
/** Scripts */
[
'//cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js',
'//cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.0/umd/popper.min.js',
'//stackpath.bootstrapcdn.com/bootstrap/4.1.0/js/bootstrap.min.js'
].forEach(function(src) {
var script = document.createElement('script');
script.src = src;
script.async = false;
document.head.appendChild(script);
});
/** Themes */
[
'//cdnjs.cloudflare.com/ajax/libs/bootswatch/3.3.6/sandstone/bootstrap.min.css'
].forEach(function(src) {
var link = document.createElement('link');
link.rel = 'stylesheet';
link.href = src;
document.head.appendChild(link);
});
/**
* Load the requisit scripts for this application
* Usage:
* Put the script links for url or path in an array for scripts.
*
* ['//my/path/to/lib1.js',
* '//another/url/to/lib2.js'
* ]
*
* Reference:
* https://www.html5rocks.com/en/tutorials/speed/script-loading/
*
*/
/** Scripts */
[
'../js/dev_script1.js',
'../js/app.js',
'../js/ux.js'
].forEach(function(src) {
var script = document.createElement('script');
script.src = src;
script.async = false;
document.head.appendChild(script);
});
/**
* Load the requisit scripts for this application
* Usage:
* Put the script links for url or path in an array for scripts.
*
* ['./specs/app_spec1.js',
* './specs/app_spec2.js'
* ]
*
* Remember this path is relative to the SpecRunner.html directory (not the html directory)
*
* Reference:
* https://www.html5rocks.com/en/tutorials/speed/script-loading/
*
*/
/** Scripts */
[ './specs/app_spec.js'
].forEach(function(src) {
var script = document.createElement('script');
script.src = src;
script.async = false;
document.head.appendChild(script);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment