#1774 travel.index test and refactor
This commit is contained in:
parent
9fd0ab0bd3
commit
d02c79d2e8
|
@ -22,7 +22,7 @@ describe('Agency Component vnZoneIndex', () => {
|
|||
expect(result).toEqual({id: 1});
|
||||
});
|
||||
|
||||
it('should return a formated object with the warehouseFk in case of agencyModeFk', () => {
|
||||
it('should return a formated object with the agencyModeFk in case of agencyModeFk', () => {
|
||||
let param = 'agencyModeFk';
|
||||
let value = 'My Delivery';
|
||||
let result = controller.exprBuilder(param, value);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<mg-ajax path="/api/Routes/{{patch.params.id}}" options="vnPatch"></mg-ajax>
|
||||
<mg-ajax path="api/Routes/{{patch.params.id}}" options="vnPatch"></mg-ajax>
|
||||
<vn-watcher
|
||||
vn-id="watcher"
|
||||
data="$ctrl.route"
|
||||
|
@ -11,7 +11,7 @@
|
|||
<vn-autocomplete
|
||||
vn-one
|
||||
ng-model="$ctrl.route.workerFk"
|
||||
url="/api/Clients/activeWorkersWithRole"
|
||||
url="api/Clients/activeWorkersWithRole"
|
||||
show-field="nickname"
|
||||
search-function="{firstName: $search}"
|
||||
value-field="id"
|
||||
|
@ -21,7 +21,7 @@
|
|||
<vn-autocomplete
|
||||
vn-one
|
||||
ng-model="$ctrl.route.vehicleFk"
|
||||
url="/api/Vehicles"
|
||||
url="api/Vehicles"
|
||||
show-field="numberPlate"
|
||||
value-field="id"
|
||||
label="Vehicle">
|
||||
|
@ -36,7 +36,7 @@
|
|||
<vn-autocomplete
|
||||
vn-one
|
||||
ng-model="$ctrl.route.agencyModeFk"
|
||||
url="/api/AgencyModes"
|
||||
url="api/AgencyModes"
|
||||
show-field="name"
|
||||
value-field="id"
|
||||
label="Agency">
|
||||
|
@ -73,7 +73,7 @@
|
|||
ng-model="$ctrl.route.description"
|
||||
rule
|
||||
vn-focus>
|
||||
</vn-textfield>
|
||||
</vn-textArea>
|
||||
</vn-horizontal>
|
||||
</vn-card>
|
||||
<vn-button-bar>
|
||||
|
|
|
@ -1,17 +1,18 @@
|
|||
import ngModule from '../module';
|
||||
|
||||
class Controller {
|
||||
constructor($scope, $state) {
|
||||
this.$scope = $scope;
|
||||
this.$state = $state;
|
||||
constructor($scope) {
|
||||
this.$ = $scope;
|
||||
}
|
||||
|
||||
onSubmit() {
|
||||
this.$scope.watcher.submit().then(() => {
|
||||
this.$.watcher.submit().then(() => {
|
||||
this.card.reload();
|
||||
});
|
||||
}
|
||||
}
|
||||
Controller.$inject = ['$scope'];
|
||||
|
||||
ngModule.component('vnRouteBasicData', {
|
||||
template: require('./index.html'),
|
||||
controller: Controller,
|
||||
|
|
|
@ -41,10 +41,10 @@
|
|||
<vn-td number>{{::travel.id}}</vn-td>
|
||||
<vn-td expand>{{::travel.ref}}</vn-td>
|
||||
<vn-td expand>{{::travel.agency.name}}</vn-td>
|
||||
<vn-td center>{{::travel.warehouseOut.name}}</vn-td>
|
||||
<vn-td expand>{{::travel.warehouseOut.name}}</vn-td>
|
||||
<vn-td center>{{::travel.shipped | date:'dd/MM/yyyy'}}</vn-td>
|
||||
<vn-td><vn-check ng-model="travel.isDelivered" disabled="true"></vn-check></vn-td>
|
||||
<vn-td>{{::travel.warehouseIn.name}}</vn-td>
|
||||
<vn-td expand>{{::travel.warehouseIn.name}}</vn-td>
|
||||
<vn-td center>{{::travel.landed | date:'dd/MM/yyyy'}}</vn-td>
|
||||
<vn-td center><vn-check ng-model="travel.isReceived" disabled="true"></vn-check></vn-td>
|
||||
<vn-td>
|
||||
|
|
|
@ -40,7 +40,7 @@ export default class Controller {
|
|||
case 'landed':
|
||||
return {landed: {gte: value}};
|
||||
case 'id':
|
||||
case 'agencyFk':
|
||||
case 'agencyModeFk':
|
||||
case 'warehouseOutFk':
|
||||
case 'warehouseInFk':
|
||||
case 'totalEntries':
|
||||
|
|
|
@ -0,0 +1,33 @@
|
|||
import './index.js';
|
||||
|
||||
describe('Travel Component vnTravelIndex', () => {
|
||||
let $componentController;
|
||||
let controller;
|
||||
|
||||
beforeEach(angular.mock.module('travel', $translateProvider => {
|
||||
$translateProvider.translations('en', {});
|
||||
}));
|
||||
|
||||
beforeEach(angular.mock.inject(_$componentController_ => {
|
||||
$componentController = _$componentController_;
|
||||
controller = $componentController('vnTravelIndex');
|
||||
}));
|
||||
|
||||
describe('exprBuilder()', () => {
|
||||
it('should return a formated object with the travel id in case of search', () => {
|
||||
let param = 'search';
|
||||
let value = 2;
|
||||
let result = controller.exprBuilder(param, value);
|
||||
|
||||
expect(result).toEqual({id: 2});
|
||||
});
|
||||
|
||||
it('should return a formated object with the warehouseInFk in case of warehouseInFk', () => {
|
||||
let param = 'warehouseInFk';
|
||||
let value = 3;
|
||||
let result = controller.exprBuilder(param, value);
|
||||
|
||||
expect(result).toEqual({warehouseInFk: 3});
|
||||
});
|
||||
});
|
||||
});
|
Loading…
Reference in New Issue