@ -162,7 +162,7 @@ describe('CurrencyInput Component', () => {
handleBlurSpy . resetHistory ( )
handleBlurSpy . resetHistory ( )
} )
} )
it ( 'should call onChange and onBlur on input changes with the hex value for ETH' , ( ) => {
it ( 'should call onChange on input changes with the hex value for ETH' , ( ) => {
const mockStore = {
const mockStore = {
metamask : {
metamask : {
nativeCurrency : 'ETH' ,
nativeCurrency : 'ETH' ,
@ -175,7 +175,6 @@ describe('CurrencyInput Component', () => {
< Provider store = { store } >
< Provider store = { store } >
< CurrencyInput
< CurrencyInput
onChange = { handleChangeSpy }
onChange = { handleChangeSpy }
onBlur = { handleBlurSpy }
suffix = "ETH"
suffix = "ETH"
nativeCurrency = "ETH"
nativeCurrency = "ETH"
currentCurrency = "usd"
currentCurrency = "usd"
@ -201,14 +200,9 @@ describe('CurrencyInput Component', () => {
assert . equal ( wrapper . find ( '.currency-display-component' ) . text ( ) , '$231.06USD' )
assert . equal ( wrapper . find ( '.currency-display-component' ) . text ( ) , '$231.06USD' )
assert . equal ( currencyInputInstance . state . decimalValue , 1 )
assert . equal ( currencyInputInstance . state . decimalValue , 1 )
assert . equal ( currencyInputInstance . state . hexValue , 'de0b6b3a7640000' )
assert . equal ( currencyInputInstance . state . hexValue , 'de0b6b3a7640000' )
assert . equal ( handleBlurSpy . callCount , 0 )
input . simulate ( 'blur' )
assert . equal ( handleBlurSpy . callCount , 1 )
assert . ok ( handleBlurSpy . calledWith ( 'de0b6b3a7640000' ) )
} )
} )
it ( 'should call onChange and onBlur on input changes with the hex value for fiat' , ( ) => {
it ( 'should call onChange on input changes with the hex value for fiat' , ( ) => {
const mockStore = {
const mockStore = {
metamask : {
metamask : {
nativeCurrency : 'ETH' ,
nativeCurrency : 'ETH' ,
@ -221,7 +215,6 @@ describe('CurrencyInput Component', () => {
< Provider store = { store } >
< Provider store = { store } >
< CurrencyInput
< CurrencyInput
onChange = { handleChangeSpy }
onChange = { handleChangeSpy }
onBlur = { handleBlurSpy }
suffix = "USD"
suffix = "USD"
nativeCurrency = "ETH"
nativeCurrency = "ETH"
currentCurrency = "usd"
currentCurrency = "usd"
@ -248,11 +241,6 @@ describe('CurrencyInput Component', () => {
assert . equal ( wrapper . find ( '.currency-display-component' ) . text ( ) , '0.004328ETH' )
assert . equal ( wrapper . find ( '.currency-display-component' ) . text ( ) , '0.004328ETH' )
assert . equal ( currencyInputInstance . state . decimalValue , 1 )
assert . equal ( currencyInputInstance . state . decimalValue , 1 )
assert . equal ( currencyInputInstance . state . hexValue , 'f602f2234d0ea' )
assert . equal ( currencyInputInstance . state . hexValue , 'f602f2234d0ea' )
assert . equal ( handleBlurSpy . callCount , 0 )
input . simulate ( 'blur' )
assert . equal ( handleBlurSpy . callCount , 1 )
assert . ok ( handleBlurSpy . calledWith ( 'f602f2234d0ea' ) )
} )
} )
it ( 'should change the state and pass in a new decimalValue when props.value changes' , ( ) => {
it ( 'should change the state and pass in a new decimalValue when props.value changes' , ( ) => {
@ -268,7 +256,6 @@ describe('CurrencyInput Component', () => {
< Provider store = { store } >
< Provider store = { store } >
< CurrencyInput
< CurrencyInput
onChange = { handleChangeSpy }
onChange = { handleChangeSpy }
onBlur = { handleBlurSpy }
suffix = "USD"
suffix = "USD"
nativeCurrency = "ETH"
nativeCurrency = "ETH"
currentCurrency = "usd"
currentCurrency = "usd"
@ -304,7 +291,6 @@ describe('CurrencyInput Component', () => {
< Provider store = { store } >
< Provider store = { store } >
< CurrencyInput
< CurrencyInput
onChange = { handleChangeSpy }
onChange = { handleChangeSpy }
onBlur = { handleBlurSpy }
nativeSuffix = "ETH"
nativeSuffix = "ETH"
fiatSuffix = "USD"
fiatSuffix = "USD"
nativeCurrency = "ETH"
nativeCurrency = "ETH"
@ -332,11 +318,6 @@ describe('CurrencyInput Component', () => {
assert . equal ( currencyInputInstance . state . decimalValue , 1 )
assert . equal ( currencyInputInstance . state . decimalValue , 1 )
assert . equal ( currencyInputInstance . state . hexValue , 'de0b6b3a7640000' )
assert . equal ( currencyInputInstance . state . hexValue , 'de0b6b3a7640000' )
assert . equal ( handleBlurSpy . callCount , 0 )
input . simulate ( 'blur' )
assert . equal ( handleBlurSpy . callCount , 1 )
assert . ok ( handleBlurSpy . calledWith ( 'de0b6b3a7640000' ) )
const swap = wrapper . find ( '.currency-input__swap-component' )
const swap = wrapper . find ( '.currency-input__swap-component' )
swap . simulate ( 'click' )
swap . simulate ( 'click' )
assert . equal ( wrapper . find ( '.currency-display-component' ) . text ( ) , '0.004328ETH' )
assert . equal ( wrapper . find ( '.currency-display-component' ) . text ( ) , '0.004328ETH' )