fix(curriculum): changed test to use regex#38770
Conversation
|
I am struggling to get a robust regex that does allow this to pass: Without letting this pass: |
moT01
left a comment
There was a problem hiding this comment.
You could use some regex in conjunction with something like the old test...
code.match(regex) && $("img").width() < 120;
ShaunSHamilton
left a comment
There was a problem hiding this comment.
Added extra width assertion
curriculum/challenges/english/01-responsive-web-design/basic-css/size-your-images.english.md
Outdated
Show resolved
Hide resolved
curriculum/challenges/english/01-responsive-web-design/basic-css/size-your-images.english.md
Outdated
Show resolved
Hide resolved
Co-authored-by: Tom <20648924+moT01@users.noreply.github.com>
|
I think this falls under the code freeze issue - I am still trying to find out if we can merge ones like this that only change tests. |
|
Yea, I'm still not sure on this @SKY020. I think we should just leave it for now. Getting some forum posts? |
|
We are good to merge things in this section that only changes things that won't be translated. Like the tests in this case. So I removed the blocked label. |
Yes, but probably only 1 per week:
Most recent might be related: https://forum.freecodecamp.org/t/can-anyone-help-me/416296 |
There was a problem hiding this comment.
LGTM 🎉 My only concern is the text that was removed about the browser zoom. @ojeytonwilliams, pretty sure you're involved with the translation efforts - will that cause any problems?
I was able to test this on chome with the zoom at 67% (fails on production, passes with this PR)
|
I reapplied to blocked label. I think we will get the go ahead on all of them very soon. |
RandellDawson
left a comment
There was a problem hiding this comment.
@SKY020 You will need to adjust the regex to also allow the correct CSS I have indicated in the comment. This is why we will hopefully have a CSS parser for use in the current curriculum in the near future.
curriculum/challenges/english/01-responsive-web-design/basic-css/size-your-images.english.md
Outdated
Show resolved
Hide resolved
|
@moT01 sorry, missed your ping. No, it should be fine as far as translation goes. In principle it could have been a problem, but all we're doing is removing a warning (and the necessity for it). Worst case scenario, users end up switching to 100% zoom unnecessarily. |
|
@RandellDawson How about this change of leaving the
No need to check if the final property has a closing Examples:
|
With the latest changes, I can leave off the .smaller-image{
width: 100px;
|
curriculum/challenges/english/01-responsive-web-design/basic-css/size-your-images.english.md
Outdated
Show resolved
Hide resolved
Co-authored-by: Randell Dawson <5313213+RandellDawson@users.noreply.github.com>
|
Looks good to me now. |
|
Did this PR brake the challenge on Safari? Can anyone confirm this? We are getting forum post about this and when I test it in a VM on lambdatest it fails (I can't really test this any other way). I should say that I'm not sure if it was broken before this PR or not, but the forum threads look to be new, so it seems to points to this PR. Environment: Safari 10.1 macOS Sierra https://forum.freecodecamp.org/t/help-here-i-have-tried-everything-above |
|
@lasjorg , I cannot confirm this. I have no access to Safari. Two of those campers you linked to were using outdated browsers. So there might be something there. Otherwise, I cannot remember why we spent so much time making the regex part of the test so robust, only to also include the @moT01 or @RandellDawson If one of you have access to Safari, and are able to test locally with and without the jQuery bit in the assertion. I think that would be the biggest step in debugging. |
@SKY020 I would not be surprised if the DOM width check was the issue. It certainly wouldn't be the first time a browser didn't give back expected values from DOM querying. |
|
Yes @lasjorg, this is not working in Safari from my testing. The reason for the regex and the jQuery here was for how browsers render the width value. Some browsers give 100, some give something close to it, like 99.9 or something. So the combo test of checking that the size is less than 200 and a regex to see if their code had the css seemed like a way to be sure they did it correctly. Looks like the issue has to do with the regex. I'm getting this... |
|
I made a quick PR to hopefully fix it. |

Checklist:
Update index.md)masterbranch of freeCodeCamp.Closes #38712
This change allows users to pass the test with correct code, when browser zoom is not at 100%.
NOTE: Code allows poorly formatted code to pass, whilst the image is still displayed correctly.