@@ -2,15 +2,15 @@ import { fireEvent } from '@testing-library/react';
22import React from 'react' ;
33
44import { renderWithTheme } from '../../test/utils' ;
5- import { NumberField } from './NumberField ' ;
5+ import { NumberInput } from './NumberInput ' ;
66
77// TODO: should we pass number or string to callbacks?
8- describe ( '<NumberField />' , ( ) => {
8+ describe ( '<NumberInput />' , ( ) => {
99 it ( 'should call onChange on spin buttons click' , ( ) => {
1010 const handleChange = jest . fn ( ) ;
1111
1212 const { getByTestId } = renderWithTheme (
13- < NumberField onChange = { handleChange } defaultValue = { 2 } />
13+ < NumberInput onChange = { handleChange } defaultValue = { 2 } />
1414 ) ;
1515 const spinButton = getByTestId ( 'increment' ) ;
1616 spinButton . click ( ) ;
@@ -21,7 +21,7 @@ describe('<NumberField />', () => {
2121 it ( 'should call onChange on blur after keyboard input' , ( ) => {
2222 const handleChange = jest . fn ( ) ;
2323 const { container } = renderWithTheme (
24- < NumberField onChange = { handleChange } defaultValue = { 0 } />
24+ < NumberInput onChange = { handleChange } defaultValue = { 0 } />
2525 ) ;
2626 const input = container . querySelector ( 'input' ) as HTMLInputElement ;
2727 input . focus ( ) ;
@@ -39,7 +39,7 @@ describe('<NumberField />', () => {
3939 const handleChange = jest . fn ( ) ;
4040
4141 const { getByTestId, container } = renderWithTheme (
42- < NumberField onChange = { handleChange } value = { 0 } />
42+ < NumberInput onChange = { handleChange } value = { 0 } />
4343 ) ;
4444 const input = container . querySelector ( 'input' ) as HTMLInputElement ;
4545 const incrementButton = getByTestId ( 'increment' ) ;
@@ -55,7 +55,7 @@ describe('<NumberField />', () => {
5555 it ( 'should give correct result after user changes input value and then clicks increment button' , ( ) => {
5656 const handleChange = jest . fn ( ) ;
5757 const { container, getByTestId } = renderWithTheme (
58- < NumberField onChange = { handleChange } defaultValue = { 0 } />
58+ < NumberInput onChange = { handleChange } defaultValue = { 0 } />
5959 ) ;
6060 const input = container . querySelector ( 'input' ) as HTMLInputElement ;
6161 const incrementButton = getByTestId ( 'increment' ) ;
@@ -68,7 +68,7 @@ describe('<NumberField />', () => {
6868
6969 it ( 'should reach max value' , ( ) => {
7070 const { getByTestId, container } = renderWithTheme (
71- < NumberField defaultValue = { 90 } min = { 0 } max = { 100 } step = { 10 } />
71+ < NumberInput defaultValue = { 90 } min = { 0 } max = { 100 } step = { 10 } />
7272 ) ;
7373 const input = container . querySelector ( 'input' ) as HTMLInputElement ;
7474 const incrementButton = getByTestId ( 'increment' ) ;
@@ -79,7 +79,7 @@ describe('<NumberField />', () => {
7979
8080 it ( 'should reach min value' , ( ) => {
8181 const { getByTestId, container } = renderWithTheme (
82- < NumberField defaultValue = { 10 } min = { 0 } max = { 100 } step = { 10 } />
82+ < NumberInput defaultValue = { 10 } min = { 0 } max = { 100 } step = { 10 } />
8383 ) ;
8484 const input = container . querySelector ( 'input' ) as HTMLInputElement ;
8585 const decrementButton = getByTestId ( 'decrement' ) ;
@@ -91,7 +91,7 @@ describe('<NumberField />', () => {
9191 describe ( 'prop: step' , ( ) => {
9292 it ( 'should be 1 by default' , ( ) => {
9393 const { getByTestId, container } = renderWithTheme (
94- < NumberField defaultValue = { 0 } />
94+ < NumberInput defaultValue = { 0 } />
9595 ) ;
9696 const input = container . querySelector ( 'input' ) as HTMLInputElement ;
9797 const incrementButton = getByTestId ( 'increment' ) ;
@@ -102,7 +102,7 @@ describe('<NumberField />', () => {
102102
103103 it ( 'should change value by specified step' , ( ) => {
104104 const { getByTestId, container } = renderWithTheme (
105- < NumberField defaultValue = { 10 } step = { 3 } />
105+ < NumberInput defaultValue = { 10 } step = { 3 } />
106106 ) ;
107107 const input = container . querySelector ( 'input' ) as HTMLInputElement ;
108108 const decrementButton = getByTestId ( 'decrement' ) ;
@@ -113,7 +113,7 @@ describe('<NumberField />', () => {
113113
114114 it ( 'should handle decimal step' , ( ) => {
115115 const { getByTestId, container } = renderWithTheme (
116- < NumberField defaultValue = { 10 } step = { 0.3 } />
116+ < NumberInput defaultValue = { 10 } step = { 0.3 } />
117117 ) ;
118118 const input = container . querySelector ( 'input' ) as HTMLInputElement ;
119119 const decrementButton = getByTestId ( 'decrement' ) ;
@@ -126,7 +126,7 @@ describe('<NumberField />', () => {
126126 describe ( 'prop: disabled' , ( ) => {
127127 it ( 'should render disabled' , ( ) => {
128128 const { getByTestId, container } = renderWithTheme (
129- < NumberField defaultValue = { 10 } disabled />
129+ < NumberInput defaultValue = { 10 } disabled />
130130 ) ;
131131 const input = container . querySelector ( 'input' ) as HTMLInputElement ;
132132 const incrementButton = getByTestId ( 'increment' ) ;
@@ -139,7 +139,7 @@ describe('<NumberField />', () => {
139139
140140 it ( 'should not react to button clicks' , ( ) => {
141141 const { getByTestId, container } = renderWithTheme (
142- < NumberField defaultValue = { 10 } disabled />
142+ < NumberInput defaultValue = { 10 } disabled />
143143 ) ;
144144 const input = container . querySelector ( 'input' ) as HTMLInputElement ;
145145 const incrementButton = getByTestId ( 'increment' ) ;
@@ -156,7 +156,7 @@ describe('<NumberField />', () => {
156156 describe ( 'prop: width' , ( ) => {
157157 it ( 'should render component of specified width' , ( ) => {
158158 const { container } = renderWithTheme (
159- < NumberField defaultValue = { 10 } disabled width = { 93 } />
159+ < NumberInput defaultValue = { 10 } disabled width = { 93 } />
160160 ) ;
161161 expect (
162162 getComputedStyle ( container . firstElementChild as HTMLInputElement ) . width
@@ -165,7 +165,7 @@ describe('<NumberField />', () => {
165165
166166 it ( 'should handle %' , ( ) => {
167167 const { container } = renderWithTheme (
168- < NumberField defaultValue = { 10 } disabled width = '93%' />
168+ < NumberInput defaultValue = { 10 } disabled width = '93%' />
169169 ) ;
170170 expect (
171171 getComputedStyle ( container . firstElementChild as HTMLInputElement ) . width
0 commit comments