1+ /* eslint-disable max-classes-per-file */
12import React , { Component } from 'react' ;
23import { render , mount } from 'enzyme' ;
34import mountTest from '@tests/shared/mountTest' ;
@@ -39,43 +40,43 @@ describe('InputNumber', () => {
3940 it ( 'should have default value' , ( ) => {
4041 const wrapper = mount ( < InputNumber defaultValue = { 3 } /> ) ;
4142
42- expect ( wrapper . state ( 'currentValue' ) ) . toEqual ( 3 ) ;
43+ expect ( wrapper . state ( 'currentValue' ) ) . toEqual ( '3' ) ;
4344 } ) ;
4445
4546 it ( 'should use value when defaultValue and value are exits' , ( ) => {
4647 const wrapper = mount ( < InputNumber defaultValue = { 1 } value = { 5 } /> ) ;
47- expect ( wrapper . state ( 'currentValue' ) ) . toEqual ( 5 ) ;
48+ expect ( wrapper . state ( 'currentValue' ) ) . toEqual ( '5' ) ;
4849 } ) ;
4950
5051 it ( 'should currentValue equal min when value less than min ' , ( ) => {
5152 const wrapper = mount ( < InputNumber min = { 10 } value = { 5 } /> ) ;
5253
53- expect ( wrapper . state ( 'currentValue' ) ) . toEqual ( 10 ) ;
54+ expect ( wrapper . state ( 'currentValue' ) ) . toEqual ( '10' ) ;
5455 expect ( wrapper . state ( 'upButtonEnabled' ) ) . toBeTruthy ( ) ;
5556 expect ( wrapper . state ( 'downButtonEnabled' ) ) . toBeFalsy ( ) ;
5657
5758 wrapper . find ( `.${ prefix } -handler-down` ) . simulate ( 'click' ) ;
5859 wrapper . find ( `.${ prefix } -handler-up` ) . simulate ( 'click' ) ;
5960
60- expect ( wrapper . state ( 'currentValue' ) ) . toEqual ( 11 ) ;
61+ expect ( wrapper . state ( 'currentValue' ) ) . toEqual ( '11' ) ;
6162 } ) ;
6263
6364 it ( 'should currentValue equal max when value more than max' , ( ) => {
6465 const wrapper = mount ( < InputNumber max = { 10 } value = { 20 } /> ) ;
6566
66- expect ( wrapper . state ( 'currentValue' ) ) . toEqual ( 10 ) ;
67+ expect ( wrapper . state ( 'currentValue' ) ) . toEqual ( '10' ) ;
6768 expect ( wrapper . state ( 'upButtonEnabled' ) ) . toBeFalsy ( ) ;
6869 expect ( wrapper . state ( 'downButtonEnabled' ) ) . toBeTruthy ( ) ;
6970
7071 wrapper . find ( `.${ prefix } -handler-up` ) . simulate ( 'click' ) ;
7172 wrapper . find ( `.${ prefix } -handler-down` ) . simulate ( 'click' ) ;
7273
73- expect ( wrapper . state ( 'currentValue' ) ) . toEqual ( 9 ) ;
74+ expect ( wrapper . state ( 'currentValue' ) ) . toEqual ( '9' ) ;
7475 } ) ;
7576
7677 it ( 'should currentValue equla value when value between min and max' , ( ) => {
7778 const wrapper = mount ( < InputNumber min = { 1 } max = { 10 } value = { 5 } /> ) ;
78- expect ( wrapper . state ( 'currentValue' ) ) . toEqual ( 5 ) ;
79+ expect ( wrapper . state ( 'currentValue' ) ) . toEqual ( '5' ) ;
7980 expect ( wrapper . state ( 'upButtonEnabled' ) ) . toBeTruthy ( ) ;
8081 expect ( wrapper . state ( 'downButtonEnabled' ) ) . toBeTruthy ( ) ;
8182 } ) ;
@@ -85,15 +86,15 @@ describe('InputNumber', () => {
8586 < InputNumber min = { 1 } max = { 10 } defaultValue = { 5 } step = { 2 } /> ,
8687 ) ;
8788 wrapper . find ( `.${ prefix } -handler-up` ) . simulate ( 'click' ) ;
88- expect ( wrapper . state ( 'currentValue' ) ) . toEqual ( 7 ) ;
89+ expect ( wrapper . state ( 'currentValue' ) ) . toEqual ( '7' ) ;
8990 } ) ;
9091
9192 it ( 'should update currentValue minus step on click down icon' , ( ) => {
9293 const wrapper = mount (
9394 < InputNumber min = { 1 } max = { 10 } defaultValue = { 5 } step = { 10 } /> ,
9495 ) ;
9596 wrapper . find ( `.${ prefix } -handler-down` ) . simulate ( 'click' ) ;
96- expect ( wrapper . state ( 'currentValue' ) ) . toEqual ( 1 ) ;
97+ expect ( wrapper . state ( 'currentValue' ) ) . toEqual ( '1' ) ;
9798 } ) ;
9899
99100 it ( 'should change function not trigger when disabled' , ( ) => {
@@ -107,7 +108,7 @@ describe('InputNumber', () => {
107108 it ( 'should set currentValue to zere when defaultValue is blank' , ( ) => {
108109 const wrapper = mount ( < InputNumber defaultValue = { 1.34 } step = { 0.001 } /> ) ;
109110 wrapper . find ( `.${ prefix } -handler-down` ) . simulate ( 'click' ) ;
110- expect ( wrapper . state ( 'currentValue' ) ) . toEqual ( 1.339 ) ;
111+ expect ( wrapper . state ( 'currentValue' ) ) . toEqual ( ' 1.339' ) ;
111112 } ) ;
112113
113114 it ( 'should update correctly on change no min' , ( ) => {
@@ -206,8 +207,8 @@ describe('InputNumber', () => {
206207 expect ( onKeyDown ) . toHaveBeenCalled ( ) ;
207208 } ) ;
208209
209- it ( 'should render correctly with precison ' , ( ) => {
210+ it ( 'should render correctly with precision ' , ( ) => {
210211 const wrapper = mount ( < InputNumber defaultValue = { 1 } precision = { 2 } /> ) ;
211- expect ( wrapper . state ( 'currentValue' ) ) . toEqual ( 1.0 ) ;
212+ expect ( wrapper . state ( 'currentValue' ) ) . toEqual ( '1.00' ) ;
212213 } ) ;
213214} ) ;
0 commit comments