1
- import NumericInput from '../../components/widgets/NumericInput' ;
2
1
import React from 'react' ;
3
- import { MULTI_VALUED_PLACEHOLDER } from '../constants' ;
4
2
import { Numeric } from '../../components' ;
5
3
import { TestEditor , fixtures , plotly } from '../test-utils' ;
6
4
import { connectLayoutToPlot , connectAxesToLayout } from '..' ;
7
5
import { mount } from 'enzyme' ;
8
6
9
7
describe ( 'multiValued Numeric' , ( ) => {
10
- it ( 'uses placeholder and empty string value' , ( ) => {
11
- const fixtureProps = fixtures . scatter ( {
12
- layout : { xaxis : { range : [ 0 , 1 ] } , yaxis : { range : [ - 1 , 1 ] } } ,
13
- } ) ;
14
- const AxesNumeric = connectLayoutToPlot ( connectAxesToLayout ( Numeric ) ) ;
15
-
16
- const rangeInputs = mount (
17
- < TestEditor { ...{ ...fixtureProps , onUpdate : jest . fn ( ) , plotly} } >
18
- < AxesNumeric attr = "range[0]" />
19
- </ TestEditor >
20
- ) . find ( NumericInput ) ;
21
-
22
- expect ( rangeInputs . length ) . toBe ( 1 ) ;
23
-
24
- const allaxisRangeInput = rangeInputs . at ( 0 ) ;
25
-
26
- expect ( allaxisRangeInput . prop ( 'value' ) ) . toBe ( '' ) ;
27
- expect ( allaxisRangeInput . prop ( 'placeholder' ) ) . toBe (
28
- MULTI_VALUED_PLACEHOLDER
29
- ) ;
30
- } ) ;
31
-
32
8
it ( 'uses multiValued defaultContainer as default increment value' , ( ) => {
33
9
const beforeUpdateLayout = jest . fn ( ) ;
34
10
const xaxisLowerRange = - 30 ;
@@ -48,9 +24,7 @@ describe('multiValued Numeric', () => {
48
24
expect ( beforeUpdateLayout ) . toBeCalled ( ) ;
49
25
const payload = beforeUpdateLayout . mock . calls [ 0 ] [ 0 ] ;
50
26
expect ( payload . update ) . toEqual ( {
51
- 'xaxis.range[0]' : xaxisLowerRange ,
52
- 'yaxis.range[0]' : xaxisLowerRange ,
53
- 'yaxis2.range[0]' : xaxisLowerRange ,
27
+ 'xaxis.range[0]' : xaxisLowerRange + 1 ,
54
28
} ) ;
55
29
} ) ;
56
30
} ) ;
0 commit comments