This repository was archived by the owner on Sep 25, 2019. It is now read-only.
fix(challenges): fix third test for template literals#192
Merged
scissorsneedfoodtoo merged 2 commits intofreeCodeCamp:devfrom Jul 31, 2018
johnkennedy9147:fix-template-literals-test-3
Merged
fix(challenges): fix third test for template literals#192scissorsneedfoodtoo merged 2 commits intofreeCodeCamp:devfrom johnkennedy9147:fix-template-literals-test-3
scissorsneedfoodtoo merged 2 commits intofreeCodeCamp:devfrom
johnkennedy9147:fix-template-literals-test-3
Conversation
replaced the overly long and complex regex which tests for use of template literals with a much simpler one that has the same effect ISSUES CLOSED: #135
Contributor
|
@johnkennedy9147, thank you for continuing to improve this problem! I just found a couple of small things I'll leave as a review. |
| "A lot of things happened there.", | ||
| "Firstly, the example uses backticks (<code>`</code>), not quotes (<code>'</code> or <code>\"</code>), to wrap the string.", | ||
| "Secondly, notice that the string is multi-line, both in the code and the output. This saves inserting \n within strings.", | ||
| "Secondly, notice that the string is multi-line, both in the code and the output. This saves inserting <code>\n</code> within strings.", |
Contributor
There was a problem hiding this comment.
Tested this locally and it seems like \n still needs to be escaped, whether or not it's wrapped in <code> tags. <code>\\n<code> gets it to show up locally on Learn for me.
Contributor
Author
There was a problem hiding this comment.
sorry forgot to escape the \ will fix
| "text": "Template strings were used", | ||
| "testString": | ||
| "getUserInput => assert(getUserInput('index').match(/`<li \\s*class\\s*=\\s*(\"\\s*text-warning\\s*\"|'\\s*text-warning\\s*')\\s*>\\s*\\$\\s*\\{(\\s*\\w+\\s*|\\s*\\w+\\s*\\[\\s*[\\w]+\\s*\\]\\s*)\\}\\s*<\\s*\\/li\\s*>`/g), 'Template strings were used');" | ||
| "getUserInput => assert(getUserInput('index').match(/`.*`/g), 'Template strings were used');" |
Contributor
There was a problem hiding this comment.
Unfortunately it seems like the commented out section is causing this to pass. I like your simplified test much more than the last one, so how about changing the commented out section?
Contributor
Author
and test error message
Contributor
|
@johnkennedy9147, thank you for all of your hard work here. Everything LGTM! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Description
replaced the overly long and complex regex which tests for use of template literals with a much
simpler one that has the same effect
also fixed
\nnot being displayed as it was not escaped or surrounded by code tagsISSUES CLOSED: #135
Pre-Submission Checklist
devbranch.fix/,feature/, ortranslate/(e.g.fix/challenge-tests)npm test.npm run committo generate a conventional commit message.Learn more here: https://conventionalcommits.org/#why-use-conventional-commits
If they were done on the web interface you have ensured that you are creating conventional commit messages.
Checklist:
Closes #135