From 619baf289677a7f2b91e82249a77bfb45213466b Mon Sep 17 00:00:00 2001 From: alexm Date: Wed, 2 Mar 2022 11:07:35 +0100 Subject: [PATCH] refactor claim_main controller --- modules/claim/front/main/index.js | 8 +------- modules/claim/front/summary/index.js | 2 +- modules/claim/front/summary/index.spec.js | 4 ++-- 3 files changed, 4 insertions(+), 10 deletions(-) diff --git a/modules/claim/front/main/index.js b/modules/claim/front/main/index.js index a9fad2eeb4..0c5c7d7281 100644 --- a/modules/claim/front/main/index.js +++ b/modules/claim/front/main/index.js @@ -1,13 +1,7 @@ import ngModule from '../module'; import ModuleMain from 'salix/components/module-main'; -export default class Claims extends ModuleMain { - constructor($element, $) { - super($element, $); - } -} - ngModule.vnComponent('vnClaim', { - controller: Claims, + controller: ModuleMain, template: require('./index.html') }); diff --git a/modules/claim/front/summary/index.js b/modules/claim/front/summary/index.js index cc9799f056..721f518469 100644 --- a/modules/claim/front/summary/index.js +++ b/modules/claim/front/summary/index.js @@ -25,7 +25,7 @@ class Controller extends Summary { .then(() => { if (this.card) this.card.reload(); - // Refresh index model + if (this.parentReload) this.parentReload(); }); diff --git a/modules/claim/front/summary/index.spec.js b/modules/claim/front/summary/index.spec.js index 02bdf21d24..8540a3a974 100644 --- a/modules/claim/front/summary/index.spec.js +++ b/modules/claim/front/summary/index.spec.js @@ -29,7 +29,7 @@ describe('Claim', () => { }); describe('changeState()', () => { - it('should make an HTTP post query, then call the showSuccess(), reload() and resetChanges() methods', () => { + it('should make an HTTP post query, then call the showSuccess()', () => { jest.spyOn(controller.vnApp, 'showSuccess').mockReturnThis(); const expectedParams = {id: 1, claimStateFk: 1}; @@ -43,7 +43,7 @@ describe('Claim', () => { }); describe('$onChanges()', () => { - it('should call loadData when item.id is defined', () => { + it('should call loadData when $onChanges is called', () => { jest.spyOn(controller, 'loadData'); controller.$onChanges();