refactor claim_main controller
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Alex Moreno 2022-03-02 11:07:35 +01:00
parent 7c3945a921
commit 619baf2896
3 changed files with 4 additions and 10 deletions

View File

@ -1,13 +1,7 @@
import ngModule from '../module'; import ngModule from '../module';
import ModuleMain from 'salix/components/module-main'; import ModuleMain from 'salix/components/module-main';
export default class Claims extends ModuleMain {
constructor($element, $) {
super($element, $);
}
}
ngModule.vnComponent('vnClaim', { ngModule.vnComponent('vnClaim', {
controller: Claims, controller: ModuleMain,
template: require('./index.html') template: require('./index.html')
}); });

View File

@ -25,7 +25,7 @@ class Controller extends Summary {
.then(() => { .then(() => {
if (this.card) if (this.card)
this.card.reload(); this.card.reload();
// Refresh index model
if (this.parentReload) if (this.parentReload)
this.parentReload(); this.parentReload();
}); });

View File

@ -29,7 +29,7 @@ describe('Claim', () => {
}); });
describe('changeState()', () => { 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(); jest.spyOn(controller.vnApp, 'showSuccess').mockReturnThis();
const expectedParams = {id: 1, claimStateFk: 1}; const expectedParams = {id: 1, claimStateFk: 1};
@ -43,7 +43,7 @@ describe('Claim', () => {
}); });
describe('$onChanges()', () => { describe('$onChanges()', () => {
it('should call loadData when item.id is defined', () => { it('should call loadData when $onChanges is called', () => {
jest.spyOn(controller, 'loadData'); jest.spyOn(controller, 'loadData');
controller.$onChanges(); controller.$onChanges();