From 563b99ddaa34a4a7f671754d58063869e7a74419 Mon Sep 17 00:00:00 2001 From: Ans Date: Thu, 9 May 2024 10:59:39 -0400 Subject: [PATCH 1/7] Add o-search-input component --- .../ask_cfpb/jinja2/ask-cfpb/_ask-search.html | 77 +++---- .../ask_cfpb/locale/es/LC_MESSAGES/django.po | 20 +- cfgov/cfgov/locale/es/LC_MESSAGES/django.po | 20 +- .../jinja2/prepaid_agreements/index.html | 27 +-- .../regulations3k-search-bar.html | 42 ++-- .../regulations3k/search-regulations.html | 11 +- .../activity_index_page.html | 37 ++-- .../apps/ask-cfpb/css/ask-search.less | 17 -- cfgov/unprocessed/apps/ask-cfpb/css/main.less | 29 --- .../apps/ask-cfpb/js/ask-autocomplete.js | 16 +- .../css/pages/activity-search.less | 9 - .../js/ClearableInput.js | 87 -------- .../teachers-digital-platform/js/search.js | 8 - cfgov/unprocessed/css/enhancements/forms.less | 60 ------ cfgov/unprocessed/css/main.less | 1 + .../css/molecules/global-search.less | 38 ---- .../css/organisms/search-input.less | 118 +++++++++++ .../unprocessed/js/molecules/GlobalSearch.js | 13 +- .../v1/includes/molecules/global-search.html | 31 +-- .../v1/includes/organisms/search-input.html | 68 ++++++ cfgov/v1/locale/es/LC_MESSAGES/django.mo | Bin 3309 -> 3379 bytes cfgov/v1/locale/es/LC_MESSAGES/django.po | 20 +- .../wellbeing/locale/es/LC_MESSAGES/django.po | 194 +++++++++--------- .../consumer-tools/ask-cfpb/ask-cfpb.cy.js | 8 + .../ask-cfpb/search-helpers.cy.js | 16 +- .../tdp-activity-search-helpers.cy.js | 2 +- .../regulations-search-helpers.cy.js | 28 ++- .../rules-policy/regulations-search.cy.js | 8 + .../apps/regulations3k/js/search-spec.js | 21 +- .../js/ClearableInput-spec.js | 82 -------- .../js/search-spec.js | 23 ++- .../js/tdp-analytics-spec.js | 1 - 32 files changed, 515 insertions(+), 617 deletions(-) delete mode 100644 cfgov/unprocessed/apps/ask-cfpb/css/ask-search.less delete mode 100644 cfgov/unprocessed/apps/teachers-digital-platform/js/ClearableInput.js create mode 100644 cfgov/unprocessed/css/organisms/search-input.less create mode 100644 cfgov/v1/jinja2/v1/includes/organisms/search-input.html delete mode 100644 test/unit_tests/apps/teachers-digital-platform/js/ClearableInput-spec.js diff --git a/cfgov/ask_cfpb/jinja2/ask-cfpb/_ask-search.html b/cfgov/ask_cfpb/jinja2/ask-cfpb/_ask-search.html index d5cea8cf5cf..adcf76a5e7f 100644 --- a/cfgov/ask_cfpb/jinja2/ask-cfpb/_ask-search.html +++ b/cfgov/ask_cfpb/jinja2/ask-cfpb/_ask-search.html @@ -41,59 +41,42 @@ complaint_link=False ) %} diff --git a/cfgov/regulations3k/jinja2/regulations3k/regulations3k-search-bar.html b/cfgov/regulations3k/jinja2/regulations3k/regulations3k-search-bar.html index a5c2309e2dc..a81a7ecfc5d 100644 --- a/cfgov/regulations3k/jinja2/regulations3k/regulations3k-search-bar.html +++ b/cfgov/regulations3k/jinja2/regulations3k/regulations3k-search-bar.html @@ -1,32 +1,30 @@ {% macro render(hidden_fields, q='') %} -
+

Search term

-
- {% if hidden_fields | length > 0 %} -
- {% for field in hidden_fields %} - {% for value in field.value.split(',') %} - - {% endfor %} + {% if hidden_fields | length > 0 %} +
+ {% for field in hidden_fields %} + {% for value in field.value.split(',') %} + {% endfor %} -
- {% endif %} -
-
- - -
+ {% endfor %}
-
- -
-
+ {% endif %} + + {% import 'v1/includes/organisms/search-input.html' as search_input with context %} + {{ search_input.render({ + "input_id": "query", + "input_name": "q", + "input_value": q, + "input_aria_label": "Search for a term", + "placeholder": "Enter your search term", + "submit_aria_label": "Search for a term in the regulations" + }) }} {% endmacro %} diff --git a/cfgov/regulations3k/jinja2/regulations3k/search-regulations.html b/cfgov/regulations3k/jinja2/regulations3k/search-regulations.html index f4d53705a80..c337ebb00d1 100644 --- a/cfgov/regulations3k/jinja2/regulations3k/search-regulations.html +++ b/cfgov/regulations3k/jinja2/regulations3k/search-regulations.html @@ -56,7 +56,7 @@

Search for terms in the sections, interpretations, and appendices in the Bureau regulations we currently have online.

