From 5067a2f1e1c525d161b5ebf024eeca4c135f3d25 Mon Sep 17 00:00:00 2001 From: natac13 Date: Sat, 5 Sep 2015 21:39:27 -0400 Subject: [PATCH] General improvements to jquery file added a few tests to account for single and double quotes fixed a typo added test to add clarity closes #3107 --- challenges/jquery.json | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/challenges/jquery.json b/challenges/jquery.json index 0ad2a48005..358ad754d8 100644 --- a/challenges/jquery.json +++ b/challenges/jquery.json @@ -263,9 +263,9 @@ "Use the addClass() jQuery function to give the element one new class for each selector: animated, shake, and btn-primary." ], "tests": [ - "assert(editor.match(/\\$\\(.*button/g), 'Use the $(\"button\") selector.')", - "assert(editor.match(/\\$\\(.*\\.btn/g), 'Use the $(\".btn\") selector.')", - "assert(editor.match(/\\$\\(.*#target1/g), 'Use the $(\"#target1\") selector.')", + "assert((editor.match(/\\$\\(\\'button\\'/g) || editor.match(/\\$\\(\"button\"/g)), 'Use the $(\"button\") selector.')", + "assert((editor.match(/\\$\\(\\'\\.btn\\'/g) || editor.match(/\\$\\(\"\\.btn\"/g)), 'Use the $(\".btn\") selector.')", + "assert((editor.match(/\\$\\(\\'#target1\\'/g) || editor.match(/\\$\\(\"#target1\"/g)), 'Use the $(\"#target1\") selector.')", "assert(editor.match(/addClass/g) && editor.match(/addClass/g).length > 2, 'Only add one class with each of your three selectors.')", "assert($(\"#target1\").hasClass(\"animated\") && $(\"#target1\").hasClass(\"shake\") && $(\"#target1\").hasClass(\"btn-primary\"), 'Your #target1 element should have the classes animatedshake and btn-primary.')", "assert(!editor.match(/class.*animated/g), 'Only use jQuery to add these classes to the element.')" @@ -627,7 +627,8 @@ ], "tests": [ "assert($(\"#left-well\").css(\"background-color\") === 'red' || $(\"#left-well\").css(\"background-color\") === 'rgb(255, 0, 0)' || $(\"#left-well\").css(\"background-color\").toLowerCase() === '#ff0000' || $(\"#left-well\").css(\"background-color\").toLowerCase() === '#f00', 'Your left-well element should have a red background.')", - "assert(editor.match(/\\.parent\\(\\)\\.css/g), 'You should use the parent() function to modify this element.')", + "assert(editor.match(/\\.parent\\(\\)\\.css/g), 'You should use the .parent() function to modify this element.')", + "assert((editor.match(/\\$\\(\\'#target1\\'\\)\\.parent/g) || editor.match(/\\$\\(\"#target1\"\\)\\.parent/g)), 'The .parent() method should be called on the #target1 element.')", "assert(editor.match(/
/g), 'Only use jQuery to add these classes to the element.')" ], "challengeSeed": [