testCancel() {
    dialog = createTestDialog();
    expectCancel(dialog);
    expectAfterHide(dialog);
    mockCtrl.$replayAll();

    builder.addCancelButton('My Cancel Button');

    dialog.show();
    events.fireClickSequence(dialog.getCancelButtonElement());
    assertNotOpen('Dialog should not be open after clicking Cancel', dialog);

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