From 42bc9fa9b6f3dc4903f93990b25395f6ec568edc Mon Sep 17 00:00:00 2001
From: Randell Dawson <5313213+RandellDawson@users.noreply.github.com>
Date: Wed, 10 Apr 2019 06:51:52 -0700
Subject: [PATCH] fix(curriculum): Made tests not accept invalid HTML (#35774)
* fix: made tests stricter
* fix: simplify text
Co-Authored-By: RandellDawson <5313213+RandellDawson@users.noreply.github.com>
---
.../add-images-to-your-website.english.md | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/curriculum/challenges/english/01-responsive-web-design/basic-html-and-html5/add-images-to-your-website.english.md b/curriculum/challenges/english/01-responsive-web-design/basic-html-and-html5/add-images-to-your-website.english.md
index fde6699cb3..dd558769f2 100644
--- a/curriculum/challenges/english/01-responsive-web-design/basic-html-and-html5/add-images-to-your-website.english.md
+++ b/curriculum/challenges/english/01-responsive-web-design/basic-html-and-html5/add-images-to-your-website.english.md
@@ -33,11 +33,11 @@ Finally don't forget to give your image an alt
text.
```yml
tests:
- text: Your page should have an image element.
- testString: assert($("img").length > 0, 'Your page should have an image element.');
+ testString: assert($("img").length);
- text: Your image should have a src
attribute that points to the kitten image.
- testString: assert(new RegExp("\/\/bit.ly\/fcc-relaxing-cat|\/\/s3.amazonaws.com\/freecodecamp\/relaxing-cat.jpg", "gi").test($("img").attr("src")), 'Your image should have a src
attribute that points to the kitten image.');
- - text: Your image element must have an alt
attribute.
- testString: assert(code.match(/alt\s*?=\s*?(\"|\').*(\"|\')/), 'Your image element must have an alt
attribute.');
+ testString: assert(/^https:\/\/bit\.ly\/fcc-relaxing-cat$/i.test($("img").attr("src")));
+ - text: Your image element's alt
attribute must not be empty.
+ testString: assert($("img").attr("alt") && $("img").attr("alt").length && /
)\S+\1\S*\/?>/.test(code.replace(/\s/g,'')));
```