From 73d11fec271c92ed5e69270be224a1062b35a25d Mon Sep 17 00:00:00 2001 From: ahstro Date: Mon, 10 Aug 2015 18:42:36 +0200 Subject: [PATCH 1/6] Mocha tests now use ES6 --- package.json | 2 +- test/basic_routes.js | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/package.json b/package.json index b27597c4fb..c4d4b81528 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,7 @@ "prestart-production": "bower cache clean && bower install && gulp build && npm run build-production", "start-production": "node pm2Start", "lint": "eslint --ext=.js,.jsx .", - "test": "mocha" + "test": "mocha --compilers js:babel/register" }, "license": "(BSD-3-Clause AND CC-BY-SA-4.0)", "contributors": [ diff --git a/test/basic_routes.js b/test/basic_routes.js index a019e072ec..ac7d190787 100644 --- a/test/basic_routes.js +++ b/test/basic_routes.js @@ -1,10 +1,10 @@ var request = require('supertest'); var app = require('../server/server.js'); -describe('#ROUTES', function() { +describe('#ROUTES', function () { describe('GET /', function () { - it('should return 200 OK', function (done) { + it('should return 200 OK', (done) => { request(app) .get('/') .expect(200, done); @@ -12,7 +12,7 @@ describe('#ROUTES', function() { }); describe('GET /signin', function () { - it('should return 200 OK', function (done) { + it('should return 200 OK', (done) => { request(app) .get('/signin') .expect(200, done); @@ -20,7 +20,7 @@ describe('#ROUTES', function() { }); describe('GET /email-signup', function () { - it('should return 200 OK', function (done) { + it('should return 200 OK', (done) => { request(app) .get('/email-signup') .expect(200, done); @@ -28,15 +28,15 @@ describe('#ROUTES', function() { }); describe('GET /random-url', function () { - it('should return 302', function (done) { + it('should return 302', (done) => { request(app) .get('/reset') .expect(302, done); }); }); - describe('Get /camperName', function () { - it('should return 200', function (done) { + describe('GET /camperName', function () { + it('should return 200', (done) => { request(app) .get('/terakilobyte') .expect(200, done); From 8a9a8710daa9d22bde56a187dc76061514021c2d Mon Sep 17 00:00:00 2001 From: benmcmahon100 Date: Fri, 14 Aug 2015 12:08:40 +0100 Subject: [PATCH 2/6] Allow optional white space when nesting arrays --- seed/challenges/basic-javascript.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/seed/challenges/basic-javascript.json b/seed/challenges/basic-javascript.json index 0eab58b846..1c0ac89b89 100644 --- a/seed/challenges/basic-javascript.json +++ b/seed/challenges/basic-javascript.json @@ -450,7 +450,7 @@ "Let's now go create a nested array called myArray." ], "tests":[ - "assert((function(){if(typeof(myArray) !== 'undefined' && typeof(myArray) === 'object' && typeof(myArray[0]) !== 'undefined' && typeof(myArray[0]) === 'object' && editor.getValue().match(/\\[(.*)?\\[/g).length >= 1 && editor.getValue().match(/\\](.*)?\\]/g).length >= 1){return(true);}else{return(false);}})(), 'myArray should contain at least one array');" + "assert((function(){if(typeof(myArray) !== 'undefined' && typeof(myArray) === 'object' && typeof(myArray[0]) !== 'undefined' && typeof(myArray[0]) === 'object' && editor.getValue().match(/\\[\s?\\[/g).length >= 1 && editor.getValue().match(/\\]\s?\\]/g).length >= 1){return(true);}else{return(false);}})(), 'myArray should contain at least one array');" ], "challengeSeed":[ "var ourArray = [[\"the universe\", \"everything\"], 42];", From d0b5bcd0b09a1b654df9241db1797c5be7550a38 Mon Sep 17 00:00:00 2001 From: benmcmahon100 Date: Fri, 14 Aug 2015 20:26:05 +0100 Subject: [PATCH 3/6] Fixed a weird error involving RegEx and single quotes --- seed/challenges/basic-javascript.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/seed/challenges/basic-javascript.json b/seed/challenges/basic-javascript.json index 1c0ac89b89..573ee8a698 100644 --- a/seed/challenges/basic-javascript.json +++ b/seed/challenges/basic-javascript.json @@ -450,7 +450,7 @@ "Let's now go create a nested array called myArray." ], "tests":[ - "assert((function(){if(typeof(myArray) !== 'undefined' && typeof(myArray) === 'object' && typeof(myArray[0]) !== 'undefined' && typeof(myArray[0]) === 'object' && editor.getValue().match(/\\[\s?\\[/g).length >= 1 && editor.getValue().match(/\\]\s?\\]/g).length >= 1){return(true);}else{return(false);}})(), 'myArray should contain at least one array');" + "assert((function(){if(typeof(myArray) !== \"undefined\" && typeof(myArray) === \"object\" && typeof(myArray[0]) !== \"undefined\" && typeof(myArray[0]) === \"object\" && editor.getValue().match(/\\[\\s?\\[/g).length >= 1 && editor.getValue().match(/\\]\\s?\\]/g).length >= 1){return(true);}else{return(false);}})(), 'myArray should contain at least one array');" ], "challengeSeed":[ "var ourArray = [[\"the universe\", \"everything\"], 42];", From f07f74f523792ae32d6c061e1ddb40620b732f50 Mon Sep 17 00:00:00 2001 From: benmcmahon100 Date: Fri, 14 Aug 2015 21:45:25 +0100 Subject: [PATCH 4/6] Fixed a weird error involving RegEx and single quotes --- public/js/main_0.0.3.js | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/public/js/main_0.0.3.js b/public/js/main_0.0.3.js index 3d9f80acde..251e106c74 100644 --- a/public/js/main_0.0.3.js +++ b/public/js/main_0.0.3.js @@ -333,33 +333,31 @@ $(document).ready(function() { if(magiVal < 0){ magiVal = 0; } - magiVal = $(window).height()-($('.navbar').height()+$('.footer').height()); - if(magiVal < 0){ - magiVal = 0; - } $('.editorScrollDiv').css("height", (magiVal-85) + "px"); } magiVal = $(window).height()-($('.navbar').height()+$('.footer').height()); if(magiVal < 0){ magiVal = 0; } - $('.scroll-locker').css("min-height", $('.editorScrollDiv').height()).css("height",magiVal-85); + + console.log(magiVal); + + $('.scroll-locker').css("min-height", $('.editorScrollDiv').height()).css("height",magiVal-185); } else { $('.editorScrollDiv').css("max-height", 500 + "px"); - $('.scroll-locker').css('position', 'inherit').css('top', 'inherit').css('width', '100%').css('max-height', '85%').css('overflow-y', 'auto').css('overflow-x', 'hidden'); + $('.scroll-locker').css('position', 'inherit').css('top', 'inherit').css('width', '100%').css('max-height', '85%'); } } - if ($('.scroll-locker').offset()){ - $(document).ready(function(){ + if ($('.scroll-locker').html()){ + $('.scroll-locker').css('overflow-y', 'auto').css('overflow-x', 'hidden') lockTop(); $(window).on('resize', function(){ lockTop(); }); - $(window).scroll(function() { + $(window).on('scroll', function() { lockTop(); }); - }); } } }); From d784cfcd766c714452f87cab9a0e959057598aaf Mon Sep 17 00:00:00 2001 From: benmcmahon100 Date: Fri, 14 Aug 2015 21:46:13 +0100 Subject: [PATCH 5/6] Fix editor height locking features where it was displaying overflow instead of autoing --- public/js/main_0.0.3.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/public/js/main_0.0.3.js b/public/js/main_0.0.3.js index 251e106c74..a1916fe3e3 100644 --- a/public/js/main_0.0.3.js +++ b/public/js/main_0.0.3.js @@ -340,8 +340,6 @@ $(document).ready(function() { magiVal = 0; } - console.log(magiVal); - $('.scroll-locker').css("min-height", $('.editorScrollDiv').height()).css("height",magiVal-185); } else { From 6377cc124e3ff331556a2a88c9c10646a353b7ec Mon Sep 17 00:00:00 2001 From: benmcmahon100 Date: Fri, 14 Aug 2015 21:48:17 +0100 Subject: [PATCH 6/6] Moved a permanent set css prop from jquery to CSS --- public/css/main.less | 5 +++++ public/js/main_0.0.3.js | 1 - 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/public/css/main.less b/public/css/main.less index 12ed9d14ae..60b2d3b029 100644 --- a/public/css/main.less +++ b/public/css/main.less @@ -742,6 +742,11 @@ form.code span { width: 99%; } +.scroll-locker { + overflow-x: auto; + overflow-y: scroll; +} + .big-error-icon { font-size: 40px; color: @brand-danger; diff --git a/public/js/main_0.0.3.js b/public/js/main_0.0.3.js index a1916fe3e3..61cb831ece 100644 --- a/public/js/main_0.0.3.js +++ b/public/js/main_0.0.3.js @@ -348,7 +348,6 @@ $(document).ready(function() { } } if ($('.scroll-locker').html()){ - $('.scroll-locker').css('overflow-y', 'auto').css('overflow-x', 'hidden') lockTop(); $(window).on('resize', function(){ lockTop();