Skip to content

Commit

Permalink
fix(range): tooltip & max/min change
Browse files Browse the repository at this point in the history
  • Loading branch information
aesteves60 authored and dpellier committed Jul 29, 2024
1 parent 053b807 commit 94ea8d1
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ export class OdsRange {
if (!this.value) {
this.value = getDefaultValue(this.min, this.max, this.defaultValue);
}
setFormValue(this.internals, this.value);
this.onMinOrMaxChange();
this.onValueChange();
}

Expand Down Expand Up @@ -186,13 +186,19 @@ export class OdsRange {
return value;
}

private showTooltips(): void {
private showTooltip(): void {
this.tooltip?.show();
this.tooltipDual?.show();
}

private hideTooltips(): void {
private hideTooltip(): void {
this.tooltip?.hide();
}

private showTooltipDual(): void {
this.tooltipDual?.show();
}

private hideTooltipDual(): void {
this.tooltipDual?.hide();
}

Expand Down Expand Up @@ -223,11 +229,11 @@ export class OdsRange {
id={ this.inputRangeId }
onBlur={ () => this.odsBlur.emit() }
onFocus={ () => this.odsFocus.emit() }
onFocusin={ () => this.showTooltips() }
onFocusout={ () => this.hideTooltips() }
onFocusin={ () => this.showTooltip() }
onFocusout={ () => this.hideTooltip() }
onInput={ () => this.onInput(false) }
onMouseOver={ () => this.showTooltips() }
onMouseLeave={ () => this.hideTooltips() }
onMouseOver={ () => this.showTooltip() }
onMouseLeave={ () => this.hideTooltip() }
part="range"
max={ this.max }
min={ this.min }
Expand Down Expand Up @@ -269,11 +275,11 @@ export class OdsRange {
aria-valuenow={ this.value }
disabled={ this.isDisabled }
id={ this.inputRangeDualId }
onFocusin={ () => this.showTooltips() }
onFocusout={ () => this.hideTooltips() }
onFocusin={ () => this.showTooltipDual() }
onFocusout={ () => this.hideTooltipDual() }
onInput={ () => this.onInput(true) }
onMouseOver={ () => this.showTooltips() }
onMouseLeave={ () => this.hideTooltips() }
onMouseOver={ () => this.showTooltipDual() }
onMouseLeave={ () => this.hideTooltipDual() }
part="range-dual"
max={ this.max }
min={ this.min }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ describe('ods-range behavior', () => {
await el.setProperty('max', newMax);
await page.waitForChanges();

expect((await el.getProperty('value'))?.[0]).toBe(newMax);
expect((await el.getProperty('value'))?.[0]).toBe(newMax - 1);
expect((await el.getProperty('value'))?.[1]).toBe(newMax);
});

Expand Down

0 comments on commit 94ea8d1

Please sign in to comment.