testCustomButton() {
    dialog = createTestDialog();
    expectCustomButton(dialog);
    expectAfterHide(dialog);
    mockCtrl.$replayAll();

    builder.addButton('My Custom Button', () => {
      dialog.dispatchEvent(CUSTOM_EVENT);
    }, CUSTOM_BUTTON_ID);

    dialog.show();
    events.fireClickSequence(dialog.getButtonElement(CUSTOM_BUTTON_ID));
    assertNotOpen(
        'Dialog should not be open after clicking custom button', dialog);

    mockCtrl.$verifyAll();
  }
Tests that clicking the custom button dispatches the custom event and
closes the dialog (dispatching the AFTER_HIDE event too).
@suppress {checkTypes,visibility} suppression added to enable type checking