New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Learn Typography by building a Nutrition Label:Step 22 #47109
Comments
how to add html code it is showing the executed code |
@MahijithMenon I have update your post, to show html |
In step https://www.freecodecamp.org/learn/2022/responsive-web-design/learn-html-by-building-a-cat-photo-app/step-24 has similar instructions, because campers do face this earlier, I don't think we should change the description. |
@MahijithMenon, it would be good to close the issue if no PRs are needed. |
@hanswang123456 I disagree |
I don't know how much of a problem there is here. Using the code that will not pass above (
So that should let users know to remove the space. If you then remove the space to use this code:
Which should let them know that they need a space. A quick forum search shows a few people adding that space, but many others that do it wrong - like including |
@moT01, removing the leading/trailing white space from the span assertion could be an option. That way, the test only has to confirm the correct text(leading/trailing space) and let the general |
Alright, I'm going to open this up for help. We want to change the test so it allows a space at the start of that span, but keep the test for the paragraph so the whole sentence is correct. It's the third test in this file |
@Xavier-Pierre-dev, it might be better to remove spaces then check for exact occurrence of '2/3 cup (55g)' . This way if users insert unwanted text, it won't pass the span's assertion.(this is mostly for error messages so users know to target the Maybe something like: And then do |
Includes doesn't check for letters added to the start or end which can make error messages less specific. |
One issue I saw when I looked on the forum was people doing something like this: So using |
@moT01 for the assertion on the |
@Xavier-Pierre-dev, regexes do work. The issue is that users sometimes put whitespaces inside the span tag. For the regex, include 1 optional whitespace at the start of the string so there is more flexibility for users. I think that would work well in conjunction with the |
so here difference beetween the regex is that we can easily allow white space before and after the string so it's more near to but at the same time the hint say : I'm not sur if one solution is better than the other I think both will work
document.querySelector('span')?.textContent.match(/^(\s+|)2\/3 cup \(55g\)(\s+|)$/)
document.querySelector('span')?.textContent.match(/^(\s|)2\/3 cup \(55g\)(\s|)$/)
document.querySelector('span')?.textContent.match(/^(\s|)2\/3 cup \(55g\)$/)
document.querySelector('span')?.textContent.includes('2/3 cup (55g)') |
I think only allowing whitespaces before the element works best. So something like your second version. |
yes I think also I was editing my comment at the same time to add this. |
Feel free to open a PR and reviewers can review the code. |
* fix/Learn Typography by building a Nutrition Label:Step 22 #47109 * revert change on non-English files * Update curriculum/challenges/english/14-responsive-web-design-22/learn-typography-by-building-a-nutrition-label/615f42a021625f656101ef93.md Co-authored-by: Naomi Carrigan <nhcarrigan@gmail.com> Co-authored-by: Naomi Carrigan <nhcarrigan@gmail.com>
Describe the Issue
In this ,we have to add span tag in between p tags and if we give spacing between text present in p tags only then the test cases is accepted.
This case will work:-
But This will not work:-
we can add a new test case which could allow the second one too or can add a description regarding it.
Affected Page
https://www.freecodecamp.org/learn/2022/responsive-web-design/learn-typography-by-building-a-nutrition-label/step-22
Your code
Expected behavior
This should have been worked or we could actually tell the user to rectify the spacing
Screenshots
No response
System
Laptop
Windows 11
Brave
Additional context
No response
The text was updated successfully, but these errors were encountered: