5084-monitor.index_tickets #1301
|
@ -478,8 +478,8 @@ export default class SmartTable extends Component {
|
|||
|
||||
const params = {q: JSON.stringify(stateFilter)};
|
||||
|
||||
this.$state.go(this.$state.current.name, params, {location: 'replace'});
|
||||
this.refresh();
|
||||
this.$state.go(this.$state.current.name, params, {location: 'replace'})
|
||||
.then(() => this.refresh());
|
||||
}
|
||||
|
||||
applySort() {
|
||||
|
@ -499,8 +499,8 @@ export default class SmartTable extends Component {
|
|||
stateFilter.tableOrder = order;
|
||||
|
||||
const params = {q: JSON.stringify(stateFilter)};
|
||||
this.$state.go(this.$state.current.name, params, {location: 'replace'});
|
||||
this.refresh();
|
||||
this.$state.go(this.$state.current.name, params, {location: 'replace'})
|
||||
.then(() => this.refresh());
|
||||
}
|
||||
|
||||
filterSanitizer(field) {
|
||||
|
@ -589,7 +589,7 @@ export default class SmartTable extends Component {
|
|||
refresh() {
|
||||
this.isRefreshing = true;
|
||||
this.model.refresh()
|
||||
.then(() => this.isRefreshing = false);
|
||||
.finally(() => this.isRefreshing = false);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -160,7 +160,7 @@ describe('Component smartTable', () => {
|
|||
describe('applySort()', () => {
|
||||
it('should call the $state go and model refresh without making changes on the model order', () => {
|
||||
controller.$state = {
|
||||
go: jest.fn(),
|
||||
go: jest.fn().mockReturnValue(new Promise(resolve => resolve())),
|
||||
current: {
|
||||
name: 'section'
|
||||
}
|
||||
|
@ -171,13 +171,12 @@ describe('Component smartTable', () => {
|
|||
|
||||
expect(controller.model.order).toBeUndefined();
|
||||
expect(controller.$state.go).toHaveBeenCalled();
|
||||
expect(controller.refresh).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('should call the $state go and model refresh after setting model order according to the controller sortCriteria', () => {
|
||||
const orderBy = {field: 'myField', sortType: 'ASC'};
|
||||
controller.$state = {
|
||||
go: jest.fn(),
|
||||
go: jest.fn().mockReturnValue(new Promise(resolve => resolve())),
|
||||
current: {
|
||||
name: 'section'
|
||||
}
|
||||
|
@ -190,7 +189,6 @@ describe('Component smartTable', () => {
|
|||
|
||||
expect(controller.model.order).toEqual(`${orderBy.field} ${orderBy.sortType}`);
|
||||
expect(controller.$state.go).toHaveBeenCalled();
|
||||
expect(controller.refresh).toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -293,12 +291,10 @@ describe('Component smartTable', () => {
|
|||
controller.$inputsScope = {
|
||||
searchProps: {}
|
||||
};
|
||||
jest.spyOn(controller, 'refresh');
|
||||
|
||||
controller.defaultFilter();
|
||||
|
||||
expect(controller.model.addFilter).toHaveBeenCalled();
|
||||
expect(controller.refresh).toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in New Issue