Merge branch 'dev' into 3061-send_thermograph
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
This commit is contained in:
commit
2ce79a8d49
|
@ -63,7 +63,7 @@
|
|||
show-field="bank"
|
||||
order="id"
|
||||
value-field="id"
|
||||
search-function="{or: [{id: $search}, {bank: {like: '%'+ $search +'%'}}]}">
|
||||
search-function="$ctrl.bankSearchFunc($search)">
|
||||
<tpl-item>{{id}}: {{bank}}</tpl-item>
|
||||
</vn-autocomplete>
|
||||
<vn-autocomplete
|
||||
|
|
|
@ -78,6 +78,12 @@ class Controller {
|
|||
this.$.companies.refresh();
|
||||
this.$.popover.show(event.target);
|
||||
}
|
||||
|
||||
bankSearchFunc($search) {
|
||||
return /^\d+$/.test($search)
|
||||
? {id: $search}
|
||||
: {bank: {like: '%' + $search + '%'}};
|
||||
}
|
||||
}
|
||||
Controller.$inject = ['$scope', '$translate', 'vnConfig', 'vnAuth', 'vnToken'];
|
||||
|
||||
|
|
|
@ -61,12 +61,28 @@ describe('Salix', () => {
|
|||
});
|
||||
|
||||
describe('getImageUrl()', () => {
|
||||
it('should return de url image', () => {
|
||||
it('should return the url image', () => {
|
||||
const url = $root.imagePath('user', '160x160', userId);
|
||||
|
||||
expect(url).toBeDefined();
|
||||
expect(url).toEqual(`/api/Images/user/160x160/${userId}/download?access_token=null`);
|
||||
});
|
||||
});
|
||||
|
||||
describe('bankSearchFunc()', () => {
|
||||
it('should return the filter by id property for an input of a number', () => {
|
||||
const bankId = 1;
|
||||
const result = controller.bankSearchFunc(bankId);
|
||||
|
||||
expect(result).toEqual({id: bankId});
|
||||
});
|
||||
|
||||
it('should return the filter by bank property for an input of an string', () => {
|
||||
const bankName = 'Bank of America';
|
||||
const result = controller.bankSearchFunc(bankName);
|
||||
|
||||
expect(result).toEqual({bank: {like: '%' + bankName + '%'}});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
fields="['accountingTypeFk']"
|
||||
include="{relation: 'accountingType'}"
|
||||
ng-model="$ctrl.bankFk"
|
||||
search-function="{or: [{id: $search}, {bank: {like: '%'+ $search +'%'}}]}"
|
||||
search-function="$ctrl.bankSearchFunc($search)"
|
||||
selection="$ctrl.bankSelection"
|
||||
order="id"
|
||||
required="true">
|
||||
|
|
|
@ -137,6 +137,12 @@ class Controller extends Dialog {
|
|||
}
|
||||
});
|
||||
}
|
||||
|
||||
bankSearchFunc($search) {
|
||||
return /^\d+$/.test($search)
|
||||
? {id: $search}
|
||||
: {bank: {like: '%' + $search + '%'}};
|
||||
}
|
||||
}
|
||||
|
||||
Controller.$inject = ['$element', '$scope', '$transclude', 'vnReport'];
|
||||
|
|
|
@ -118,5 +118,21 @@ describe('Client', () => {
|
|||
expect(controller.receipt.compensationAccount).toEqual('4000000003');
|
||||
});
|
||||
});
|
||||
|
||||
describe('bankSearchFunc()', () => {
|
||||
it('should return the filter by id property for an input of a number', () => {
|
||||
const bankId = 1;
|
||||
const result = controller.bankSearchFunc(bankId);
|
||||
|
||||
expect(result).toEqual({id: bankId});
|
||||
});
|
||||
|
||||
it('should return the filter by bank property for an input of an string', () => {
|
||||
const bankName = 'Bank of America';
|
||||
const result = controller.bankSearchFunc(bankName);
|
||||
|
||||
expect(result).toEqual({bank: {like: '%' + bankName + '%'}});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -679,5 +679,21 @@ describe('Ticket', () => {
|
|||
expect(controller.$.model.refresh).toHaveBeenCalledWith();
|
||||
});
|
||||
});
|
||||
|
||||
describe('itemSearchFunc()', () => {
|
||||
it('should return the filter by id property for an input of a number', () => {
|
||||
const itemId = 1;
|
||||
const result = controller.itemSearchFunc(itemId);
|
||||
|
||||
expect(result).toEqual({id: itemId});
|
||||
});
|
||||
|
||||
it('should return the filter by bank property for an input of an string', () => {
|
||||
const itemName = 'Bow';
|
||||
const result = controller.itemSearchFunc(itemName);
|
||||
|
||||
expect(result).toEqual({name: {like: '%' + itemName + '%'}});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue