Skip to content

Commit

Permalink
fix(page-dynamic): corrige container sem titulo
Browse files Browse the repository at this point in the history
Corrige container sem titulo quando algum valor é `null` e utiliza serviço

fixes DTHFUI-8884
  • Loading branch information
jcorrea97 authored and anderson-gregorio-totvs committed May 27, 2024
1 parent 4c000fb commit 5b5c39e
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -581,6 +581,28 @@ describe('PoDynamicViewBaseComponent:', () => {

expect(component.ensureFieldHasContainer).toHaveBeenCalled();
});

it('should call createFieldWithService if the field has a container, even if the property value is null', () => {
component.fields = [
{
searchService: 'https://api/test',
container: 'Dados Empresa',
property: 'empresa',
type: 'string',
label: 'Empresa'
}
];

component.value = {
empresa: null
};

spyOn(component, <any>'createFieldWithService');

component['getConfiguredFields']();

expect(component['createFieldWithService']).toHaveBeenCalled();
});
});

it('searchById: should return null if value is empty', done => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,8 @@ export class PoDynamicViewBaseComponent extends PoDynamicSharedBase {

const hasValue =
this.value[field.property]?.length ||
(!Array.isArray(this.value[field.property]) && this.value[field.property] && useSearchService);
(!Array.isArray(this.value[field.property]) && this.value[field.property] && useSearchService) ||
field.container;

if (hasValue) {
const _field = this.returnValues({ ...field }, '');
Expand Down

0 comments on commit 5b5c39e

Please sign in to comment.