-
+
{{ search_bar.render( [{ 'name': 'regs', 'value': page.results.regs | join(',') }], page.results.search_query @@ -66,9 +66,14 @@

{% if page.results.search_query %}
-
diff --git a/cfgov/v1/jinja2/v1/includes/organisms/search-input.html b/cfgov/v1/jinja2/v1/includes/organisms/search-input.html new file mode 100644 index 00000000000..3e241288add --- /dev/null +++ b/cfgov/v1/jinja2/v1/includes/organisms/search-input.html @@ -0,0 +1,68 @@ +{# ========================================================================== + + Search Input with Button + + ========================================================================== + + Description: + + Create a Search Input with Button organism. + + value.input_id: ID for the input and its label. + + value.input_name: Name for the input. + + value.input_value: Value for the input content. + + value.input_aria_label: Hidden text for the input search label. + + value.input_input_aria_describedby_id: ID for an error box that describes this element. + + value.has_autocomplete: Whether it has an autocomplete or not. + + value.placeholder: Placeholder text for the input. + + value.submit_aria_label: Label for the search button. + + ========================================================================== #} + +{% macro render(value) %} + +
+
+ + + +
+ + +
+ +{% endmacro %} diff --git a/cfgov/v1/locale/es/LC_MESSAGES/django.mo b/cfgov/v1/locale/es/LC_MESSAGES/django.mo index 4232c751f3d4fa87939e7b39ab72ca3c248388a4..ac7b83b2e338105107d281ac586905e59de9ecdb 100644 GIT binary patch delta 1100 zcmYk*!An#@9Ki9h-D=g%)=hJFP1CY1bIU|JcF2gJ5)U2{g2Hkk3Y1p7bXf{Y=unV$ zOUN!oc-t;Thr&8^=@LkgME`)tqEqz!ZX-18%;(L#H}ih;o3|VJTA}(qn|vH7gVa6L z#fA`0VLCxW$t6R`Vjc@v!e%@Z9mih!mobgEaVtKE_ZP8`{!`q6A8`wQL4MV+Mmx&D zH#~s-%x=dqWGIxe1Fy&a9c-dMAAN*Azl0~ThAI4sJMj-1aLcw3_=N(E_(2pd^c!8MmB!~g(IY#C85~949WJ3qQO4s~iT7Wiseg?u9o}Mf zjEfIk_+T5`Gy`Xmp)iHMcp9BBj|TWK-hYM$vV!CI9?e)g+jG1dTX7f->@>FEc|434 zo5{Z))jbCMh?dcbtJsBK(LjEo0k|#uDKyY5y7Lka;Rz&$FoQ+Bg$A^Y`|%}uw4bpL z*VE+R6gM#Hf_WtK^)DFeWnZ*2N-XuD?K;OmkJzF3VVPoIVjz2|2550(15`6$7Q3lA z&)+lLEQ4I^iXBsAR{ZETi&48HHt_G?f^Og-)yy2CT1>aata$`Ssb=8+(nH7K!)_Z& yiRxd;;@`ixu#uQwR^QCtoGVXF);b#35`O^$e^R*s delta 1042 zcmZA0O-NKx6u|LQzAV$eCN-VXF~1rci-N3GpzT^nk+=xUpbrxwf(dF7IolR3q_1Vr zrWS32*%d+5Du`N0P!#QQm0%#WNUHyTxC`kr=l$m1_ujqdp7&lgztCR!mdox3Z7;Ed zxViE4uJJ`lx;*b4D8{o3MaGIEb6^EL!rb$dqvnkKqh@ z-FvLK^NelsKRVF`i|7p_Xktgx`BP{DQ#gh\n" "Language-Team: LANGUAGE \n" @@ -89,8 +89,7 @@ msgstr "Enviar una queja" #: v1/jinja2/v1/includes/molecules/global-search.html:28 #: v1/jinja2/v1/includes/molecules/global-search.html:36 -#: v1/jinja2/v1/includes/molecules/global-search.html:69 -#: v1/jinja2/v1/includes/molecules/global-search.html:81 +#: v1/jinja2/v1/includes/organisms/search-input.html:64 msgid "Search" msgstr "Buscar" @@ -103,8 +102,7 @@ msgstr "Busque en el sitio web consumerfinance.gov" msgid "Close" msgstr "Cerrar" -#: v1/jinja2/v1/includes/molecules/global-search.html:74 -#: v1/jinja2/v1/includes/molecules/global-search.html:77 +#: v1/jinja2/v1/includes/molecules/global-search.html:63 msgid "Search the CFPB" msgstr "Buscar la CFPB" @@ -184,6 +182,11 @@ msgstr "https://www.usa.gov/es/" msgid "USA.gov" msgstr "USA.gov/es" +#: v1/jinja2/v1/includes/organisms/search-input.html:55 +#: v1/jinja2/v1/includes/organisms/search-input.html:56 +msgid "Clear search" +msgstr "Borrar búsqueda" + #: v1/jinja2/v1/includes/organisms/secondary-nav-fig.html:33 #: v1/jinja2/v1/includes/organisms/secondary-nav-fig.html:36 #, fuzzy @@ -217,7 +220,9 @@ msgstr "Este sitio no es compatible con su navegador web." #: v1/jinja2/v1/includes/snippets/no_js_notification.html:8 msgid "Please try a newer browser or confirm that JavaScript is enabled." -msgstr "Intente con un navegador web más nuevo o confirme que JavaScript está habilitado." +msgstr "" +"Intente con un navegador web más nuevo o confirme que JavaScript está " +"habilitado." #: v1/jinja2/v1/layouts/base.html:261 msgid "Skip to main content" @@ -275,6 +280,3 @@ msgstr "" #~ msgid "Tip" #~ msgstr "Consejo" - -#~ msgid "Clear search" -#~ msgstr "Borrar búsqueda" diff --git a/cfgov/wellbeing/locale/es/LC_MESSAGES/django.po b/cfgov/wellbeing/locale/es/LC_MESSAGES/django.po index 1020ba1d627..f3fc301fa41 100644 --- a/cfgov/wellbeing/locale/es/LC_MESSAGES/django.po +++ b/cfgov/wellbeing/locale/es/LC_MESSAGES/django.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-29 11:30-0400\n" +"POT-Creation-Date: 2024-05-10 14:37-0400\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -253,125 +253,125 @@ msgstr "" "Calcule su puntuación de bienestar financiero y vea pasos sobre cómo " "mejorarla." -#: wellbeing/jinja2/wellbeing/home.html:62 +#: wellbeing/jinja2/wellbeing/home.html:65 msgid "Here’s how it works:" msgstr "Funciona así:" -#: wellbeing/jinja2/wellbeing/home.html:79 +#: wellbeing/jinja2/wellbeing/home.html:82 msgid "Answer the questions and get your score." msgstr "Conteste las preguntas y vea su puntuación." -#: wellbeing/jinja2/wellbeing/home.html:80 +#: wellbeing/jinja2/wellbeing/home.html:83 msgid "" "You won’t be asked about any personal financial data—it’s not that kind of " "questionnaire." msgstr "No le pediremos ningún dato financiero personal o específico." -#: wellbeing/jinja2/wellbeing/home.html:81 +#: wellbeing/jinja2/wellbeing/home.html:84 msgid "See how and why we developed it." msgstr "Lea más sobre cómo desarrollamos este cuestionario." -#: wellbeing/jinja2/wellbeing/home.html:84 +#: wellbeing/jinja2/wellbeing/home.html:87 msgid "Review steps you can take" msgstr "Revise los pasos que pueda tomar" -#: wellbeing/jinja2/wellbeing/home.html:85 +#: wellbeing/jinja2/wellbeing/home.html:88 msgid "if you want to be able to answer the questions differently." msgstr "si desea poder contestar las preguntas de una manera diferente." -#: wellbeing/jinja2/wellbeing/home.html:89 +#: wellbeing/jinja2/wellbeing/home.html:92 msgid "See how your score compares" msgstr "Compare su resultado" -#: wellbeing/jinja2/wellbeing/home.html:90 +#: wellbeing/jinja2/wellbeing/home.html:93 msgid "to other U.S. adults from our national survey." msgstr "con el del resto de la población en los Estados Unidos." -#: wellbeing/jinja2/wellbeing/home.html:100 +#: wellbeing/jinja2/wellbeing/home.html:103 msgid "We never collect or store the answers you provide." msgstr "No guardamos sus respuestas." -#: wellbeing/jinja2/wellbeing/home.html:106 +#: wellbeing/jinja2/wellbeing/home.html:109 msgid "See how your privacy is protected." msgstr "Lea más sobre cómo protegemos su privacidad." -#: wellbeing/jinja2/wellbeing/home.html:116 +#: wellbeing/jinja2/wellbeing/home.html:119 msgid "Part 1: How well does this statement describe you or your situation?" msgstr "Parte 1: ¿Cuán bien lo describe a usted o su situación lo siguiente?" -#: wellbeing/jinja2/wellbeing/home.html:120 wellbeing/views.py:15 +#: wellbeing/jinja2/wellbeing/home.html:123 wellbeing/views.py:15 msgid "I could handle a major unexpected expense" msgstr "Podría hacer frente a un gasto imprevisto importante" -#: wellbeing/jinja2/wellbeing/home.html:122 -#: wellbeing/jinja2/wellbeing/home.html:195 -#: wellbeing/jinja2/wellbeing/home.html:268 -#: wellbeing/jinja2/wellbeing/home.html:341 -#: wellbeing/jinja2/wellbeing/home.html:414 -#: wellbeing/jinja2/wellbeing/home.html:487 +#: wellbeing/jinja2/wellbeing/home.html:125 +#: wellbeing/jinja2/wellbeing/home.html:198 +#: wellbeing/jinja2/wellbeing/home.html:271 +#: wellbeing/jinja2/wellbeing/home.html:344 +#: wellbeing/jinja2/wellbeing/home.html:417 +#: wellbeing/jinja2/wellbeing/home.html:490 msgid "This statement describes me" msgstr "Esto me describe " -#: wellbeing/jinja2/wellbeing/home.html:134 -#: wellbeing/jinja2/wellbeing/home.html:207 -#: wellbeing/jinja2/wellbeing/home.html:280 -#: wellbeing/jinja2/wellbeing/home.html:353 -#: wellbeing/jinja2/wellbeing/home.html:426 -#: wellbeing/jinja2/wellbeing/home.html:499 wellbeing/views.py:21 +#: wellbeing/jinja2/wellbeing/home.html:137 +#: wellbeing/jinja2/wellbeing/home.html:210 +#: wellbeing/jinja2/wellbeing/home.html:283 +#: wellbeing/jinja2/wellbeing/home.html:356 +#: wellbeing/jinja2/wellbeing/home.html:429 +#: wellbeing/jinja2/wellbeing/home.html:502 wellbeing/views.py:21 #: wellbeing/views.py:32 wellbeing/views.py:42 wellbeing/views.py:59 #: wellbeing/views.py:66 wellbeing/views.py:80 msgid "Completely" msgstr "Totalmente" -#: wellbeing/jinja2/wellbeing/home.html:147 -#: wellbeing/jinja2/wellbeing/home.html:220 -#: wellbeing/jinja2/wellbeing/home.html:293 -#: wellbeing/jinja2/wellbeing/home.html:366 -#: wellbeing/jinja2/wellbeing/home.html:439 -#: wellbeing/jinja2/wellbeing/home.html:512 wellbeing/views.py:20 +#: wellbeing/jinja2/wellbeing/home.html:150 +#: wellbeing/jinja2/wellbeing/home.html:223 +#: wellbeing/jinja2/wellbeing/home.html:296 +#: wellbeing/jinja2/wellbeing/home.html:369 +#: wellbeing/jinja2/wellbeing/home.html:442 +#: wellbeing/jinja2/wellbeing/home.html:515 wellbeing/views.py:20 #: wellbeing/views.py:31 wellbeing/views.py:43 wellbeing/views.py:58 #: wellbeing/views.py:67 wellbeing/views.py:81 msgid "Very well" msgstr "Muy bien" -#: wellbeing/jinja2/wellbeing/home.html:160 -#: wellbeing/jinja2/wellbeing/home.html:233 -#: wellbeing/jinja2/wellbeing/home.html:306 -#: wellbeing/jinja2/wellbeing/home.html:379 -#: wellbeing/jinja2/wellbeing/home.html:452 -#: wellbeing/jinja2/wellbeing/home.html:525 wellbeing/views.py:19 +#: wellbeing/jinja2/wellbeing/home.html:163 +#: wellbeing/jinja2/wellbeing/home.html:236 +#: wellbeing/jinja2/wellbeing/home.html:309 +#: wellbeing/jinja2/wellbeing/home.html:382 +#: wellbeing/jinja2/wellbeing/home.html:455 +#: wellbeing/jinja2/wellbeing/home.html:528 wellbeing/views.py:19 #: wellbeing/views.py:30 wellbeing/views.py:44 wellbeing/views.py:57 #: wellbeing/views.py:68 wellbeing/views.py:82 msgid "Somewhat" msgstr "En cierta medida" -#: wellbeing/jinja2/wellbeing/home.html:173 -#: wellbeing/jinja2/wellbeing/home.html:246 -#: wellbeing/jinja2/wellbeing/home.html:319 -#: wellbeing/jinja2/wellbeing/home.html:392 -#: wellbeing/jinja2/wellbeing/home.html:465 -#: wellbeing/jinja2/wellbeing/home.html:538 wellbeing/views.py:18 +#: wellbeing/jinja2/wellbeing/home.html:176 +#: wellbeing/jinja2/wellbeing/home.html:249 +#: wellbeing/jinja2/wellbeing/home.html:322 +#: wellbeing/jinja2/wellbeing/home.html:395 +#: wellbeing/jinja2/wellbeing/home.html:468 +#: wellbeing/jinja2/wellbeing/home.html:541 wellbeing/views.py:18 #: wellbeing/views.py:29 wellbeing/views.py:45 wellbeing/views.py:56 #: wellbeing/views.py:69 wellbeing/views.py:83 msgid "Very little" msgstr "Muy poco" -#: wellbeing/jinja2/wellbeing/home.html:186 -#: wellbeing/jinja2/wellbeing/home.html:259 -#: wellbeing/jinja2/wellbeing/home.html:332 -#: wellbeing/jinja2/wellbeing/home.html:405 -#: wellbeing/jinja2/wellbeing/home.html:478 -#: wellbeing/jinja2/wellbeing/home.html:551 wellbeing/views.py:17 +#: wellbeing/jinja2/wellbeing/home.html:189 +#: wellbeing/jinja2/wellbeing/home.html:262 +#: wellbeing/jinja2/wellbeing/home.html:335 +#: wellbeing/jinja2/wellbeing/home.html:408 +#: wellbeing/jinja2/wellbeing/home.html:481 +#: wellbeing/jinja2/wellbeing/home.html:554 wellbeing/views.py:17 #: wellbeing/views.py:28 wellbeing/views.py:46 wellbeing/views.py:55 #: wellbeing/views.py:70 wellbeing/views.py:84 msgid "Not at all" msgstr "No me describe en lo absoluto" -#: wellbeing/jinja2/wellbeing/home.html:193 wellbeing/views.py:26 +#: wellbeing/jinja2/wellbeing/home.html:196 wellbeing/views.py:26 msgid "I am securing my financial future" msgstr "Estoy asegurando mi futuro financiero" -#: wellbeing/jinja2/wellbeing/home.html:266 wellbeing/views.py:38 +#: wellbeing/jinja2/wellbeing/home.html:269 wellbeing/views.py:38 msgid "" "Because of my money situation, I feel like I will never have the things I " "want in life" @@ -379,23 +379,23 @@ msgstr "" "Debido a mi situación financiera, creo que nunca tendré las cosas que quiero " "en la vida" -#: wellbeing/jinja2/wellbeing/home.html:339 +#: wellbeing/jinja2/wellbeing/home.html:342 msgid "I can enjoy life because of the way I’m managing my money" msgstr "Puedo disfrutar la vida debido a la manera en que manejo mi dinero" -#: wellbeing/jinja2/wellbeing/home.html:412 wellbeing/views.py:64 +#: wellbeing/jinja2/wellbeing/home.html:415 wellbeing/views.py:64 msgid "I am just getting by financially" msgstr "Apenas estoy subsistiendo financieramente" -#: wellbeing/jinja2/wellbeing/home.html:485 +#: wellbeing/jinja2/wellbeing/home.html:488 msgid "I am concerned that the money I have or will save won’t last" msgstr "Me preocupa que el dinero que tengo o que ahorre no me dure" -#: wellbeing/jinja2/wellbeing/home.html:559 +#: wellbeing/jinja2/wellbeing/home.html:562 msgid "Part 2: How often does this statement apply to you?" msgstr "Parte 2: ¿Con qué frecuencia le ocurre lo siguiente?" -#: wellbeing/jinja2/wellbeing/home.html:563 wellbeing/views.py:90 +#: wellbeing/jinja2/wellbeing/home.html:566 wellbeing/views.py:90 msgid "" "Giving a gift for a wedding, birthday or other occasion would put a strain " "on my finances for the month" @@ -403,74 +403,74 @@ msgstr "" "Hacer un regalo para una boda, un cumpleaños u otra ocasión supondría una " "enorme carga para mis finanzas del mes" -#: wellbeing/jinja2/wellbeing/home.html:565 -#: wellbeing/jinja2/wellbeing/home.html:638 -#: wellbeing/jinja2/wellbeing/home.html:710 -#: wellbeing/jinja2/wellbeing/home.html:783 +#: wellbeing/jinja2/wellbeing/home.html:568 +#: wellbeing/jinja2/wellbeing/home.html:641 +#: wellbeing/jinja2/wellbeing/home.html:713 +#: wellbeing/jinja2/wellbeing/home.html:786 msgid "This statement applies to me" msgstr "Esto me ocurre" -#: wellbeing/jinja2/wellbeing/home.html:577 -#: wellbeing/jinja2/wellbeing/home.html:649 -#: wellbeing/jinja2/wellbeing/home.html:722 -#: wellbeing/jinja2/wellbeing/home.html:795 wellbeing/views.py:95 +#: wellbeing/jinja2/wellbeing/home.html:580 +#: wellbeing/jinja2/wellbeing/home.html:652 +#: wellbeing/jinja2/wellbeing/home.html:725 +#: wellbeing/jinja2/wellbeing/home.html:798 wellbeing/views.py:95 #: wellbeing/views.py:110 wellbeing/views.py:117 wellbeing/views.py:128 msgid "Always" msgstr "Siempre" -#: wellbeing/jinja2/wellbeing/home.html:590 -#: wellbeing/jinja2/wellbeing/home.html:662 -#: wellbeing/jinja2/wellbeing/home.html:735 -#: wellbeing/jinja2/wellbeing/home.html:808 wellbeing/views.py:96 +#: wellbeing/jinja2/wellbeing/home.html:593 +#: wellbeing/jinja2/wellbeing/home.html:665 +#: wellbeing/jinja2/wellbeing/home.html:738 +#: wellbeing/jinja2/wellbeing/home.html:811 wellbeing/views.py:96 #: wellbeing/views.py:109 wellbeing/views.py:118 wellbeing/views.py:129 msgid "Often" msgstr "A menudo" -#: wellbeing/jinja2/wellbeing/home.html:603 -#: wellbeing/jinja2/wellbeing/home.html:675 -#: wellbeing/jinja2/wellbeing/home.html:748 -#: wellbeing/jinja2/wellbeing/home.html:821 wellbeing/views.py:97 +#: wellbeing/jinja2/wellbeing/home.html:606 +#: wellbeing/jinja2/wellbeing/home.html:678 +#: wellbeing/jinja2/wellbeing/home.html:751 +#: wellbeing/jinja2/wellbeing/home.html:824 wellbeing/views.py:97 #: wellbeing/views.py:108 wellbeing/views.py:119 wellbeing/views.py:130 msgid "Sometimes" msgstr "A veces" -#: wellbeing/jinja2/wellbeing/home.html:616 -#: wellbeing/jinja2/wellbeing/home.html:688 -#: wellbeing/jinja2/wellbeing/home.html:761 -#: wellbeing/jinja2/wellbeing/home.html:834 wellbeing/views.py:98 +#: wellbeing/jinja2/wellbeing/home.html:619 +#: wellbeing/jinja2/wellbeing/home.html:691 +#: wellbeing/jinja2/wellbeing/home.html:764 +#: wellbeing/jinja2/wellbeing/home.html:837 wellbeing/views.py:98 #: wellbeing/views.py:107 wellbeing/views.py:120 wellbeing/views.py:131 msgid "Rarely" msgstr "Casi nunca" -#: wellbeing/jinja2/wellbeing/home.html:629 -#: wellbeing/jinja2/wellbeing/home.html:701 -#: wellbeing/jinja2/wellbeing/home.html:774 -#: wellbeing/jinja2/wellbeing/home.html:847 wellbeing/views.py:99 +#: wellbeing/jinja2/wellbeing/home.html:632 +#: wellbeing/jinja2/wellbeing/home.html:704 +#: wellbeing/jinja2/wellbeing/home.html:777 +#: wellbeing/jinja2/wellbeing/home.html:850 wellbeing/views.py:99 #: wellbeing/views.py:106 wellbeing/views.py:121 wellbeing/views.py:132 msgid "Never" msgstr "Nunca" -#: wellbeing/jinja2/wellbeing/home.html:636 wellbeing/views.py:104 +#: wellbeing/jinja2/wellbeing/home.html:639 wellbeing/views.py:104 msgid "I have money left over at the end of the month" msgstr "Me sobra dinero al final del mes" -#: wellbeing/jinja2/wellbeing/home.html:708 wellbeing/views.py:115 +#: wellbeing/jinja2/wellbeing/home.html:711 wellbeing/views.py:115 msgid "I am behind with my finances" msgstr "Estoy atrasado en mis finanzas" -#: wellbeing/jinja2/wellbeing/home.html:781 wellbeing/views.py:126 +#: wellbeing/jinja2/wellbeing/home.html:784 wellbeing/views.py:126 msgid "My finances control my life" msgstr "Mis finanzas controlan mi vida" -#: wellbeing/jinja2/wellbeing/home.html:855 +#: wellbeing/jinja2/wellbeing/home.html:858 msgid "About you" msgstr "Sobre usted" -#: wellbeing/jinja2/wellbeing/home.html:860 +#: wellbeing/jinja2/wellbeing/home.html:863 msgid "Select your age group. This changes the scoring calculation." msgstr "Seleccione su edad. Esto afecta cómo calculamos su puntuación." -#: wellbeing/jinja2/wellbeing/home.html:899 +#: wellbeing/jinja2/wellbeing/home.html:902 msgid "" "Select how you completed the questionnaire. This changes the scoring " "calculation." @@ -478,29 +478,29 @@ msgstr "" "Seleccione cómo contestó el cuestionario. Esto afecta cómo calculamos su " "puntuación." -#: wellbeing/jinja2/wellbeing/home.html:914 +#: wellbeing/jinja2/wellbeing/home.html:917 msgid "I read and answered the questions myself" msgstr "Yo leí y contesté las preguntas" -#: wellbeing/jinja2/wellbeing/home.html:929 +#: wellbeing/jinja2/wellbeing/home.html:932 msgid "I read the questions to someone else and recorded their answers" msgstr "Yo leí a alguien las preguntas y anoté sus respuestas" -#: wellbeing/jinja2/wellbeing/home.html:944 +#: wellbeing/jinja2/wellbeing/home.html:947 msgid "Get my score" msgstr "Obtenga su puntuación" -#: wellbeing/jinja2/wellbeing/home.html:957 +#: wellbeing/jinja2/wellbeing/home.html:960 msgid "About us" msgstr "Quienes somos" -#: wellbeing/jinja2/wellbeing/home.html:959 +#: wellbeing/jinja2/wellbeing/home.html:962 msgid "We're the Consumer Financial Protection Bureau (CFPB)," msgstr "" "Somos la Oficina para la Protección Financiera del Consumidor (CFPB, por sus " "siglas en inglés)," -#: wellbeing/jinja2/wellbeing/home.html:960 +#: wellbeing/jinja2/wellbeing/home.html:963 msgid "" "a U.S. government agency that makes sure banks, lenders, and other financial " "companies treat you fairly." @@ -508,16 +508,16 @@ msgstr "" "una agencia del gobierno de los Estados Unidos que se asegura de que bancos, " "prestamistas y otras compañías financieras le traten de forma justa." -#: wellbeing/jinja2/wellbeing/home.html:963 +#: wellbeing/jinja2/wellbeing/home.html:966 msgid "Learn how the CFPB can help you" msgstr "Descubra cómo el CFPB puede ayudarle" -#: wellbeing/jinja2/wellbeing/home.html:969 +#: wellbeing/jinja2/wellbeing/home.html:972 #: wellbeing/jinja2/wellbeing/results.html:515 msgid "About this questionnaire" msgstr "Sobre este cuestionario" -#: wellbeing/jinja2/wellbeing/home.html:972 +#: wellbeing/jinja2/wellbeing/home.html:975 #: wellbeing/jinja2/wellbeing/results.html:518 msgid "" "CFPB researchers developed the questionnaire and a way to score it, as a " @@ -526,7 +526,7 @@ msgstr "" "Investigadores del CFPB desarrollaron este cuestionario y el método para " "obtener su puntuación de bienestar financiero." -#: wellbeing/jinja2/wellbeing/home.html:973 +#: wellbeing/jinja2/wellbeing/home.html:976 #: wellbeing/jinja2/wellbeing/results.html:519 msgid "" "that is, how well your current money situation is providing you with " @@ -535,7 +535,7 @@ msgstr "" "Su puntuación mide cuán bien su situación financiera actual le da seguridad " "y libertad financiera tanto en el presente como en el futuro." -#: wellbeing/jinja2/wellbeing/home.html:976 +#: wellbeing/jinja2/wellbeing/home.html:979 #: wellbeing/jinja2/wellbeing/results.html:522 msgid "See more background" msgstr "Más información" diff --git a/test/cypress/integration/consumer-tools/ask-cfpb/ask-cfpb.cy.js b/test/cypress/integration/consumer-tools/ask-cfpb/ask-cfpb.cy.js index 1e24ef3fec9..7e162b43ddc 100644 --- a/test/cypress/integration/consumer-tools/ask-cfpb/ask-cfpb.cy.js +++ b/test/cypress/integration/consumer-tools/ask-cfpb/ask-cfpb.cy.js @@ -41,6 +41,14 @@ describe('Ask CFPB', () => { search.maxLengthErrorMessage().should('be.visible'); search.submitButton().should('be.disabled'); }); + + it('should allow clearing of search', () => { + search.enter('typed a typoo'); + search.resetButton().should('be.visible'); + search.clearSearch(); + search.input().invoke('val').should('be.empty'); + search.resetButton().should('not.be.visible'); + }); }); describe('Answer Page', () => { diff --git a/test/cypress/integration/consumer-tools/ask-cfpb/search-helpers.cy.js b/test/cypress/integration/consumer-tools/ask-cfpb/search-helpers.cy.js index 946c0ec4ea8..3a4acf950c7 100644 --- a/test/cypress/integration/consumer-tools/ask-cfpb/search-helpers.cy.js +++ b/test/cypress/integration/consumer-tools/ask-cfpb/search-helpers.cy.js @@ -4,8 +4,12 @@ export class AskCfpbSearch { cy.visit(path); } + searchInputComponent() { + return cy.get('[data-cy=ask-search-form] .o-search-input'); + } + input() { - return cy.get('#o-search-bar_query'); + return this.searchInputComponent().find('input'); } enter(term) { @@ -17,13 +21,21 @@ export class AskCfpbSearch { } submitButton() { - return cy.get('.o-search-bar .a-btn'); + return this.searchInputComponent().find('button[type="submit"]'); + } + + resetButton() { + return this.searchInputComponent().find('button[type="reset"]'); } search() { this.submitButton().click(); } + clearSearch() { + this.resetButton().click(); + } + resultsSection() { return cy.get('.search-results'); } diff --git a/test/cypress/integration/consumer-tools/tdp-activity-search/tdp-activity-search-helpers.cy.js b/test/cypress/integration/consumer-tools/tdp-activity-search/tdp-activity-search-helpers.cy.js index b7329f7b72d..fc2618192ac 100644 --- a/test/cypress/integration/consumer-tools/tdp-activity-search/tdp-activity-search-helpers.cy.js +++ b/test/cypress/integration/consumer-tools/tdp-activity-search/tdp-activity-search-helpers.cy.js @@ -26,7 +26,7 @@ export class ActivitySearch { cy.get('form[action="."]') .first() .within(() => { - cy.get('button').first().click(); + cy.get('button[type="submit"]').click(); }); } } diff --git a/test/cypress/integration/rules-policy/regulations-search-helpers.cy.js b/test/cypress/integration/rules-policy/regulations-search-helpers.cy.js index b86882bba69..080e0d60b1d 100644 --- a/test/cypress/integration/rules-policy/regulations-search-helpers.cy.js +++ b/test/cypress/integration/rules-policy/regulations-search-helpers.cy.js @@ -3,13 +3,33 @@ export class RegulationsSearch { cy.visit('/rules-policy/regulations/search-regulations/results/'); } - searchForm() { - return cy.get('form[action="."]'); + searchInputComponent() { + return cy.get('[data-cy=regs-search-form] .o-search-input'); + } + + input() { + return this.searchInputComponent().find('input'); + } + + submitButton() { + return this.searchInputComponent().find('button[type="submit"]'); + } + + resetButton() { + return this.searchInputComponent().find('button[type="reset"]'); + } + + search() { + this.submitButton().click(); + } + + clearSearch() { + this.resetButton().click(); } searchTerm(term) { - this.searchForm().find('#query').type(term); - this.searchForm().submit(); + this.input().type(term); + this.search(); } searchResults() { diff --git a/test/cypress/integration/rules-policy/regulations-search.cy.js b/test/cypress/integration/rules-policy/regulations-search.cy.js index 677ed46a680..35250d0b27e 100644 --- a/test/cypress/integration/rules-policy/regulations-search.cy.js +++ b/test/cypress/integration/rules-policy/regulations-search.cy.js @@ -13,6 +13,14 @@ describe('Policy Compliance', () => { regulationsSearch.searchResults().should('be.visible'); }); + it('should allow clearing of search', () => { + regulationsSearch.input().type('typed a typoo'); + regulationsSearch.resetButton().should('be.visible'); + regulationsSearch.clearSearch(); + regulationsSearch.input().invoke('val').should('be.empty'); + regulationsSearch.resetButton().should('not.be.visible'); + }); + it('should adjust results based on the page size', () => { regulationsSearch.setPageSize(50); regulationsSearch.searchResult().should('have.length', '50'); diff --git a/test/unit_tests/apps/regulations3k/js/search-spec.js b/test/unit_tests/apps/regulations3k/js/search-spec.js index 83896f055ec..f00da0eb10a 100644 --- a/test/unit_tests/apps/regulations3k/js/search-spec.js +++ b/test/unit_tests/apps/regulations3k/js/search-spec.js @@ -7,8 +7,21 @@ import '../../../../../cfgov/unprocessed/apps/regulations3k/js/search.js'; const HTML_SNIPPET = `
- - +
+
+ + + +
+ + +
@@ -70,7 +83,7 @@ describe('The Regs3K search page', () => { }); it('should clear a filter when its X icon is clicked', () => { - const clearIcon = document.querySelector('svg'); + const clearIcon = document.querySelector('.a-tag svg'); let numFilters = document.querySelectorAll('div.a-tag').length; expect(numFilters).toEqual(1); @@ -104,7 +117,7 @@ describe('The Regs3K search page', () => { it('should handle errors when the server is down', (done) => { fetch.mockReject(new Error('Server error!')); - const clearIcon = document.querySelector('svg'); + const clearIcon = document.querySelector('.a-tag svg'); simulateEvent('click', clearIcon); setTimeout(() => { diff --git a/test/unit_tests/apps/teachers-digital-platform/js/ClearableInput-spec.js b/test/unit_tests/apps/teachers-digital-platform/js/ClearableInput-spec.js deleted file mode 100644 index d764332a02b..00000000000 --- a/test/unit_tests/apps/teachers-digital-platform/js/ClearableInput-spec.js +++ /dev/null @@ -1,82 +0,0 @@ -import { ClearableInput } from '../../../../../cfgov/unprocessed/apps/teachers-digital-platform/js/ClearableInput.js'; -import { simulateEvent } from '../../../../util/simulate-event.js'; - -let baseDom; -let clearBtnDom; -let inputDom; - -const HTML_SNIPPET = ` -
-
- - - -
-
-`; - -describe('ClearableInput', () => { - beforeEach(() => { - document.body.innerHTML = HTML_SNIPPET; - baseDom = document.querySelector('.o-form--input-w-btn__input-container'); - inputDom = baseDom.querySelector('input'); - clearBtnDom = baseDom.querySelector('.input-contains-label__after--clear'); - }); - - describe('init function', () => { - it('should hide the clear button when a value is empty', () => { - new ClearableInput(baseDom).init(); - expect(clearBtnDom.classList.contains('u-hidden')).toStrictEqual(true); - }); - - it('should display the clear button when a value is present', () => { - inputDom.value = 'testing init function'; - new ClearableInput(baseDom).init(); - expect(clearBtnDom.classList.contains('u-hidden')).toStrictEqual(false); - }); - }); - - describe('on clear button click', () => { - it('should hide itself', () => { - inputDom.value = 'testing clear button'; - new ClearableInput(baseDom).init(); - expect(clearBtnDom.classList.contains('u-hidden')).toStrictEqual(false); - simulateEvent('mousedown', clearBtnDom); - expect(clearBtnDom.classList.contains('u-hidden')).toStrictEqual(true); - }); - - it('should clear the input value', () => { - inputDom.value = 'testing clear button'; - new ClearableInput(baseDom).init(); - simulateEvent('mousedown', clearBtnDom); - expect(inputDom.value).toStrictEqual(''); - }); - }); - - describe('on input keystroke', () => { - it('should show the clear button, if value present', () => { - new ClearableInput(baseDom).init(); - - simulateEvent('keyup', inputDom, { key: 'a' }); - expect(clearBtnDom.classList.contains('u-hidden')).toStrictEqual(false); - }); - - it('should hide the clear button, if value not present', () => { - new ClearableInput(baseDom).init(); - - simulateEvent('keyup', inputDom, { key: 'a' }); - expect(clearBtnDom.classList.contains('u-hidden')).toStrictEqual(false); - simulateEvent('keyup', inputDom, { key: 'Backspace' }); - expect(clearBtnDom.classList.contains('u-hidden')).toStrictEqual(true); - }); - }); -}); diff --git a/test/unit_tests/apps/teachers-digital-platform/js/search-spec.js b/test/unit_tests/apps/teachers-digital-platform/js/search-spec.js index 739c6b34190..591b554ca66 100644 --- a/test/unit_tests/apps/teachers-digital-platform/js/search-spec.js +++ b/test/unit_tests/apps/teachers-digital-platform/js/search-spec.js @@ -6,18 +6,23 @@ import { init as searchInit } from '../../../../../cfgov/unprocessed/apps/teache const HTML_SNIPPET = `