From 5b311b8943d680fc3a659585211e97fe5b08fe97 Mon Sep 17 00:00:00 2001 From: natac13 Date: Fri, 4 Sep 2015 13:48:51 -0400 Subject: [PATCH] Added tests to JavaScript Give Slot Machine Some Style The challenge could be passed by copying the code 3 times. Made new tests to stop this closes #2111 --- challenges/basic-javascript.json | 3 +++ 1 file changed, 3 insertions(+) diff --git a/challenges/basic-javascript.json b/challenges/basic-javascript.json index a4c3cabdb9..eec991ed7c 100644 --- a/challenges/basic-javascript.json +++ b/challenges/basic-javascript.json @@ -1609,6 +1609,9 @@ ], "tests":[ "assert((editor.match(/\\$\\(\\$\\(\\'\\.slot\\'\\)\\[\\d\\]\\)\\.html\\(\\'\\\\'\\);/gi) && editor.match(/\\$\\(\\$\\(\\'\\.slot\\'\\)\\[\\d\\]\\)\\.html\\(\\'\\\\'\\);/gi).length >= 3) || (editor.match(/\\$\\(\\$\\(\\\"\\.slot\\\"\\)\\[\\d\\]\\)\\.html\\(\\'\\\\'\\);/gi) && editor.match(/\\$\\(\\$\\(\\\"\\.slot\\\"\\)\\[\\d\\]\\)\\.html\\(\\'\\\\'\\);/gi).length >= 3), 'Use the provided code three times. One for each slot')", + "assert(editor.match(/\\$\\(\\$\\(\\'\\.slot\\'\\)\\[0\\]\\)/gi), 'You should have used $('.slot')[0] at least once')", + "assert(editor.match(/\\$\\(\\$\\(\\'\\.slot\\'\\)\\[1\\]\\)/gi), 'You should have used $('.slot')[1] at least once')", + "assert(editor.match(/\\$\\(\\$\\(\\'\\.slot\\'\\)\\[2\\]\\)/gi), 'You should have used $('.slot')[2] at least once')", "assert(editor.match(/slotOne/gi) && editor.match(/slotOne/gi).length >= 7, 'You should have used the slotOne value at least once')", "assert(editor.match(/slotTwo/gi) && editor.match(/slotTwo/gi).length >= 8, 'You should have used the slotTwo value at least once')", "assert(editor.match(/slotThree/gi) && editor.match(/slotThree/gi).length >= 7, 'You should have used the slotThree value at least once')"