Do not loose URL-parameters passed to jasmine.
This commit is contained in:
+30
-2
@@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
<!-- include source files here... -->
|
<!-- include source files here... -->
|
||||||
<script type="text/javascript">
|
<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.
|
// defined in ol.js.
|
||||||
//
|
//
|
||||||
// You can control in which form the source will be loaded by passing
|
// You can control in which form the source will be loaded by passing
|
||||||
@@ -36,10 +36,38 @@
|
|||||||
mode = (modeResult && modeResult[1])
|
mode = (modeResult && modeResult[1])
|
||||||
? modeResult[1]
|
? modeResult[1]
|
||||||
: 'SIMPLE',
|
: 'SIMPLE',
|
||||||
|
|
||||||
|
// Create the script tag which includes the derived variables from above
|
||||||
script = '<sc' + 'ript type="text/javascript" '
|
script = '<sc' + 'ript type="text/javascript" '
|
||||||
+ 'src="http://' + host + '/compile?id=ol&mode=' + mode + '">'
|
+ 'src="http://' + host + '/compile?id=ol&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);
|
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);
|
})(document, location);
|
||||||
</script>
|
</script>
|
||||||
<!-- common jasmine extensions -->
|
<!-- common jasmine extensions -->
|
||||||
|
|||||||
Reference in New Issue
Block a user