From 202805dc523ce98d57d17ed06c26ef5e81f42a74 Mon Sep 17 00:00:00 2001 From: Nathan Leniz Date: Tue, 20 Jan 2015 20:35:25 -0500 Subject: [PATCH] preparing for integration of testing --- public/css/main.less | 5 +++-- public/js/lib/bonfire/bonfire.js | 9 +++++++-- public/js/lib/bonfire/framework.js | 5 +++-- public/js/lib/bonfire/plugin_v0.1.1.js | 7 +++++-- 4 files changed, 18 insertions(+), 8 deletions(-) diff --git a/public/css/main.less b/public/css/main.less index d723d2c4e1..a4492ed832 100644 --- a/public/css/main.less +++ b/public/css/main.less @@ -536,8 +536,9 @@ form.code span { padding-bottom: 0px; } -.panel-bonfire { - min-height: 590px; +div.CodeMirror-scroll { + padding-bottom: 100px; + } //uncomment this to see the dimensions of all elements outlined in red diff --git a/public/js/lib/bonfire/bonfire.js b/public/js/lib/bonfire/bonfire.js index c5eefd75ff..5b9868bcf5 100644 --- a/public/js/lib/bonfire/bonfire.js +++ b/public/js/lib/bonfire/bonfire.js @@ -16,7 +16,12 @@ var submit = function(code) { // puts the message on the terminal var print = function(cls, msg) { - codeOutput.setValue(msg); + if (cls) { + codeOutput.setValue(msg); + } else { + codeOutput.setValue(msg.output); + console.log(msg.type); + } }; @@ -43,7 +48,7 @@ var api = { if (data.error) { print('message', data.error); } else { - print('output', data.output); + print(null, data); } } }; diff --git a/public/js/lib/bonfire/framework.js b/public/js/lib/bonfire/framework.js index 71a682dce4..51d8d5d6e4 100644 --- a/public/js/lib/bonfire/framework.js +++ b/public/js/lib/bonfire/framework.js @@ -8,6 +8,7 @@ var myCodeMirror = CodeMirror.fromTextArea(document.getElementById("codeEditor") matchBrackets: true, autoCloseBrackets: true, cursorHeight: 0.85, + scrollbarStyle: 'null', lineWrapping: true, gutters: ["CodeMirror-lint-markers"], onKeyEvent: doLinting, @@ -25,9 +26,9 @@ myCodeMirror.setValue('/*Welcome to Bonfire, Free Code Camp\'s future CoderByte ' return [1,2,3].map(function(elem) {\n' + ' return elem * elem;\n' + ' });\n' + -'}\n\n' + +'}\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n' + 'test();'); -myCodeMirror.setSize("100%", "100%"); +//myCodeMirror.setSize("100%", "100%"); var codeOutput = CodeMirror.fromTextArea(document.getElementById("codeOutput"), { lineNumbers: false, diff --git a/public/js/lib/bonfire/plugin_v0.1.1.js b/public/js/lib/bonfire/plugin_v0.1.1.js index 85c42a3c77..3c9942617b 100644 --- a/public/js/lib/bonfire/plugin_v0.1.1.js +++ b/public/js/lib/bonfire/plugin_v0.1.1.js @@ -4,11 +4,14 @@ var run = function(code) { var result = { input: code, output: null, - error: null + error: null, + type: null }; try { - result.output = stringify(runHidden(code)); + var codeExec = runHidden(code); + result.type = typeof codeExec; + result.output = stringify(codeExec); } catch(e) { result.error = e.message; }