-
+
`;
exports[`EuiRange props ticks should render 1`] = `
diff --git a/src/components/form/range/dual_range.test.tsx b/src/components/form/range/dual_range.test.tsx
index 4eb4c477c03..d3792e8f361 100644
--- a/src/components/form/range/dual_range.test.tsx
+++ b/src/components/form/range/dual_range.test.tsx
@@ -32,6 +32,20 @@ describe('EuiDualRange', () => {
targetSelector: '.euiRangeSlider',
skip: { className: true, css: true },
});
+ shouldRenderCustomStyles(
+
,
+ {
+ skip: { parentTest: true },
+ childProps: ['minInputProps', 'maxInputProps', 'inputPopoverProps'],
+ renderCallback: ({ getByTestSubject }) => {
+ fireEvent.focus(getByTestSubject('triggerPopover'));
+ },
+ }
+ );
it('renders', () => {
const { container } = render(
@@ -184,6 +198,7 @@ describe('EuiDualRange', () => {
id="id"
showInput="inputWithPopover"
minInputProps={{ 'aria-label': 'Min value' }}
+ inputPopoverProps={{ panelProps: { 'data-test-subj': 'test' } }}
/>
);
@@ -195,6 +210,7 @@ describe('EuiDualRange', () => {
expect(screen.getByRole('dialog')).toBeDefined();
expect(screen.getAllByRole('slider')).toHaveLength(2);
+ expect(screen.getByTestSubject('test')).toBeInTheDocument();
});
});
diff --git a/src/components/form/range/dual_range.tsx b/src/components/form/range/dual_range.tsx
index 380c71b4966..07614a4c23e 100644
--- a/src/components/form/range/dual_range.tsx
+++ b/src/components/form/range/dual_range.tsx
@@ -381,6 +381,7 @@ export class EuiDualRangeClass extends Component<
this.setState({
rangeWidth: width,
});
+ this.props.inputPopoverProps?.onPanelResize?.(width);
};
getNearestStep = (value: number) => {
@@ -451,6 +452,7 @@ export class EuiDualRangeClass extends Component<
prepend,
minInputProps,
maxInputProps,
+ inputPopoverProps,
isDraggable,
theme,
...rest
@@ -786,7 +788,11 @@ export class EuiDualRangeClass extends Component<
const thePopover = showInputOnly ? (
{
targetSelector: '.euiRangeSlider',
skip: { className: true, css: true },
});
+ shouldRenderCustomStyles(
+ ,
+ {
+ skip: { parentTest: true },
+ childProps: ['inputPopoverProps'],
+ renderCallback: ({ getByTestSubject }) => {
+ fireEvent.focus(getByTestSubject('triggerPopover'));
+ },
+ }
+ );
test('is rendered', () => {
const { container } = render(
@@ -129,18 +144,21 @@ describe('EuiRange', () => {
});
test('slider should display in popover', () => {
- const { container } = render(
+ const { container, baseElement, getByTestSubject } = render(
{}}
showInput="inputWithPopover"
+ inputPopoverProps={{ panelProps: { 'data-test-subj': 'test' } }}
{...props}
{...requiredProps}
/>
);
+ fireEvent.focus(container.querySelector('input')!);
- expect(container.firstChild).toMatchSnapshot();
+ expect(baseElement).toMatchSnapshot();
+ expect(getByTestSubject('test')).toBeInTheDocument();
});
test('loading should display when showInput="inputWithPopover"', () => {
diff --git a/src/components/form/range/range.tsx b/src/components/form/range/range.tsx
index 622ed3b8aca..80f6a382276 100644
--- a/src/components/form/range/range.tsx
+++ b/src/components/form/range/range.tsx
@@ -127,6 +127,7 @@ export class EuiRangeClass extends Component<
step,
showLabels,
showInput,
+ inputPopoverProps,
showTicks,
tickInterval,
ticks,
@@ -291,7 +292,11 @@ export class EuiRangeClass extends Component<
const thePopover = showInputOnly ? (
;
}
export type _SharedRangeInputSide = {
diff --git a/upcoming_changelogs/7082.md b/upcoming_changelogs/7082.md
new file mode 100644
index 00000000000..2c945a0563a
--- /dev/null
+++ b/upcoming_changelogs/7082.md
@@ -0,0 +1 @@
+- Added a new `inputPopoverProps` prop for `EuiRange`s and `EuiDualRange`s with `showInput="inputWithPopover"` set