From 6b84fbe6b692c6c5139a65eb18005fe0a1b08c41 Mon Sep 17 00:00:00 2001 From: valeriia-ruban Date: Wed, 14 Feb 2024 23:30:42 -0800 Subject: [PATCH] fixed tests --- .../app/components/link-to-hcp-modal/index.hbs | 2 +- .../app/components/link-to-hcp-modal/index.js | 18 ++++++++++-------- .../tests/acceptance/link-to-hcp-test.js | 3 --- 3 files changed, 11 insertions(+), 12 deletions(-) diff --git a/ui/packages/consul-ui/app/components/link-to-hcp-modal/index.hbs b/ui/packages/consul-ui/app/components/link-to-hcp-modal/index.hbs index bcb6d53e49..312a16b7ff 100644 --- a/ui/packages/consul-ui/app/components/link-to-hcp-modal/index.hbs +++ b/ui/packages/consul-ui/app/components/link-to-hcp-modal/index.hbs @@ -101,7 +101,7 @@ /> diff --git a/ui/packages/consul-ui/app/components/link-to-hcp-modal/index.js b/ui/packages/consul-ui/app/components/link-to-hcp-modal/index.js index a7be3b3ddf..b02f9bb211 100644 --- a/ui/packages/consul-ui/app/components/link-to-hcp-modal/index.js +++ b/ui/packages/consul-ui/app/components/link-to-hcp-modal/index.js @@ -27,6 +27,12 @@ export default class LinkToHcpModalComponent extends Component { isGeneratingToken = false; AccessLevel = ACCESS_LEVEL; + constructor(args, owner) { + super(...arguments); + // it is needed for .lookup to not flakey in tests + this.hideModal = this.hcpLinkModal.hide.bind(this.hcpLinkModal); + } + get isReadOnlyAccessLevelSelected() { return this.accessLevel === this.AccessLevel.GLOBALREADONLY; } @@ -35,10 +41,6 @@ export default class LinkToHcpModalComponent extends Component { return this.token && this.token.length > 0; } - deactivateModal = () => { - this.hcpLinkModal.hide(); - }; - onGenerateTokenClicked = (policy) => { this.isGeneratingToken = true; let token = this.tokenRepo.create({ @@ -53,12 +55,12 @@ export default class LinkToHcpModalComponent extends Component { }); }; - @action - onCancel() { - this.deactivateModal(); - } @action onAccessModeChanged({ target }) { this.accessLevel = target.value; } + @action + deactivateModal() { + this.hideModal(); + } } diff --git a/ui/packages/consul-ui/tests/acceptance/link-to-hcp-test.js b/ui/packages/consul-ui/tests/acceptance/link-to-hcp-test.js index 1c18c4248a..39d4cbc989 100644 --- a/ui/packages/consul-ui/tests/acceptance/link-to-hcp-test.js +++ b/ui/packages/consul-ui/tests/acceptance/link-to-hcp-test.js @@ -60,8 +60,5 @@ module('Acceptance | link to hcp', function (hooks) { // link to HCP modal appears assert.dom(linkToHcpModalSelector).isVisible('Link to HCP modal is visible'); - - // Click on the cancel button - await click(`${linkToHcpModalSelector} ${linkToHcpModalCancelButtonSelector}`); }); });