Skip to content

Commit

Permalink
refactor(po-password): altera valor padrão do p-no-autocomplete
Browse files Browse the repository at this point in the history
fixes DTHFUI-9841

BREAKING CHANGE: Altera valor padrão da propriedade `p-no-autocomplete` de `false` para `true`
  • Loading branch information
jcorrea97 authored and anderson-gregorio-totvs committed Oct 4, 2024
1 parent 07e189f commit 11d8c5f
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,16 @@ describe('PoNumberComponent:', () => {
expect(component.type === 'password').toBeTruthy();
});

it('should set autoComplete with value `new-password` if noAutocomplete is true', () => {
component.noAutocomplete = true;
expect(component.autocomplete).toBe('new-password');
});

it('should set autoComplete with value `on` if noAutocomplete is false', () => {
component.noAutocomplete = false;
expect(component.autocomplete).toBe('on');
});

describe('Properties:', () => {
it('p-hide-password-peek: should update property with valid values.', () => {
const validValues = [false, true, '', 'false', 'true'];
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { AbstractControl, NG_VALIDATORS, NG_VALUE_ACCESSOR } from '@angular/forms';
import { ChangeDetectionStrategy, ChangeDetectorRef, Component, ElementRef, forwardRef, Input } from '@angular/core';
import { AbstractControl, NG_VALIDATORS, NG_VALUE_ACCESSOR } from '@angular/forms';

import { convertToBoolean, uuid } from '../../../utils/util';
import { PoInputGeneric } from '../po-input-generic/po-input-generic';
Expand Down Expand Up @@ -50,6 +50,7 @@ export class PoPasswordComponent extends PoInputGeneric {
visiblePassword = false;

private _hidePasswordPeek?: boolean = false;
private _noAutocompletePassword?: boolean = true;

/**
* @optional
Expand All @@ -68,6 +69,14 @@ export class PoPasswordComponent extends PoInputGeneric {
}
}

@Input('p-no-autocomplete') override set noAutocomplete(value: boolean) {
this._noAutocompletePassword = convertToBoolean(value);
}

override get noAutocomplete() {
return this._noAutocompletePassword;
}

get hidePasswordPeek(): boolean {
return this._hidePasswordPeek;
}
Expand Down

0 comments on commit 11d8c5f

Please sign in to comment.