-
Notifications
You must be signed in to change notification settings - Fork 3
Fix: replaced ember input with html input in OSS::InputContainer #533
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
base: master
Are you sure you want to change the base?
Conversation
cfe2b19
to
7a5a610
Compare
095037b
to
6d6a2ae
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lots of questions - but nothing is explained in the PR so 🤷
Inputs are the core of our application, if we mess things up here, bugs & defects will rain.
get onChangeHandler() { | ||
return (value: string | null) => this.validateInput(value); | ||
} | ||
|
||
@action | ||
validateInput(): void { | ||
this.regexError = ''; | ||
this.args.onChange?.(this.args.value ? this.args.value.toLowerCase() : this.args.value); | ||
validateInput(value: string | null): void { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure I understand these changes 🤔
Why do we need to use a getter for the validateInput ?
and why is the regexError reset logic moved ?
autocomplete={{this.autocomplete}} | ||
class="upf-input" | ||
{{on "keyup" (fn this._onChange @value)}} | ||
{{on "input" this.onInput}} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need to add an on input
listener ?
|
||
@action | ||
onKeyUp(event: KeyboardEvent): void { | ||
if (event.key === 'Backspace' && this.args.value === null) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Again, why change the logic here ?
disabled={{or this.isMinDisabled @disabled}} {{enable-tooltip title=this.minTooltipTitle placement="top"}} /> | ||
{{! template-lint-disable no-triple-curlies}} | ||
<OSS::InputContainer @value={{this.localValue}} @onChange={{this.checkUserInput}} @disabled={{@disabled}} style={{{this.dynamicWidth}}} | ||
<OSS::InputContainer @value={{this.localValue}} @onChange={{fn this.checkUserInput}} @disabled={{@disabled}} style={{{this.dynamicWidth}}} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why is the fn
added ?
if (value !== undefined) { | ||
this.localValue = Number(value); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
?
await fillIn('input', 'fakedomai'); | ||
await typeIn('input', 'n'); | ||
assert.true(this.onChange.calledOnceWithExactly('fakedomain', true)); | ||
assert.true(this.onChange.lastCall.calledWith('fakedomain', true)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the test needs to be updated, it means the logic has changed somewhere - is this expected ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as the other locations, why are we making these changes ?
@action | ||
onKeyUp(event: KeyboardEvent): void { | ||
if (event.key === 'Backspace' && this.args.value === null) { | ||
this.args.onChange?.(null); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are not afraid about 2 possibles calls of this.args.onChange
in the component if we are using 2 different events?
(this.sliderOptions.max - this.sliderOptions.min), | ||
1 | ||
); | ||
return Math.min(Math.max(convertedValue + correction - min, 0) / (max - min), 1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why base the min / max value on this.args.max/min
?
What does this PR do?
https://www.loom.com/share/06028ccaa77b4edcb88b9c315d522b94
Related to: #
What are the observable changes?
Good PR checklist