From 6d4b97443eea77a1f4912674aa4b23a197087ec7 Mon Sep 17 00:00:00 2001 From: carlosjr Date: Tue, 27 Jul 2021 15:59:59 +0200 Subject: [PATCH 1/2] autoload refreshes the model when url is set --- modules/invoiceOut/front/summary/index.html | 1 + modules/invoiceOut/front/summary/index.js | 10 +--------- 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/modules/invoiceOut/front/summary/index.html b/modules/invoiceOut/front/summary/index.html index 0406a39c5..924972299 100644 --- a/modules/invoiceOut/front/summary/index.html +++ b/modules/invoiceOut/front/summary/index.html @@ -1,6 +1,7 @@ diff --git a/modules/invoiceOut/front/summary/index.js b/modules/invoiceOut/front/summary/index.js index 2446e986a..af0b5365e 100644 --- a/modules/invoiceOut/front/summary/index.js +++ b/modules/invoiceOut/front/summary/index.js @@ -7,7 +7,7 @@ class Controller extends Summary { this._invoiceOut = value; if (value && value.id) { this.getSummary(); - this.getTickets(); + this.$.ticketsModel.url = `InvoiceOuts/${this.invoiceOut.id}/getTickets`; } } @@ -19,14 +19,6 @@ class Controller extends Summary { return this.$http.get(`InvoiceOuts/${this.invoiceOut.id}/summary`) .then(res => this.summary = res.data); } - - getTickets() { - this.$.$applyAsync(() => { - const query = `InvoiceOuts/${this.invoiceOut.id}/getTickets`; - this.$.ticketsModel.url = query; - this.$.ticketsModel.refresh(); - }); - } } ngModule.vnComponent('vnInvoiceOutSummary', { From 6e3a18a923d36ad79e42e38b35271272f2b52a0a Mon Sep 17 00:00:00 2001 From: carlosjr Date: Tue, 27 Jul 2021 18:18:32 +0200 Subject: [PATCH 2/2] removed test for deprecated function --- modules/invoiceOut/front/summary/index.spec.js | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/modules/invoiceOut/front/summary/index.spec.js b/modules/invoiceOut/front/summary/index.spec.js index be6ad0a18..675cc02c3 100644 --- a/modules/invoiceOut/front/summary/index.spec.js +++ b/modules/invoiceOut/front/summary/index.spec.js @@ -27,17 +27,5 @@ describe('InvoiceOut', () => { expect(controller.summary).toEqual('the data you are looking for'); }); }); - - describe('getTickets()', () => { - it('should perform a and then call to the ticketModel refresh() method', () => { - jest.spyOn(controller.$.ticketsModel, 'refresh'); - - controller.getTickets(); - $scope.$apply(); - - expect(controller.$.ticketsModel.url).toEqual('InvoiceOuts/1/getTickets'); - expect(controller.$.ticketsModel.refresh).toHaveBeenCalledWith(); - }); - }); }); });