Skip to content

Commit ceb1200

Browse files
committed
fixup! Wrap menu providers children in a container
1 parent c436d82 commit ceb1200

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

packages/compass-context-menu/src/use-context-menu.spec.tsx

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ describe('useContextMenu', function () {
158158

159159
it('renders without error', function () {
160160
render(
161-
<ContextMenuProvider menuWrapper={TestMenu}>
161+
<ContextMenuProvider container={document.body} menuWrapper={TestMenu}>
162162
<TestComponent />
163163
</ContextMenuProvider>
164164
);
@@ -170,7 +170,7 @@ describe('useContextMenu', function () {
170170
const onRegister = sinon.spy();
171171

172172
render(
173-
<ContextMenuProvider menuWrapper={TestMenu}>
173+
<ContextMenuProvider container={document.body} menuWrapper={TestMenu}>
174174
<TestComponent onRegister={onRegister} />
175175
</ContextMenuProvider>
176176
);
@@ -181,7 +181,7 @@ describe('useContextMenu', function () {
181181

182182
it('shows context menu on right click', function () {
183183
render(
184-
<ContextMenuProvider menuWrapper={TestMenu}>
184+
<ContextMenuProvider container={document.body} menuWrapper={TestMenu}>
185185
<TestComponent />
186186
</ContextMenuProvider>
187187
);
@@ -196,7 +196,7 @@ describe('useContextMenu', function () {
196196
describe('with nested context menus', function () {
197197
it('shows only parent items when right clicking parent area', function () {
198198
render(
199-
<ContextMenuProvider menuWrapper={TestMenu}>
199+
<ContextMenuProvider container={document.body} menuWrapper={TestMenu}>
200200
<ParentComponent />
201201
</ContextMenuProvider>
202202
);
@@ -215,7 +215,7 @@ describe('useContextMenu', function () {
215215

216216
it('shows both parent and child items when right clicking child area', function () {
217217
render(
218-
<ContextMenuProvider menuWrapper={TestMenu}>
218+
<ContextMenuProvider container={document.body} menuWrapper={TestMenu}>
219219
<ParentComponent>
220220
<ChildComponent />
221221
</ParentComponent>
@@ -237,7 +237,7 @@ describe('useContextMenu', function () {
237237
const childOnAction = sinon.spy();
238238

239239
render(
240-
<ContextMenuProvider menuWrapper={TestMenu}>
240+
<ContextMenuProvider container={document.body} menuWrapper={TestMenu}>
241241
<ParentComponent onAction={parentOnAction}>
242242
<ChildComponent onAction={childOnAction} />
243243
</ParentComponent>
@@ -260,7 +260,7 @@ describe('useContextMenu', function () {
260260
const childOnAction = sinon.spy();
261261

262262
render(
263-
<ContextMenuProvider menuWrapper={TestMenu}>
263+
<ContextMenuProvider container={document.body} menuWrapper={TestMenu}>
264264
<ParentComponent onAction={parentOnAction}>
265265
<ChildComponent onAction={childOnAction} />
266266
</ParentComponent>
@@ -284,6 +284,7 @@ describe('useContextMenu', function () {
284284

285285
render(
286286
<ContextMenuProvider
287+
container={document.body}
287288
menuWrapper={TestMenu}
288289
onContextMenuOpen={onContextMenuOpen}
289290
>
@@ -310,7 +311,10 @@ describe('useContextMenu', function () {
310311
for (const event of ['scroll', 'resize', 'click']) {
311312
it(`closes menu on window ${event} event`, function () {
312313
render(
313-
<ContextMenuProvider menuWrapper={TestMenu}>
314+
<ContextMenuProvider
315+
container={document.body}
316+
menuWrapper={TestMenu}
317+
>
314318
<TestComponent />
315319
</ContextMenuProvider>
316320
);

0 commit comments

Comments
 (0)