Skip to content

Commit d5105e8

Browse files
change default behaviour of test-utils deref and simplify tests
1 parent 982d8d8 commit d5105e8

File tree

4 files changed

+10
-10
lines changed

4 files changed

+10
-10
lines changed

src/__tests__/connectTraceToPlot-test.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Traces.forEach(Trace => {
1818
describe(`<${Trace.displayName}>`, () => {
1919
it('wraps container with fullValue pointing to gd._fullData[i]', () => {
2020
const wrapper = mount(
21-
<Editor {...fixtures.scatter({deref: true})}>
21+
<Editor {...fixtures.scatter()}>
2222
<Trace traceIndex={0}>
2323
<Numeric label="Marker Size" attr="marker.size" />
2424
</Trace>
@@ -33,7 +33,7 @@ Traces.forEach(Trace => {
3333
it('sends updates to gd.data', () => {
3434
const onUpdate = jest.fn();
3535
const wrapper = mount(
36-
<Editor onUpdate={onUpdate} {...fixtures.scatter({deref: true})}>
36+
<Editor onUpdate={onUpdate} {...fixtures.scatter()}>
3737
<Trace traceIndex={0}>
3838
<Numeric label="Marker Size" attr="marker.size" />
3939
</Trace>
@@ -54,7 +54,7 @@ Traces.forEach(Trace => {
5454
it('automatically computes min and max defaults', () => {
5555
const onUpdate = jest.fn();
5656
const wrapper = mount(
57-
<Editor onUpdate={onUpdate} {...fixtures.scatter({deref: true})}>
57+
<Editor onUpdate={onUpdate} {...fixtures.scatter()}>
5858
<Trace traceIndex={0}>
5959
<Numeric label="marker size" attr="marker.size" />
6060
</Trace>

src/components/containers/__tests__/Section-test.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ describe('Section', () => {
1212
it('is visible if it contains any visible children', () => {
1313
// mode is visible with scatter. Hole is not visible. Section should show.
1414
const wrapper = mount(
15-
<TestEditor onUpdate={jest.fn()} {...fixtures.scatter({deref: true})}>
15+
<TestEditor onUpdate={jest.fn()} {...fixtures.scatter()}>
1616
<TraceSection traceIndex={0} name="test-section">
1717
<Flaglist
1818
attr="mode"
@@ -46,7 +46,7 @@ describe('Section', () => {
4646

4747
it('is visible if it contains any non attr children', () => {
4848
const wrapper = mount(
49-
<TestEditor onUpdate={jest.fn()} {...fixtures.scatter({deref: true})}>
49+
<TestEditor onUpdate={jest.fn()} {...fixtures.scatter()}>
5050
<Section name="test-section">
5151
<Info>INFO</Info>
5252
</Section>
@@ -61,7 +61,7 @@ describe('Section', () => {
6161
it('is not visible if it contains no visible children', () => {
6262
// pull and hole are not scatter attrs. Section should not show.
6363
const wrapper = mount(
64-
<TestEditor onUpdate={jest.fn()} {...fixtures.scatter({deref: true})}>
64+
<TestEditor onUpdate={jest.fn()} {...fixtures.scatter()}>
6565
<TraceSection traceIndex={0} name="test-section">
6666
<Numeric attr="pull" min={0} max={1} step={0.1} traceIndex={0} />
6767
<Numeric attr="hole" min={0} max={1} step={0.1} traceIndex={0} />
@@ -81,7 +81,7 @@ describe('Section', () => {
8181

8282
it('will render first menuPanel even with no visible attrs', () => {
8383
const wrapper = mount(
84-
<TestEditor onUpdate={jest.fn()} {...fixtures.scatter({deref: true})}>
84+
<TestEditor onUpdate={jest.fn()} {...fixtures.scatter()}>
8585
<Section name="test-section">
8686
<MenuPanel show>
8787
<Info>INFO</Info>

src/components/fields/__tests__/Radio-test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ const Trace = connectTraceToPlot(Section);
1111
describe('<Radio>', () => {
1212
it('enables <Field> centering by default', () => {
1313
const wrapper = mount(
14-
<TestEditor plotly={plotly} {...fixtures.area({deref: 'true'})}>
14+
<TestEditor plotly={plotly} {...fixtures.area()}>
1515
<Trace traceIndex={0}>
1616
<Radio
1717
label="Connect Gaps"
@@ -30,7 +30,7 @@ describe('<Radio>', () => {
3030

3131
it('permits <Field> centering to be disabled', () => {
3232
const wrapper = mount(
33-
<TestEditor plotly={plotly} {...fixtures.area({deref: 'true'})}>
33+
<TestEditor plotly={plotly} {...fixtures.area()}>
3434
<Trace traceIndex={0}>
3535
<Radio
3636
center={false}

src/lib/test-utils.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ function applyConfig(config = {}, {graphDiv: {data, layout}, dataSources}) {
6565
if (config.data) {
6666
extendDeep(data, config.data);
6767
}
68-
if (config.deref) {
68+
if (config.deref !== false) {
6969
dereference(data, dataSources);
7070
}
7171

0 commit comments

Comments
 (0)