testRestoreSelectionOnOk() {
    setUpRealEditableField();

    fieldObj.setSafeHtml(false, SafeHtml.htmlEscape('12345'));

    const elem = fieldObj.getElement();
    const helper = new TestHelper(elem);
    helper.select('12345', 1, '12345', 4);  // Selects '234'.

    assertEquals(
        'Incorrect text selected before dialog is opened', '234',
        fieldObj.getRange().getText());
    plugin.execCommand(Command.HELLO_WORLD_DIALOG);

    // TODO(user): IE returns some bogus range when field doesn't have
    // selection. Remove the expectedFailure when robbyw fixes the issue.
    // NOTE(user): You can't remove the selection from a field in Opera without
    // blurring it.
    elem.parentNode.blur();
    expectedFailures.expectFailureFor(googUserAgent.IE);
    try {
      assertNull(
          'There should be no selection while dialog is open',
          fieldObj.getRange());
    } catch (e) {
      expectedFailures.handleException(e);
    }

    googTestingEvents.fireClickSequence(plugin.dialog_.getOkButtonElement());
    assertEquals(
        'No text should be selected after clicking ok', '',
        fieldObj.getRange().getText());

    // Test that the caret is placed after the custom message.
    googTestingEditorDom.assertRangeBetweenText(
        'Hello, world!', '5', fieldObj.getRange());
  }
Tests that the selection is cleared when the dialog opens and is
correctly restored after ok is clicked.
@suppress {visibility} suppression added to enable type checking