diff options
| author | Murilo Ijanc <[email protected]> | 2026-07-26 15:01:02 -0300 |
|---|---|---|
| committer | Murilo Ijanc <[email protected]> | 2026-07-26 15:01:02 -0300 |
| commit | 36486007ccada8c31d30e8f528d21233cabce32c (patch) | |
| tree | d14a108845e4c984ec922ba98d153c8d68da6ebb /test/fixture.html | |
| download | autofill-ceafecfbd5171c08d15dc0ca123d6d9a2582000d.tar.gz | |
Initial importv0.1.0
Diffstat (limited to 'test/fixture.html')
| -rw-r--r-- | test/fixture.html | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/test/fixture.html b/test/fixture.html new file mode 100644 index 0000000..6d6535d --- /dev/null +++ b/test/fixture.html @@ -0,0 +1,62 @@ +<!doctype html> +<html lang="pt-BR"> + <head> + <meta charset="utf-8" /> + <title>checkout fixture</title> + </head> + <body> + <form id="checkout"> + <label for="cep">CEP</label> + <input id="cep" name="cep" autocomplete="postal-code" /> + + <label for="rua">Endereço</label> + <input id="rua" name="rua" /> + + <label for="numero">Número</label> + <input id="numero" name="numero" /> + + <label for="bairro">Bairro</label> + <input id="bairro" name="bairro" /> + + <label for="cidade">Cidade</label> + <input id="cidade" name="cidade" /> + + <label for="uf">Estado</label> + <select id="uf" name="uf"> + <option value="">Selecione</option> + <option value="RJ">Rio de Janeiro</option> + <option value="SP">São Paulo</option> + </select> + </form> + + <script src="/cepis-autofill.js"></script> + <script> + window.__events = []; + window.__attach = function (options) { + window.__handle = window.CepisAutofill.attach( + Object.assign( + { + cep: "#cep", + logradouro: "#rua", + bairro: "#bairro", + localidade: "#cidade", + uf: "#uf", + numero: "#numero", + debounceMs: 50, + onResult: function (address) { + window.__events.push("result:" + address.cep); + }, + onError: function (error) { + window.__events.push("error:" + error.code); + }, + onStatus: function (state) { + window.__events.push("status:" + state); + }, + }, + options, + ), + ); + }; + </script> + </body> +</html> |