From 4dc08d74f86d942097414fb25e43a358bc437450 Mon Sep 17 00:00:00 2001 From: Fosna Date: Sun, 6 Mar 2016 08:50:53 +0100 Subject: [PATCH 1/2] In browser testing environment greatly simplified. --- src/css/style.css | 41 ---------------------- src/index.html | 31 +++-------------- src/js/logToDom.js | 81 ------------------------------------------- src/js/testRunner.js | 10 ------ src/solution.js | 0 src/trainingGround.js | 9 +++++ 6 files changed, 13 insertions(+), 159 deletions(-) delete mode 100644 src/css/style.css delete mode 100644 src/js/logToDom.js delete mode 100644 src/js/testRunner.js delete mode 100644 src/solution.js create mode 100644 src/trainingGround.js diff --git a/src/css/style.css b/src/css/style.css deleted file mode 100644 index 51ba32e..0000000 --- a/src/css/style.css +++ /dev/null @@ -1,41 +0,0 @@ -.notice { - padding: 15px; - background-color: #fafafa; - border-left: 6px solid #7f7f84; - margin-bottom: 10px; - -webkit-box-shadow: 0 5px 8px -6px rgba(0,0,0,.2); - -moz-box-shadow: 0 5px 8px -6px rgba(0,0,0,.2); - box-shadow: 0 5px 8px -6px rgba(0,0,0,.2); -} -.notice-sm { - padding: 10px; - font-size: 80%; -} -.notice-lg { - padding: 35px; - font-size: large; -} -.notice-success { - border-color: #80D651; -} -.notice-success>strong { - color: #80D651; -} -.notice-info { - border-color: #45ABCD; -} -.notice-info>strong { - color: #45ABCD; -} -.notice-warning { - border-color: #FEAF20; -} -.notice-warning>strong { - color: #FEAF20; -} -.notice-danger { - border-color: #d73814; -} -.notice-danger>strong { - color: #d73814; -} \ No newline at end of file diff --git a/src/index.html b/src/index.html index e5c3bbb..ea2bf95 100644 --- a/src/index.html +++ b/src/index.html @@ -3,42 +3,19 @@ - Code Wars Test Bench - + Code Wars Basic Test Bench
-

Code Wars Test Bench

- -
-
-
- -
-
-
-
-
-
- +

Code Wars Basic Test Bench

+

Copy your solution and your tests from Code Wars kata training screen to trainingGround.js. Check dev tools console for test results.

- - - + - - \ No newline at end of file diff --git a/src/js/logToDom.js b/src/js/logToDom.js deleted file mode 100644 index 8bf8b54..0000000 --- a/src/js/logToDom.js +++ /dev/null @@ -1,81 +0,0 @@ -//if console is not available until browser dev tools open initialize object -//and log function -if (!window.console) window.console = {}; -if (!window.console.log) window.console.log = function () { }; -if (!window.console.error) window.console.error = function () { }; - - -(function () { - "use strict"; - window.totalerrors = 0; - - - //var baseLogFunction = console.log; - var baseLogFunction = Function.prototype.bind.call(console.log, console); - console.log = function(){ - baseLogFunction.apply(console, arguments); - - var args = Array.prototype.slice.call(arguments); - for(var i=0;i 0){ - document.querySelector('#total-errors-container').removeAttribute('style'); - } - - } - }; - - function createLogNode(message, type){ - var node = document.createElement("div"); - node.className = node.className + "notice notice-" + type; - var textNode = document.createTextNode(message); - node.appendChild(textNode); - return node; - } - - function createHeading(message){ - var node = document.createElement("h2"); - var textNode = document.createTextNode(message); - node.appendChild(textNode); - return node; - } - - window.onerror = function(message, url, linenumber) { - console.error("JavaScript error: " + message + " on line " + - linenumber + " for " + url); - }; - - function setTextContent(element, text) { - while (element.firstChild!==null) - element.removeChild(element.firstChild); // remove all existing content - element.appendChild(document.createTextNode(text)); - } - -})(); \ No newline at end of file diff --git a/src/js/testRunner.js b/src/js/testRunner.js deleted file mode 100644 index cb96464..0000000 --- a/src/js/testRunner.js +++ /dev/null @@ -1,10 +0,0 @@ -try { - solutionTest(); -} catch (ex) { - if (ex.name && ex.name === "TestError") { - // Suppress exception throwing. - } else { - throw ex; - } -} - diff --git a/src/solution.js b/src/solution.js deleted file mode 100644 index e69de29..0000000 diff --git a/src/trainingGround.js b/src/trainingGround.js new file mode 100644 index 0000000..cf2928e --- /dev/null +++ b/src/trainingGround.js @@ -0,0 +1,9 @@ +// +// Your Solution: +function returnOne() { + return 2; +} + +// +// Your Test Cases: +Test.assertEquals(returnOne(), 1, "One should equal one."); \ No newline at end of file From cc3cc205d4835092821b20b540ecdf908e31604c Mon Sep 17 00:00:00 2001 From: Fosna Date: Sun, 6 Mar 2016 09:04:35 +0100 Subject: [PATCH 2/2] JavaScript test reference link. --- src/index.html | 1 + 1 file changed, 1 insertion(+) diff --git a/src/index.html b/src/index.html index ea2bf95..8c2c090 100644 --- a/src/index.html +++ b/src/index.html @@ -10,6 +10,7 @@

Code Wars Basic Test Bench

Copy your solution and your tests from Code Wars kata training screen to trainingGround.js. Check dev tools console for test results.

+

Code wars JavaScript test framewrok reference is available here.