fixed tests

pull/20644/head
valeriia-ruban 2024-02-14 23:30:42 -08:00
parent 6bbcc993a4
commit 6b84fbe6b6
3 changed files with 11 additions and 12 deletions

View File

@ -101,7 +101,7 @@
/> />
<Hds::Button type="button" @text="Cancel" @color="secondary" <Hds::Button type="button" @text="Cancel" @color="secondary"
data-test-link-to-hcp-modal-cancel-button data-test-link-to-hcp-modal-cancel-button
{{on "click" (fn this.deactivateModal)}} {{on "click" F.close}}
/> />
</Hds::ButtonSet> </Hds::ButtonSet>
</M.Footer> </M.Footer>

View File

@ -27,6 +27,12 @@ export default class LinkToHcpModalComponent extends Component {
isGeneratingToken = false; isGeneratingToken = false;
AccessLevel = ACCESS_LEVEL; 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() { get isReadOnlyAccessLevelSelected() {
return this.accessLevel === this.AccessLevel.GLOBALREADONLY; return this.accessLevel === this.AccessLevel.GLOBALREADONLY;
} }
@ -35,10 +41,6 @@ export default class LinkToHcpModalComponent extends Component {
return this.token && this.token.length > 0; return this.token && this.token.length > 0;
} }
deactivateModal = () => {
this.hcpLinkModal.hide();
};
onGenerateTokenClicked = (policy) => { onGenerateTokenClicked = (policy) => {
this.isGeneratingToken = true; this.isGeneratingToken = true;
let token = this.tokenRepo.create({ let token = this.tokenRepo.create({
@ -53,12 +55,12 @@ export default class LinkToHcpModalComponent extends Component {
}); });
}; };
@action
onCancel() {
this.deactivateModal();
}
@action @action
onAccessModeChanged({ target }) { onAccessModeChanged({ target }) {
this.accessLevel = target.value; this.accessLevel = target.value;
} }
@action
deactivateModal() {
this.hideModal();
}
} }

View File

@ -60,8 +60,5 @@ module('Acceptance | link to hcp', function (hooks) {
// link to HCP modal appears // link to HCP modal appears
assert.dom(linkToHcpModalSelector).isVisible('Link to HCP modal is visible'); assert.dom(linkToHcpModalSelector).isVisible('Link to HCP modal is visible');
// Click on the cancel button
await click(`${linkToHcpModalSelector} ${linkToHcpModalCancelButtonSelector}`);
}); });
}); });