Merge fixes
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Juan Ferrer 2020-05-19 10:51:50 +02:00
parent d7f2e686b1
commit e7cf060e12
9 changed files with 58 additions and 58 deletions

View File

@ -479,7 +479,7 @@ export default {
secondSaleIdInput: 'vn-ticket-sale vn-table vn-tbody > vn-tr:nth-child(2) > vn-td:nth-child(4) > vn-autocomplete',
secondSaleIdAutocomplete: 'vn-ticket-sale vn-table vn-tbody > vn-tr:nth-child(2) > vn-td:nth-child(4) > vn-autocomplete',
secondSaleQuantity: 'vn-ticket-sale vn-table vn-tr:nth-child(2) vn-input-number',
secondSaleConceptCell: 'vn-ticket-sale > vn-vertical > vn-card > vn-vertical > vn-table > div > vn-tbody > vn-tr:nth-child(2) > vn-td-editable:nth-child(6)',
secondSaleConceptCell: 'vn-ticket-sale vn-tbody > :nth-child(2) > :nth-child(6)',
secondSaleConceptInput: 'vn-ticket-sale vn-table vn-tr:nth-child(2) > vn-td-editable.ng-isolate-scope.selected vn-textfield',
totalImport: 'vn-ticket-sale > vn-vertical > vn-card > vn-vertical > vn-horizontal > vn-one > p:nth-child(3) > strong',
selectAllSalesCheckbox: 'vn-ticket-sale vn-thead vn-check',

View File

@ -1,7 +1,7 @@
import selectors from '../../helpers/selectors.js';
import getBrowser from '../../helpers/puppeteer';
describe('Order lines', () => {
fdescribe('Order lines', () => {
let browser;
let page;
beforeAll(async() => {

View File

@ -14,7 +14,6 @@ function vnAcl(aclService) {
let action = $attrs.vnAclAction || 'disable';
if (aclService.hasAny(acls)) return;
console.log('acls', acls, action);
if (action === 'disable') {
let element = $element[0];

View File

@ -0,0 +1,21 @@
describe('Id filter', () => {
let idFilter;
beforeEach(ngModule('vnCore'));
beforeEach(inject(_idFilter_ => {
idFilter = _idFilter_;
}));
it('should return empty string for input null', () => {
expect(idFilter(null)).toBe('');
});
it('should return empty stringfor input empty', () => {
expect(idFilter('')).toBe('');
});
it('should prefix a pad character', () => {
expect(idFilter('123')).toBe('#123');
});
});

View File

@ -167,5 +167,5 @@
vn-id="update-greuge"
question="Insert greuges on client card"
message="Do you want to insert greuges?"
on-response="$ctrl.onUpdateGreugeResponse($response)">
on-accept="$ctrl.onUpdateGreugeAccept()">
</vn-confirm>

View File

@ -76,8 +76,7 @@ export default class Controller extends Section {
};
this.$.lastTicketsModel.filter = filter;
this.$.lastTicketsModel.refresh();
this.$.lastTicketsPopover.parent = event.target;
this.$.lastTicketsPopover.show();
this.$.lastTicketsPopover.show(event);
}
importTicketLines(ticketFk) {
@ -122,8 +121,7 @@ export default class Controller extends Section {
});
}
onUpdateGreugeResponse(response) {
if (response == 'accept') {
onUpdateGreugeAccept() {
const promises = [];
promises.push(this.getGreugeTypeId());
promises.push(this.getGreugeConfig());
@ -138,13 +136,11 @@ export default class Controller extends Section {
greugeTypeFk: this.greugeTypeFreightId,
ticketFk: this.claim.ticketFk
};
return this.$http.post(`Greuges/`, data).then(() => {
return this.$http.post(`Greuges`, data).then(() => {
this.vnApp.showSuccess(this.$t('Data saved!'));
this.vnApp.showMessage(this.$t('Greuge inserted'));
});
});
} else
this.vnApp.showSuccess(this.$t('Data saved!'));
}
save(data) {

View File

@ -6,20 +6,15 @@ describe('claim', () => {
let controller;
let $httpBackend;
let $state;
let $httpParamSerializer;
let $scope;
beforeEach(ngModule('claim'));
beforeEach(angular.mock.inject(($rootScope, $componentController, _$state_, _$httpBackend_, _$httpParamSerializer_) => {
$scope = $rootScope.$new();
beforeEach(angular.mock.inject(($componentController, _$state_, _$httpBackend_) => {
$httpBackend = _$httpBackend_;
$httpParamSerializer = _$httpParamSerializer_;
$state = _$state_;
$state.params.id = 1;
const $element = angular.element('<vn-claim-action></vn-claim-action>');
controller = $componentController('vnClaimAction', {$element, $scope});
controller = $componentController('vnClaimAction', {$element: null});
controller.claim = {ticketFk: 1};
controller.$.model = {refresh: () => {}};
controller.$.addSales = {
@ -67,8 +62,8 @@ describe('claim', () => {
controller.importToNewRefundTicket();
$httpBackend.flush();
expect(controller.$.model.refresh).toHaveBeenCalledWith();
expect(controller.vnApp.showSuccess).toHaveBeenCalledWith('Data saved!');
expect(controller.$.model.refresh).toHaveBeenCalled();
expect(controller.vnApp.showSuccess).toHaveBeenCalled();
});
});
@ -79,8 +74,8 @@ describe('claim', () => {
controller.showLastTickets({});
expect(controller.$.lastTicketsModel.refresh).toHaveBeenCalledWith();
expect(controller.$.lastTicketsPopover.show).toHaveBeenCalledWith();
expect(controller.$.lastTicketsModel.refresh).toHaveBeenCalled();
expect(controller.$.lastTicketsPopover.show).toHaveBeenCalled();
});
});
@ -124,33 +119,21 @@ describe('claim', () => {
controller.save(data);
$httpBackend.flush();
expect(controller.vnApp.showSuccess).toHaveBeenCalledWith('Data saved!');
expect(controller.vnApp.showSuccess).toHaveBeenCalled();
});
});
describe('onUpdateGreugeResponse()', () => {
describe('onUpdateGreugeAccept()', () => {
const greugeTypeId = 7;
const freightPickUpPrice = 11;
it('should do nothing', () => {
jest.spyOn(controller.$http, 'post');
jest.spyOn(controller.card, 'reload');
jest.spyOn(controller.vnApp, 'showSuccess');
controller.onUpdateGreugeResponse('cancel');
expect(controller.$http.post).not.toHaveBeenCalledWith();
expect(controller.card.reload).not.toHaveBeenCalledWith();
expect(controller.vnApp.showSuccess).not.toHaveBeenCalledWith('Greuge inserted!');
});
it('should make a query and get the greugeTypeId and greuge config', () => {
jest.spyOn(controller.card, 'reload');
jest.spyOn(controller.vnApp, 'showSuccess');
const greugeTypeParams = $httpParamSerializer({filter: {where: {code: 'freightPickUp'}}});
$httpBackend.expect('GET', `GreugeTypes/findOne?${greugeTypeParams}`).respond({id: greugeTypeId});
$httpBackend.expect('GET', `GreugeConfigs/findOne`).respond({freightPickUpPrice});
controller.onUpdateGreugeResponse('accept');
$httpBackend.expectRoute('GET', `GreugeTypes/findOne`).respond({id: greugeTypeId});
$httpBackend.expectGET(`GreugeConfigs/findOne`).respond({freightPickUpPrice});
controller.onUpdateGreugeAccept();
$httpBackend.flush();
expect(controller.greugeTypeFreightId).toEqual(greugeTypeId);
@ -181,7 +164,7 @@ describe('claim', () => {
$httpBackend.expect('POST', `Greuges/`, data).respond(new Promise(resolve => {
return resolve({id: freightPickUpPrice});
}));
controller.onUpdateGreugeResponse('accept').then(res => {
controller.onUpdateGreugeAccept().then(res => {
}).catch(error => {

View File

@ -39,7 +39,8 @@
ng-class="{alert: $ctrl.client.debt > $ctrl.client.credit}"
info="Invoices minus payments plus orders not yet invoiced">
</vn-label-value>
<vn-label-value label="Sales person"
<vn-label-value
label="Sales person"
value="{{$ctrl.client.salesPerson.user.nickname}}">
</vn-label-value>
</div>

2
package-lock.json generated
View File

@ -17888,7 +17888,7 @@
},
"xmlbuilder": {
"version": "9.0.7",
"resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-9.0.7.tgz",
"resolved": "http://registry.npmjs.org/xmlbuilder/-/xmlbuilder-9.0.7.tgz",
"integrity": "sha1-Ey7mPS7FVlxVfiD0wi35rKaGsQ0="
},
"xmlcreate": {