#1486 back test updateDiscount

This commit is contained in:
Carlos Jimenez Ruiz 2019-06-06 09:34:36 +02:00
parent 55ea445f02
commit 3082ce2556
3 changed files with 11 additions and 7 deletions

View File

@ -11,7 +11,7 @@ class Controller {
set edit(value) {
this._edit = value;
this.clear();
this.clearDiscount();
this.setNewDiscount();
}
@ -48,8 +48,9 @@ class Controller {
const query = `/api/Tickets/${this.$state.params.id}/updateDiscount`;
this.$http.post(query, params).then(() => {
this.vnApp.showSuccess(this.$translate.instant('Data saved!'));
this.clear();
this.clearDiscount();
modified = false;
this.vnTicketSale.$scope.model.refresh();
}).catch(e => {
this.vnApp.showError(e.data.error.message);
});
@ -59,7 +60,7 @@ class Controller {
this.vnApp.showError(this.$translate.instant('There are no changes to save'));
}
clear() {
clearDiscount() {
this.newDiscount = null;
}
}
@ -74,5 +75,8 @@ ngModule.component('vnTicketSaleEditDiscount', {
mana: '<?',
bulk: '<?',
onHide: '&'
},
require: {
vnTicketSale: '^vnTicketSale'
}
});

View File

@ -1,4 +1,4 @@
import './editDiscount.js';
import '../editDiscount.js';
describe('Ticket', () => {
describe('Component vnTicketSaleEditDiscount', () => {
@ -75,9 +75,9 @@ describe('Ticket', () => {
});
});
describe('clear()', () => {
describe('clearDiscount()', () => {
it('should set newDiscount to null', () => {
controller.clear();
controller.clearDiscount();
expect(controller.newDiscount).toEqual(null);
});

View File

@ -1,4 +1,4 @@
import './index.js';
import '../index.js';
describe('Ticket', () => {
describe('Component vnTicketSale', () => {