load list of spec files from the server

This commit is contained in:
Peter 'Pita' Martischka 2012-10-27 17:05:26 +01:00
parent cc7ddddd2f
commit cac27c864a
3 changed files with 18 additions and 10 deletions

View file

@ -1,6 +1,15 @@
var path = require("path"); var path = require("path");
var fs = require("fs");
exports.expressCreateServer = function (hook_name, args, cb) { exports.expressCreateServer = function (hook_name, args, cb) {
args.app.get('/tests/frontend/specs_list.js', function(req, res){
fs.readdir('tests/frontend/specs', function(err, files){
if(err){ return res.send(500); }
res.send("var specs_list = " + JSON.stringify(files.sort()) + ";\n");
});
});
args.app.get('/tests/frontend/*', function (req, res) { args.app.get('/tests/frontend/*', function (req, res) {
var subPath = req.url.substr("/tests/frontend".length); var subPath = req.url.substr("/tests/frontend".length);
if (subPath == ""){ if (subPath == ""){

View file

@ -18,15 +18,7 @@
<script src="lib/jquery.iframe.js"></script> <script src="lib/jquery.iframe.js"></script>
<script src="helper.js"></script> <script src="helper.js"></script>
<script src="specs/button_undo.js"></script> <script src="specs_list.js"></script>
<script src="specs/button_bold.js"></script>
<script src="specs/button_italic.js"></script>
<script src="specs/keystroke_urls_become_clickable.js"></script>
<script src="specs/keystroke_delete.js"></script>
<script src="specs/font_type.js"></script>
<script src="specs/embed_value.js"></script>
<script src="specs/keystroke_urls_become_clickable.js"></script>
<script src="specs/button_indentation.js"></script>
<script src="runner.js"></script> <script src="runner.js"></script>
</html> </html>

View file

@ -4,6 +4,13 @@ $(function(){
document.domain = document.domain; // for comet document.domain = document.domain; // for comet
} }
var specs = specs_list.slice();
var $body = $('body')
$.each(specs, function(i, spec){
$body.append('<script src="specs/' + spec + '"></script>')
});
//initalize the test helper //initalize the test helper
helper.init(function(){ helper.init(function(){
//configure and start the test framework //configure and start the test framework