3
3
import React from 'react' ;
4
4
import { expect } from 'chai' ;
5
5
import { spy } from 'sinon' ;
6
- import { mount } from 'enzyme' ;
6
+ import Adapter from 'enzyme-adapter-react-16' ;
7
+ import Enzyme , { mount } from 'enzyme' ;
7
8
import AnchorElement from './../src/anchor-element' ;
8
9
import { defaultConfig } from './../src/ctx-types' ;
9
10
import { omit } from './test-utils' ;
10
11
12
+ Enzyme . configure ( { adapter : new Adapter ( ) } ) ;
13
+
11
14
describe ( 'AnchorElement' , ( ) => {
12
15
it ( 'should register with scroller on mount' , ( ) => {
13
16
const registerElementPanel = spy ( ) ;
@@ -37,15 +40,15 @@ describe('AnchorElement', () => {
37
40
describe ( 'getConfig' , ( ) => {
38
41
it ( 'should return defaults if no props are provided' , ( ) => {
39
42
const wrapper = mount ( < AnchorElement id = "test" > < h1 > Test</ h1 > </ AnchorElement > ) ;
40
- const config = wrapper . node . getConfig ( ) ;
43
+ const config = wrapper . instance ( ) . getConfig ( ) ;
41
44
42
45
expect ( omit ( config , [ 'children' , 'isInside' , 'id' ] ) ) . to . deep . equal ( defaultConfig ) ;
43
46
} ) ;
44
47
45
48
it ( 'should inherit from context' , ( ) => {
46
49
const ctx = { offset : 10 , events : { test : 0 } , animate : false , container : { } } ;
47
50
const wrapper = mount ( < AnchorElement id = "test" > < h1 > Test</ h1 > </ AnchorElement > , { context : ctx } ) ;
48
- const config = wrapper . node . getConfig ( ) ;
51
+ const config = wrapper . instance ( ) . getConfig ( ) ;
49
52
50
53
expect ( omit ( config , [ 'children' , 'isInside' , 'id' ] ) ) . to . not . deep . equal ( defaultConfig ) ;
51
54
expect ( omit ( config , [ 'children' , 'isInside' , 'id' ] ) ) . to . deep . equal ( ctx ) ;
@@ -59,7 +62,7 @@ describe('AnchorElement', () => {
59
62
{ context : ctx }
60
63
) ;
61
64
62
- const config = wrapper . node . getConfig ( ) ;
65
+ const config = wrapper . instance ( ) . getConfig ( ) ;
63
66
64
67
expect ( omit ( config , [ 'children' , 'isInside' , 'id' ] ) ) . to . not . deep . equal ( defaultConfig ) ;
65
68
expect ( omit ( config , [ 'children' , 'isInside' , 'id' ] ) ) . to . not . deep . equal ( ctx ) ;
0 commit comments