Skip to content

Commit

Permalink
fix(lookup): ajustando property para letra maiuscula
Browse files Browse the repository at this point in the history
  • Loading branch information
CSimoesJr committed Aug 29, 2023
1 parent 73ebeeb commit e747c28
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -518,11 +518,11 @@ describe('PoLookupModalBaseComponent:', () => {
const expectedValueDisclaimer = {
property: 'propertyTest',
value: 'valueTest',
label: 'propertyTest: valueTest'
label: 'PropertyTest: valueTest'
};
const expectedValueDisclaimerGroup = {
title: 'titleTest',
disclaimers: [{ property: 'propertyTest', value: 'valueTest', label: 'propertyTest: valueTest' }]
disclaimers: [{ property: 'propertyTest', value: 'valueTest', label: 'PropertyTest: valueTest' }]
};

component.addDisclaimer('valueTest', 'propertyTest');
Expand All @@ -534,10 +534,10 @@ describe('PoLookupModalBaseComponent:', () => {
it("addDisclaimer: should return formated currency in locale default if field type is 'currency'", () => {
component['language'] = 'pt';
component.advancedFilters = [{ property: 'value', type: 'currency' }];
const expectedValueDisclaimer = { property: 'value', value: 321, label: 'value: 321,00' };
const expectedValueDisclaimer = { property: 'value', value: 321, label: 'Value: 321,00' };
const expectedValueDisclaimerGroup = {
title: 'titleTest',
disclaimers: [{ property: 'value', value: 321, label: 'value: 321,00' }]
disclaimers: [{ property: 'value', value: 321, label: 'Value: 321,00' }]
};

component.addDisclaimer(321, 'value');
Expand All @@ -548,10 +548,10 @@ describe('PoLookupModalBaseComponent:', () => {

it("addDisclaimer: should return formated currency in locale 'En' if field type is 'currency' and locale is 'en'", () => {
component.advancedFilters = [{ property: 'value', type: 'currency', locale: 'en' }];
const expectedValueDisclaimer = { property: 'value', value: 321, label: 'value: 321.00' };
const expectedValueDisclaimer = { property: 'value', value: 321, label: 'Value: 321.00' };
const expectedValueDisclaimerGroup = {
title: 'titleTest',
disclaimers: [{ property: 'value', value: 321, label: 'value: 321.00' }]
disclaimers: [{ property: 'value', value: 321, label: 'Value: 321.00' }]
};

component.addDisclaimer(321, 'value');
Expand All @@ -570,10 +570,10 @@ describe('PoLookupModalBaseComponent:', () => {
]
}
];
const expectedValueDisclaimer = { property: 'company', value: 1, label: 'company: Totvs' };
const expectedValueDisclaimer = { property: 'company', value: 1, label: 'Company: Totvs' };
const expectedValueDisclaimerGroup = {
title: 'titleTest',
disclaimers: [{ property: 'company', value: 1, label: 'company: Totvs' }]
disclaimers: [{ property: 'company', value: 1, label: 'Company: Totvs' }]
};

component.addDisclaimer(1, 'company');
Expand All @@ -589,10 +589,10 @@ describe('PoLookupModalBaseComponent:', () => {
options: [{ value: 1 }, { value: 2 }]
}
];
const expectedValueDisclaimer = { property: 'company', value: 1, label: 'company: 1' };
const expectedValueDisclaimer = { property: 'company', value: 1, label: 'Company: 1' };
const expectedValueDisclaimerGroup = {
title: 'titleTest',
disclaimers: [{ property: 'company', value: 1, label: 'company: 1' }]
disclaimers: [{ property: 'company', value: 1, label: 'Company: 1' }]
};

component.addDisclaimer(1, 'company');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { catchError } from 'rxjs/operators';

import { InputBoolean } from '../../../../decorators';

import { isTypeof } from '../../../../utils/util';
import { capitalizeFirstLetter, isTypeof } from '../../../../utils/util';
import { poLocaleDefault } from '../../../../services/po-language/po-language.constant';
import { PoModalAction } from '../../../../components/po-modal';
import { PoModalComponent } from '../../../../components/po-modal/po-modal.component';
Expand Down Expand Up @@ -301,7 +301,7 @@ export abstract class PoLookupModalBaseComponent implements OnDestroy, OnInit {
const fieldFilter = this.advancedFilters.find(filter => filter.property === property);
this.disclaimer = <any>{ property: property };
this.disclaimer.value = value;
const labelProperty = fieldFilter.label ? fieldFilter.label : fieldFilter.property;
const labelProperty = fieldFilter.label || capitalizeFirstLetter(fieldFilter.property);

if (fieldFilter.type === 'currency' && value) {
this.formatValueToCurrency(fieldFilter, value);
Expand Down

0 comments on commit e747c28

Please sign in to comment.