1823 - Added independent order object from card
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
This commit is contained in:
parent
727fcddc3d
commit
6d35a4a160
|
@ -25,8 +25,15 @@ class Controller extends Section {
|
|||
}
|
||||
|
||||
$onChanges() {
|
||||
this.getData().then(() => {
|
||||
if (this.order && this.order.isConfirmed)
|
||||
this.$state.go('order.card.line');
|
||||
});
|
||||
}
|
||||
|
||||
getData() {
|
||||
return this.$http.get(`Orders/${this.$params.id}`)
|
||||
.then(res => this.order = res.data);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -366,8 +373,5 @@ class Controller extends Section {
|
|||
|
||||
ngModule.vnComponent('vnOrderCatalog', {
|
||||
template: require('./index.html'),
|
||||
controller: Controller,
|
||||
bindings: {
|
||||
order: '<'
|
||||
}
|
||||
controller: Controller
|
||||
});
|
||||
|
|
|
@ -28,6 +28,22 @@ describe('Order', () => {
|
|||
};
|
||||
}));
|
||||
|
||||
describe('getData()', () => {
|
||||
it(`should make a query an fetch the order data`, () => {
|
||||
controller._order = null;
|
||||
|
||||
$httpBackend.expect('GET', `Orders/4`).respond(200, {id: 4, isConfirmed: true});
|
||||
$httpBackend.expect('GET', `Orders/4/getItemTypeAvailable?itemCategoryId=1`).respond();
|
||||
controller.getData();
|
||||
$httpBackend.flush();
|
||||
|
||||
const order = controller.order;
|
||||
|
||||
expect(order.id).toEqual(4);
|
||||
expect(order.isConfirmed).toBeTruthy();
|
||||
});
|
||||
});
|
||||
|
||||
describe('order() setter', () => {
|
||||
it(`should call scope $applyAsync() method and apply filters from state params`, () => {
|
||||
$httpBackend.expect('GET', `Orders/4/getItemTypeAvailable?itemCategoryId=1`).respond();
|
||||
|
|
Loading…
Reference in New Issue