#1486 back test updateDiscount
This commit is contained in:
parent
55ea445f02
commit
3082ce2556
|
@ -11,7 +11,7 @@ class Controller {
|
||||||
|
|
||||||
set edit(value) {
|
set edit(value) {
|
||||||
this._edit = value;
|
this._edit = value;
|
||||||
this.clear();
|
this.clearDiscount();
|
||||||
this.setNewDiscount();
|
this.setNewDiscount();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -48,8 +48,9 @@ class Controller {
|
||||||
const query = `/api/Tickets/${this.$state.params.id}/updateDiscount`;
|
const query = `/api/Tickets/${this.$state.params.id}/updateDiscount`;
|
||||||
this.$http.post(query, params).then(() => {
|
this.$http.post(query, params).then(() => {
|
||||||
this.vnApp.showSuccess(this.$translate.instant('Data saved!'));
|
this.vnApp.showSuccess(this.$translate.instant('Data saved!'));
|
||||||
this.clear();
|
this.clearDiscount();
|
||||||
modified = false;
|
modified = false;
|
||||||
|
this.vnTicketSale.$scope.model.refresh();
|
||||||
}).catch(e => {
|
}).catch(e => {
|
||||||
this.vnApp.showError(e.data.error.message);
|
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'));
|
this.vnApp.showError(this.$translate.instant('There are no changes to save'));
|
||||||
}
|
}
|
||||||
|
|
||||||
clear() {
|
clearDiscount() {
|
||||||
this.newDiscount = null;
|
this.newDiscount = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -74,5 +75,8 @@ ngModule.component('vnTicketSaleEditDiscount', {
|
||||||
mana: '<?',
|
mana: '<?',
|
||||||
bulk: '<?',
|
bulk: '<?',
|
||||||
onHide: '&'
|
onHide: '&'
|
||||||
|
},
|
||||||
|
require: {
|
||||||
|
vnTicketSale: '^vnTicketSale'
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import './editDiscount.js';
|
import '../editDiscount.js';
|
||||||
|
|
||||||
describe('Ticket', () => {
|
describe('Ticket', () => {
|
||||||
describe('Component vnTicketSaleEditDiscount', () => {
|
describe('Component vnTicketSaleEditDiscount', () => {
|
||||||
|
@ -75,9 +75,9 @@ describe('Ticket', () => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('clear()', () => {
|
describe('clearDiscount()', () => {
|
||||||
it('should set newDiscount to null', () => {
|
it('should set newDiscount to null', () => {
|
||||||
controller.clear();
|
controller.clearDiscount();
|
||||||
|
|
||||||
expect(controller.newDiscount).toEqual(null);
|
expect(controller.newDiscount).toEqual(null);
|
||||||
});
|
});
|
|
@ -1,4 +1,4 @@
|
||||||
import './index.js';
|
import '../index.js';
|
||||||
|
|
||||||
describe('Ticket', () => {
|
describe('Ticket', () => {
|
||||||
describe('Component vnTicketSale', () => {
|
describe('Component vnTicketSale', () => {
|
Loading…
Reference in New Issue