Have a test which simulates drag & drop behavior which used to work in enzyme 2 but doesnt now with enzyme 3. Not too sure whats going on .
card.get(...).getHandlerId is not a function
```
const component = mount(
const card = component.find(Card);
component.instance().getManager().getBackend().simulateBeginDrag([card.get(0).getHandlerId()]);
This is the card :
{ '$$typeof': Symbol(react.element),
type:
{ [Function: DragDropContainer]
DecoratedComponent: { [Function: Card] propTypes: [Object] },
displayName: 'DragSource(Card)',
contextTypes: { dragDropManager: [Function: bound checkType] } },
key: null,
ref: null,
props:
{ _id: '111',
cellId: '11',
component:
{ '$$typeof': Symbol(react.element),
type: [Function: Template],
key: null,
ref: null,
props: {},
_owner: null,
_store: {} },
dropHandler:
{ [Function: noop]
_isMockFunction: true,
getMockImplementation: [Function],
mock: [Getter/Setter],
mockClear: [Function],
mockReset: [Function],
mockReturnValueOnce: [Function],
mockReturnValue: [Function],
mockImplementationOnce: [Function],
mockImplementation: [Function],
mockReturnThis: [Function],
mockRestore: [Function] },
_recordId: 'mocked-record',
_parentContainerId: 'mocked-parent' },
_owner: null,
_store: {}
}
| library | version
| ---------------- | -------
| Enzyme | latest
| React | 15.5.4
Instead of .get(0), you might want .getElement(0)? (mentioned in the migration guide)
@ljharb nope that doesnt work
card.instance()?
I鈥檓 confused; your initial example is using mount. Are you now using shallow?
@ljharb - sorry worked. I just realized that I accidentaly changed it to shallow & saw that error. Just deleted my comment before ur comment lol my bad.
Changed it back to mount & instance() works .
but it din't work with getElement() because ?
I鈥檓 mobile rn so I鈥檓 probably remembering wrong; but in v3, instance returns the node, getElement returns the React element.
Most helpful comment
card.instance()?