diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 00000000..ba1cf0ac --- /dev/null +++ b/.travis.yml @@ -0,0 +1,22 @@ +language: node_js +node_js: + - "0.8" +install: + - "bin/installDeps.sh" + - "export GIT_HASH=$(cat .git/HEAD | head -c 7)" +before_script: + - "tests/frontend/travis/sauce_tunnel.sh" +script: + - "tests/frontend/travis/runner.sh" +env: + global: + - secure: "oKA4KbSvyxMOFCiOa3hWswnaIrCmX60MfhBhD8xu8sodOqbdK5RUrxDJew9p\n1nNSewxoVmKhX0G5GxIABfGtdU1nrEzCEoejTDJIFmzEbcLcHpcyarouWLSY\nOpn11FKS1rnb69aflHM7K8l4dhrCkA2i0Dwwl8LN3HayGzDV2Rg=" + - SAUCE_USER=pita +jdk: + - oraclejdk6 +notifications: + email: + - petermartischka@googlemail.com + irc: + channels: + - "irc.freenode.org#etherpad-lite-dev" \ No newline at end of file diff --git a/bin/installDeps.sh b/bin/installDeps.sh index 15731ae9..ac2e68cf 100755 --- a/bin/installDeps.sh +++ b/bin/installDeps.sh @@ -69,7 +69,7 @@ echo "Ensure that all dependencies are up to date..." cd node_modules [ -e ep_etherpad-lite ] || ln -s ../src ep_etherpad-lite cd ep_etherpad-lite - npm install + npm install -s ) || { rm -rf node_modules exit 1 diff --git a/src/ep.json b/src/ep.json index 26e4f603..b96ef037 100644 --- a/src/ep.json +++ b/src/ep.json @@ -13,6 +13,7 @@ { "name": "importexport", "hooks": { "expressCreateServer": "ep_etherpad-lite/node/hooks/express/importexport:expressCreateServer" } }, { "name": "errorhandling", "hooks": { "expressCreateServer": "ep_etherpad-lite/node/hooks/express/errorhandling:expressCreateServer" } }, { "name": "socketio", "hooks": { "expressCreateServer": "ep_etherpad-lite/node/hooks/express/socketio:expressCreateServer" } }, + { "name": "tests", "hooks": { "expressCreateServer": "ep_etherpad-lite/node/hooks/express/tests:expressCreateServer" } }, { "name": "admin", "hooks": { "expressCreateServer": "ep_etherpad-lite/node/hooks/express/admin:expressCreateServer" } }, { "name": "adminplugins", "hooks": { "expressCreateServer": "ep_etherpad-lite/node/hooks/express/adminplugins:expressCreateServer", diff --git a/src/node/hooks/express/tests.js b/src/node/hooks/express/tests.js new file mode 100644 index 00000000..7921da5a --- /dev/null +++ b/src/node/hooks/express/tests.js @@ -0,0 +1,46 @@ +var path = require("path"); +var fs = require("fs"); + +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"); + }); + }); + + var url2FilePath = function(url){ + var subPath = url.substr("/tests/frontend".length); + if (subPath == ""){ + subPath = "index.html" + } + subPath = subPath.split("?")[0]; + + var filePath = path.normalize(__dirname + "/../../../../tests/frontend/") + filePath += subPath.replace("..", ""); + return filePath; + } + + args.app.get('/tests/frontend/specs/*', function (req, res) { + var specFilePath = url2FilePath(req.url); + var specFileName = path.basename(specFilePath); + + fs.readFile(specFilePath, function(err, content){ + if(err){ return res.send(500); } + + content = "describe(" + JSON.stringify(specFileName) + ", function(){ " + content + " });"; + + res.send(content); + }); + }); + + args.app.get('/tests/frontend/*', function (req, res) { + var filePath = url2FilePath(req.url); + res.sendfile(filePath); + }); + + args.app.get('/tests/frontend', function (req, res) { + res.redirect('/tests/frontend/'); + }); +} \ No newline at end of file diff --git a/src/package.json b/src/package.json index c3c4968a..cb1f38d9 100644 --- a/src/package.json +++ b/src/package.json @@ -39,7 +39,8 @@ }, "bin": { "etherpad-lite": "./node/server.js" }, "devDependencies": { - "jshint" : "*" + "jshint" : "*", + "wd" : "0.0.26" }, "engines" : { "node" : ">=0.6.0", "npm" : ">=1.0" diff --git a/src/static/js/chat.js b/src/static/js/chat.js index 486c7256..4493ed15 100644 --- a/src/static/js/chat.js +++ b/src/static/js/chat.js @@ -150,7 +150,7 @@ var chat = (function() $("#chatinput").keypress(function(evt) { //if the user typed enter, fire the send - if(evt.which == 13) + if(evt.which == 13 || evt.which == 10) { evt.preventDefault(); self.send(); diff --git a/src/static/js/pad.js b/src/static/js/pad.js index c55f8dfe..52d61648 100644 --- a/src/static/js/pad.js +++ b/src/static/js/pad.js @@ -389,6 +389,10 @@ function handshake() }); // Bind the colorpicker var fb = $('#colorpicker').farbtastic({ callback: '#mycolorpickerpreview', width: 220}); + // Bind the read only button + $('#readonlyinput').on('click',function(){ + padeditbar.setEmbedLinks(); + }); } var pad = { diff --git a/src/templates/pad.html b/src/templates/pad.html index 6136d895..161947ed 100644 --- a/src/templates/pad.html +++ b/src/templates/pad.html @@ -305,7 +305,7 @@