title: Opening and closing dialog modal and waiting for response through provider
body: <p>Using React Testing Library to test a dialog provider. I can get it to open, and assert on it appearing — but for some reason I can't get it to close in the test. Do I need to rerender or something?</p>
  
  <pre><code>test('await the closing or confirming of the modal', async () =&gt; {
    const { debug, getByText, queryByText } = render(
      &lt;DialogProvider&gt;
        &lt;Test /&gt;
      &lt;/DialogProvider&gt;,
    );
    const openDialogButton = getByText(/click me/i);
    fireEvent.click(openDialogButton);
    await wait(() =&gt; getByText(/ok/i));
    fireEvent.click(getByText(/ok/i));
    debug();
  });
  
  
  function Test() {
    const confirm = useConfirmation();
    return (
      &lt;button
        onClick={() =&gt; {
          confirm({ variant: 'info' });
        }}
      &gt;
        click me
      &lt;/button&gt;
    );
  }
  </code></pre>