test: refs #244936 remove window.open called
gitea/salix/pipeline/pr-master This commit looks good Details

This commit is contained in:
Robert Ferrús 2024-12-02 12:25:27 +01:00
parent 30da83a88c
commit d355b320b4
2 changed files with 2 additions and 5 deletions

View File

@ -388,8 +388,9 @@ class Controller extends Section {
newOrderFromTicket() {
this.$http.post(`Orders/newFromTicket`, {ticketFk: this.ticket.id}).then(async res => {
window.location.href = await this.vnApp.getUrl(`order/${res.data}/catalog`);
const path = await this.vnApp.getUrl(`order/${res.data}/catalog`);
window.open(path, '_blank');
this.vnApp.showSuccess(this.$t('Order created'));
});
}

View File

@ -567,14 +567,10 @@ describe('Ticket', () => {
const expectedResponse = {id: 123};
window.open = jasmine.createSpy('open');
controller.$state.href = jasmine.createSpy('href')
.and.returnValue('/somePath');
$httpBackend.expect('POST', `Orders/newFromTicket`, expectedParams).respond(expectedResponse);
controller.newOrderFromTicket();
$httpBackend.flush();
expect(window.open).toHaveBeenCalledWith('/somePath', '_blank');
});
});