Merge pull request 'Entrega do Desafio' (#22) from develop into master

Reviewed-on: #22
This commit is contained in:
Ana Carolina Duarte Cavalcante 2023-02-10 22:04:47 +00:00
commit f7b79ac54c
2 changed files with 23 additions and 11 deletions

View File

@ -1,16 +1,29 @@
const Placeholder = () => { const Placeholder = () => {
if (typeof document !== "undefined") { if (typeof document !== "undefined") {
const observer = new MutationObserver(mutations => {
mutations.forEach(_mutation => {
const postalCodeInput = document.querySelector( const postalCodeInput = document.querySelector(
".vtex-address-form-4-x-input" ".vtex-address-form-4-x-input"
); );
const postalCodeValue = document.querySelector(".postalCode"); const postalCodeValue = document.querySelector(".postalCode");
if (postalCodeInput) { if (postalCodeInput) {
postalCodeInput.classList.add("postalCode"); postalCodeInput.classList.add("postalCode");
observer.disconnect();
} }
if (postalCodeValue) { if (postalCodeValue) {
postalCodeValue.setAttribute("placeholder", "Digite seu CEP"); postalCodeValue.setAttribute("placeholder", "Digite seu CEP");
} }
});
});
observer.observe(document, {
childList: true,
subtree: true
});
} }
return null; return null;
}; };

View File

@ -1,7 +1,6 @@
{ {
"html#breadcrumb": { "html#breadcrumb": {
"props": { "props": {
"tag": "section",
"testId": "breadcrumbs", "testId": "breadcrumbs",
"blockClass": "pdp-breadcrumb" "blockClass": "pdp-breadcrumb"
}, },