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

[EuiDualRange] Fix buggy highlight positioning #7305

Merged
merged 6 commits into from
Oct 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions src/components/form/range/__snapshots__/range_track.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ exports[`EuiRangeTrack is rendered 1`] = `
>
<button
class="euiRangeTick emotion-euiRangeTick-hasPseudoTickMark-regular"
style="inset-inline-start: calc(NaN% + 8px); max-inline-size: 9.090909090909092%;"
style="inset-inline-start: calc(0% + 8px); max-inline-size: 9.090909090909092%;"
tabindex="-1"
title="0"
type="button"
Expand All @@ -21,7 +21,7 @@ exports[`EuiRangeTrack is rendered 1`] = `
</button>
<button
class="euiRangeTick emotion-euiRangeTick-selected-hasPseudoTickMark-regular"
style="inset-inline-start: calc(-Infinity% + 8px); max-inline-size: 9.090909090909092%;"
style="inset-inline-start: calc(9.600000000000001% + 8px); max-inline-size: 9.090909090909092%;"
tabindex="-1"
title="10"
type="button"
Expand All @@ -31,7 +31,7 @@ exports[`EuiRangeTrack is rendered 1`] = `
</button>
<button
class="euiRangeTick emotion-euiRangeTick-hasPseudoTickMark-regular"
style="inset-inline-start: calc(-Infinity% + 8px); max-inline-size: 9.090909090909092%;"
style="inset-inline-start: calc(19.200000000000003% + 8px); max-inline-size: 9.090909090909092%;"
tabindex="-1"
title="20"
type="button"
Expand All @@ -41,7 +41,7 @@ exports[`EuiRangeTrack is rendered 1`] = `
</button>
<button
class="euiRangeTick emotion-euiRangeTick-hasPseudoTickMark-regular"
style="inset-inline-start: calc(-Infinity% + 8px); max-inline-size: 9.090909090909092%;"
style="inset-inline-start: calc(28.799999999999997% + 8px); max-inline-size: 9.090909090909092%;"
tabindex="-1"
title="30"
type="button"
Expand All @@ -51,7 +51,7 @@ exports[`EuiRangeTrack is rendered 1`] = `
</button>
<button
class="euiRangeTick emotion-euiRangeTick-hasPseudoTickMark-regular"
style="inset-inline-start: calc(-Infinity% + 8px); max-inline-size: 9.090909090909092%;"
style="inset-inline-start: calc(38.400000000000006% + 8px); max-inline-size: 9.090909090909092%;"
tabindex="-1"
title="40"
type="button"
Expand All @@ -61,7 +61,7 @@ exports[`EuiRangeTrack is rendered 1`] = `
</button>
<button
class="euiRangeTick emotion-euiRangeTick-hasPseudoTickMark-regular"
style="inset-inline-start: calc(-Infinity% + 8px); max-inline-size: 9.090909090909092%;"
style="inset-inline-start: calc(48% + 8px); max-inline-size: 9.090909090909092%;"
tabindex="-1"
title="50"
type="button"
Expand All @@ -71,7 +71,7 @@ exports[`EuiRangeTrack is rendered 1`] = `
</button>
<button
class="euiRangeTick emotion-euiRangeTick-hasPseudoTickMark-regular"
style="inset-inline-start: calc(-Infinity% + 8px); max-inline-size: 9.090909090909092%;"
style="inset-inline-start: calc(57.599999999999994% + 8px); max-inline-size: 9.090909090909092%;"
tabindex="-1"
title="60"
type="button"
Expand All @@ -81,7 +81,7 @@ exports[`EuiRangeTrack is rendered 1`] = `
</button>
<button
class="euiRangeTick emotion-euiRangeTick-hasPseudoTickMark-regular"
style="inset-inline-start: calc(-Infinity% + 8px); max-inline-size: 9.090909090909092%;"
style="inset-inline-start: calc(67.19999999999999% + 8px); max-inline-size: 9.090909090909092%;"
tabindex="-1"
title="70"
type="button"
Expand All @@ -91,7 +91,7 @@ exports[`EuiRangeTrack is rendered 1`] = `
</button>
<button
class="euiRangeTick emotion-euiRangeTick-hasPseudoTickMark-regular"
style="inset-inline-start: calc(-Infinity% + 8px); max-inline-size: 9.090909090909092%;"
style="inset-inline-start: calc(76.80000000000001% + 8px); max-inline-size: 9.090909090909092%;"
tabindex="-1"
title="80"
type="button"
Expand All @@ -101,7 +101,7 @@ exports[`EuiRangeTrack is rendered 1`] = `
</button>
<button
class="euiRangeTick emotion-euiRangeTick-hasPseudoTickMark-regular"
style="inset-inline-start: calc(-Infinity% + 8px); max-inline-size: 9.090909090909092%;"
style="inset-inline-start: calc(86.4% + 8px); max-inline-size: 9.090909090909092%;"
tabindex="-1"
title="90"
type="button"
Expand All @@ -111,7 +111,7 @@ exports[`EuiRangeTrack is rendered 1`] = `
</button>
<button
class="euiRangeTick emotion-euiRangeTick-hasPseudoTickMark-regular"
style="inset-inline-start: calc(-Infinity% + 8px); max-inline-size: 9.090909090909092%;"
style="inset-inline-start: calc(96% + 8px); max-inline-size: 9.090909090909092%;"
tabindex="-1"
title="100"
type="button"
Expand Down
7 changes: 7 additions & 0 deletions src/components/form/range/dual_range.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,11 @@ describe('EuiDualRange', () => {
});

it('renders inputs with popover slider when showInput="inputWithPopover"', () => {
// Mock requestAnimationFrame to run immediately
jest
.spyOn(window, 'requestAnimationFrame')
.mockImplementation((cb: Function) => cb());

render(
<EuiDualRange
{...props}
Expand All @@ -209,6 +214,8 @@ describe('EuiDualRange', () => {
expect(screen.getByRole('dialog')).toBeDefined();
expect(screen.getAllByRole('slider')).toHaveLength(2);
expect(screen.getByTestSubject('test')).toBeInTheDocument();

jest.restoreAllMocks();
});
});

Expand Down
Loading
Loading