Problem/Motivation

Follow-up to #3579873. The initial FunctionalJavascript tests bypassed the select-a11y widget by setting values directly on the hidden native <select> element, which defeats the purpose of JS testing. The search/filter feature was not tested at all. Additionally, the facets JS has a bug that prevents option selection from triggering navigation.

Proposed resolution

  • Update all FunctionalJavascript tests to interact with the actual select-a11y widget UI (button click, search input, suggestion click).
  • Test the search/filter feature: type in the search input, verify suggestions are filtered, verify the search input is hidden when search is disabled.
  • Add submission verification to all submodule tests (BEF, webform, facets).
  • Fix the facets JS bug: e.detail is always undefined on the standard change event — use element.selectedIndex instead.
Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

mably created an issue. See original summary.

mably’s picture

MR summary

All FunctionalJavascript tests now interact with the actual select-a11y widget UI (button click, search input, suggestion click) instead of setting values directly on the hidden native select.

Search functionality tested

  • Single select test types in the search input, verifies filtering reduces suggestions to the matching one, then clicks it.
  • Search disabled test opens the widget and verifies the search input has the hidden attribute.

Submission verification added to all submodule tests

  • BEF: selects "a" via search input, submits exposed form, verifies "Page One" is shown and "Page Two" is filtered out.
  • Webform: selects "Banana" via widget, submits form, verifies the WebformSubmission data contains the correct value.
  • Facets: clicks widget button, selects a suggestion, verifies page navigation and filtered result count.

Facets JS bug fix

select-a11y-ng-facets.js used e.detail on the change event which is always undefined — replaced with element.selectedIndex so facet option selection actually triggers navigation.

mably’s picture

Title: Improve test coverage with submission verification and dependency injection » Improve JS tests with widget UI interaction, search testing, and facets JS fix
Issue summary: View changes
mably’s picture

Issue summary: View changes

  • mably committed 59776c6e on 1.x
    task: #3579956 Improve JS tests with widget UI interaction, search...
mably’s picture

Assigned: mably » Unassigned
Status: Active » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.