Skip to content

finish - #1946

Open
kosigorek wants to merge 3 commits into
mate-academy:masterfrom
kosigorek:develop
Open

finish#1946
kosigorek wants to merge 3 commits into
mate-academy:masterfrom
kosigorek:develop

Conversation

@kosigorek

Copy link
Copy Markdown

No description provided.

@mateacademy-ai-mentor mateacademy-ai-mentor left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review Summary

Your code has two critical syntax errors that are causing all tests to fail. First, the regex for detecting uppercase letters is malformed - /(A-Z)/g searches for literal parentheses with letters inside, but you need /([A-Z])/g with square brackets to match individual uppercase characters. Second, the setAttribute call has incorrect syntax - it requires two separate arguments, not a comma inside one string. Change setAttribute('for', input.id) is correct (with a space after the dot in input .id). These errors are blocking execution entirely, so all 12 tests fail due to the before each hook throwing an uncaught exception. Once fixed, your implementation should work properly.


✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨

Important

Fix the issues, commit the changes, and then re-request my review using the Re-request review button2 in the Reviewers tab.

Tip

If you have any comments about this review, please leave a message in the Add a comment section below and mention me with the @mateacademy-ai-mentor tag3.
I will read your message during my next review of your pull request. Please do not reply directly to my comments, as that feature is not supported yet.

Caution

Do not close the pull request until the review is complete. Closing it early can lead to unexpected behavior and disrupt the review process.

Footnotes

  1. Rate AI review example

  2. Re-request AI review example

  3. Add AI review comments example

Comment thread src/scripts/main.js Outdated

// write code here
function formatFieldName(inputName) {
const withSpaces = inputName.replace(/(A-Z)/g, ' $1').trim();

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The regex /(A-Z)/g looks for literal parentheses with letters A-Z, not uppercase letters. Should be /([A-Z])/g to match individual uppercase characters.

Comment thread src/scripts/main.js

const label = document.createElement('label');

label.className = 'field-label';

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Incorrect syntax - setAttribute takes two separate arguments, not a comma inside one string. Should be setAttribute('for', input.id). Also note: input.id should be used (no space after dot), not input.id.

@mateacademy-ai-mentor mateacademy-ai-mentor left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review Summary

This requires changes. There's a critical regex error on line 5 that will break the core functionality. The regex /(A-Z)/g matches literal parentheses containing letters (like "(ABC)"), not individual uppercase letters. You need to change it to /([A-Z])/g with square brackets to create a proper character class that matches each uppercase letter separately. This will ensure the replace() method correctly inserts spaces before capitals in camelCase field names like emailAddress, so labels and placeholders display as "Email Address" instead of "emailAddress". All other requirements are properly implemented, but this regex fix is essential for the task to work correctly.


✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨

Important

Fix the issues, commit the changes, and then re-request my review using the Re-request review button2 in the Reviewers tab.

Tip

If you have any comments about this review, please leave a message in the Add a comment section below and mention me with the @mateacademy-ai-mentor tag3.
I will read your message during my next review of your pull request. Please do not reply directly to my comments, as that feature is not supported yet.

Caution

Do not close the pull request until the review is complete. Closing it early can lead to unexpected behavior and disrupt the review process.

Footnotes

  1. Rate AI review example

  2. Re-request AI review example

  3. Add AI review comments example

Comment thread src/scripts/main.js Outdated

// write code here
function formatFieldName(inputName) {
const withSpaces = inputName.replace(/(A-Z)/g, ' $1').trim();

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The regex /(A-Z)/g is incorrect. It matches literal parentheses with letters A-Z inside (like "(ABC)"), not individual uppercase letters. Use /([A-Z])/g with square brackets to create a character class that matches each uppercase letter separately. The captured group $1 will then correctly insert spaces before each uppercase letter.

@mateacademy-ai-mentor mateacademy-ai-mentor left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review Summary

Your solution is approved and fully meets all requirements. The regex fix using /([A-Z])/g with proper character class brackets now correctly handles camelCase field names like emailAddress → "Email Address". All checklist items are satisfied: inputs are properly selected from the form, labels with class field-label and correct for attributes are created, placeholders are capitalized appropriately, and elements are appended to parent containers without wrapping. Great work fixing that regex issue — the character class syntax is an important detail to remember!


✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨

Footnotes

  1. Rate AI review example

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants