Skip to content
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

fix(int-value): fix int-value validation (DEV-1277) #815

Merged
merged 2 commits into from Sep 6, 2022

Conversation

mdelez
Copy link
Collaborator

@mdelez mdelez commented Sep 5, 2022

resolves DEV-1277

@mdelez mdelez added the bug A bug fix label Sep 5, 2022
@mdelez mdelez self-assigned this Sep 5, 2022
@mdelez mdelez marked this pull request as ready for review Sep 5, 2022
@@ -87,7 +87,7 @@ export class IntValueComponent extends BaseValueDirective implements OnInit, OnC

const newIntValue = new CreateIntValue();

newIntValue.int = this.valueFormControl.value;
newIntValue.int = parseInt(this.valueFormControl.value, 10);
Copy link
Contributor

@Vijeinath Vijeinath Sep 6, 2022

Choose a reason for hiding this comment

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

The 10 looks like a magic number to me. It would be more readable to do something like:

const DEFAULT_VALUE = 10
newIntValue.int = parseInt(this.valueFormControl.value, DEFAULT_VALUE);

Copy link
Collaborator Author

@mdelez mdelez Sep 6, 2022

Choose a reason for hiding this comment

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

Yeah, it's technically optional but the linter complains. I've replaced in with a const in fea1417

@@ -105,7 +105,7 @@ export class IntValueComponent extends BaseValueDirective implements OnInit, OnC

updatedIntValue.id = this.displayValue.id;

updatedIntValue.int = this.valueFormControl.value;
updatedIntValue.int = parseInt(this.valueFormControl.value, 10);
Copy link
Contributor

@Vijeinath Vijeinath Sep 6, 2022

Choose a reason for hiding this comment

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

look above

Copy link
Contributor

@Vijeinath Vijeinath left a comment

Just small improvements

@Vijeinath Vijeinath self-requested a review Sep 6, 2022
Copy link
Contributor

@Vijeinath Vijeinath left a comment

LGTM

@mdelez mdelez merged commit d86dc7b into main Sep 6, 2022
11 checks passed
@mdelez mdelez deleted the wip/dev-1277-firefox-int-form-validation branch Sep 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A bug fix
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants