testExecTwice(reuse = undefined) {
    setUpMockRange();
    if (reuse) {
      expectOpened(2);  // The second exec should cause a second OPENED event.
      // But the dialog was not closed between exec calls, so only one CLOSED is
      // expected.
      expectClosed();
      plugin.setReuseDialog(true);
      mockField.debounceEvent(Field.EventType.SELECTIONCHANGE);
    } else {
      expectOpened(2);  // The second exec should cause a second OPENED event.
      // The first dialog will be disposed so there should be two CLOSED events.
      expectClosed(2);
      mockSavedRange.restore();  // Expected 2x, once already recorded in setup.
      mockField.focus();         // Expected 2x, once already recorded in setup.
      mockField.debounceEvent(Field.EventType.SELECTIONCHANGE);
      mockField.$times(2);
    }
    mockCtrl.$replayAll();

    assertFalse(
        'Dialog should not be open yet',
        !!plugin.getDialog() && plugin.getDialog().isOpen());

    plugin.execCommand(COMMAND);
    assertTrue(
        'Dialog should be open now',
        !!plugin.getDialog() && plugin.getDialog().isOpen());

    /** @suppress {visibility} suppression added to enable type checking */
    const tempDialog = plugin.getDialog();
    plugin.execCommand(COMMAND);
    if (reuse) {
      assertTrue(
          'Reused dialog should still be open after second exec',
          tempDialog.isOpen());
      assertFalse(
          'Reused dialog should not be disposed after second exec',
          tempDialog.isDisposed());
    } else {
      assertFalse(
          'First dialog should not still be open after opening second',
          tempDialog.isOpen());
      assertTrue(
          'First dialog should be disposed after opening second',
          tempDialog.isDisposed());
    }
    plugin.dispose();
    mockCtrl.$verifyAll();
  }
Tests the flow of calling execCommand (which opens a dialog) and
then calling it again before the first dialog is closed. This is not
something anyone should be doing since dialogs are (usually?) modal so the
user can't do another execCommand before closing the first dialog. But
since the API makes it possible, I thought it would be good to guard
against and unit test.
@param {boolean=} reuse Whether to set the plugin to reuse its dialog.
@suppress {visibility,missingProperties} suppression added to enable type
checking