React-beautiful-dnd: Warning during test

Created on 19 Jan 2018  路  1Comment  路  Source: atlassian/react-beautiful-dnd

Bug or feature request?

Bug.

Expected behavior

Component should not raise warning during test

Actual behavior

The test warn me about

 Warning: Failed context type: The context `private-drag-drop-key-do-not-use-store-droppable-id` is marked as required in `Draggable`, but its value is `undefined`.

Steps to reproduce

This test produce this warning

test('actually renders the component', () => {
    const store = createMockStore(sampleState);
    const container = mount(
      <Provider store={store}>
        <DragDropContext onDragEnd={() => {}}>
          <Container /> // Container contains a Draggable element
        </DragDropContext>
      </Provider>,
    );

    expect(container.html()).toMatchSnapshot();
  });

What is producing this warning? What am I doing wrong?

Most helpful comment

You need to wrap draggables inside a droppable. It is complaining because it cannot find the droppable id that a droppable puts on the context

>All comments

You need to wrap draggables inside a droppable. It is complaining because it cannot find the droppable id that a droppable puts on the context

Was this page helpful?
0 / 5 - 0 ratings