Do not loose URL-parameters passed to jasmine.

This commit is contained in:
Marc Jansen
2012-06-22 12:12:29 +02:00
parent 3e15ce93bb
commit f6a728b074

View File

@@ -10,7 +10,7 @@
<!-- include source files here... -->
<script type="text/javascript">
// the following code includes the sourc-files of OpenLayers as they are
// the following code includes the source-files of OpenLayers as they are
// defined in ol.js.
//
// You can control in which form the source will be loaded by passing
@@ -36,10 +36,38 @@
mode = (modeResult && modeResult[1])
? modeResult[1]
: 'SIMPLE',
// Create the script tag which includes the derived variables from above
script = '<sc' + 'ript type="text/javascript" '
+ 'src="http://' + host + '/compile?id=ol&amp;mode=' + mode + '">'
+ '</scr' + 'ipt>';
+ '</scr' + 'ipt>',
// this function will fix the links of the result to also include
// the once defined URL Parametrs passed to the testsuite.
fixLinks = function() {
if (doc.getElementsByTagName) {
var candidates = doc.getElementsByTagName('a'),
link,
hrefExpression = /\?spec/,
i = 0, len = candidates.length;
for(; i < len; i++){
link = candidates[i];
if (hrefExpression.test(link.href)) {
link.href += '&host=' + encodeURIComponent(host)
+ '&mode=' + encodeURIComponent(mode);
}
}
}
};
// write out the script-tag to load the compiled result
doc.write(script);
// overwrite jasmines finishCallback to run the fixLinks method afterwards
jasmine.Runner.prototype.finishCallback = function() {
jasmine.getEnv().reporter.reportRunnerResults(this);
fixLinks();
};
})(document, location);
</script>
<!-- common jasmine extensions -->