Skip to content

Commit 10b67b9

Browse files
committed
test(numberfield): remove obsolete testid
1 parent 2761048 commit 10b67b9

File tree

2 files changed

+18
-17
lines changed

2 files changed

+18
-17
lines changed

src/components/NumberField/NumberField.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,6 @@ const NumberField = React.forwardRef(function NumberField(props, ref) {
140140
type='number'
141141
ref={ref}
142142
width='100%'
143-
data-testid='input'
144143
onBlur={onBlur}
145144
/>
146145
<StyledButtonWrapper isFlat={variant === 'flat'}>

src/components/NumberField/NumberField.spec.js

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,10 @@ describe('<NumberField />', () => {
3838
it('should not call onChange on blur, when clicked element is one of the spin buttons', () => {
3939
const handleChange = jest.fn();
4040

41-
const { getByTestId } = renderWithTheme(
41+
const { getByTestId, container } = renderWithTheme(
4242
<NumberField onChange={handleChange} value={0} />
4343
);
44-
const input = getByTestId('input');
44+
const input = container.querySelector('input');
4545
const incrementButton = getByTestId('increment');
4646

4747
input.focus();
@@ -53,21 +53,21 @@ describe('<NumberField />', () => {
5353
});
5454

5555
it('should reach max value', () => {
56-
const { getByTestId } = renderWithTheme(
56+
const { getByTestId, container } = renderWithTheme(
5757
<NumberField defaultValue={90} min={0} max={100} step={10} />
5858
);
59-
const input = getByTestId('input');
59+
const input = container.querySelector('input');
6060
const incrementButton = getByTestId('increment');
6161
incrementButton.click();
6262

6363
expect(input.value).toBe('100');
6464
});
6565

6666
it('should reach min value', () => {
67-
const { getByTestId } = renderWithTheme(
67+
const { getByTestId, container } = renderWithTheme(
6868
<NumberField defaultValue={10} min={0} max={100} step={10} />
6969
);
70-
const input = getByTestId('input');
70+
const input = container.querySelector('input');
7171
const decrementButton = getByTestId('decrement');
7272
decrementButton.click();
7373

@@ -76,30 +76,32 @@ describe('<NumberField />', () => {
7676

7777
describe('prop: step', () => {
7878
it('should be 1 by default', () => {
79-
const { getByTestId } = renderWithTheme(<NumberField defaultValue={0} />);
80-
const input = getByTestId('input');
79+
const { getByTestId, container } = renderWithTheme(
80+
<NumberField defaultValue={0} />
81+
);
82+
const input = container.querySelector('input');
8183
const incrementButton = getByTestId('increment');
8284
incrementButton.click();
8385

8486
expect(input.value).toBe('1');
8587
});
8688

8789
it('should change value by specified step', () => {
88-
const { getByTestId } = renderWithTheme(
90+
const { getByTestId, container } = renderWithTheme(
8991
<NumberField defaultValue={10} step={3} />
9092
);
91-
const input = getByTestId('input');
93+
const input = container.querySelector('input');
9294
const decrementButton = getByTestId('decrement');
9395
decrementButton.click();
9496

9597
expect(input.value).toBe('7');
9698
});
9799

98100
it('should handle decimal step', () => {
99-
const { getByTestId } = renderWithTheme(
101+
const { getByTestId, container } = renderWithTheme(
100102
<NumberField defaultValue={10} step={0.3} />
101103
);
102-
const input = getByTestId('input');
104+
const input = container.querySelector('input');
103105
const decrementButton = getByTestId('decrement');
104106
decrementButton.click();
105107

@@ -109,10 +111,10 @@ describe('<NumberField />', () => {
109111

110112
describe('prop: disabled', () => {
111113
it('should render disabled', () => {
112-
const { getByTestId } = renderWithTheme(
114+
const { getByTestId, container } = renderWithTheme(
113115
<NumberField defaultValue={10} disabled />
114116
);
115-
const input = getByTestId('input');
117+
const input = container.querySelector('input');
116118
const incrementButton = getByTestId('increment');
117119
const decrementButton = getByTestId('decrement');
118120

@@ -122,10 +124,10 @@ describe('<NumberField />', () => {
122124
});
123125

124126
it('should not react to button clicks', () => {
125-
const { getByTestId } = renderWithTheme(
127+
const { getByTestId, container } = renderWithTheme(
126128
<NumberField defaultValue={10} disabled />
127129
);
128-
const input = getByTestId('input');
130+
const input = container.querySelector('input');
129131
const incrementButton = getByTestId('increment');
130132
const decrementButton = getByTestId('decrement');
131133

0 commit comments

Comments
 (0)