Skip to content

[OP-19453] Add spec coverage for filter input forms - #23489

Merged
myabc merged 3 commits into
devfrom
code-maintenance/SDS-699-filters-form-specs
Jun 3, 2026
Merged

[OP-19453] Add spec coverage for filter input forms#23489
myabc merged 3 commits into
devfrom
code-maintenance/SDS-699-filters-form-specs

Conversation

@myabc

@myabc myabc commented Jun 1, 2026

Copy link
Copy Markdown
Contributor

Note

This PR is based on #23488. Please review/merge that PR first.

Ticket

https://community.openproject.org/wp/OP-19453

What are you trying to accomplish?

Backfills spec coverage for the filter input form layer. Covers the per-type filter inputs (text, list, date, boolean, autocomplete) and the "add filter" select through a shared render context, the FilterFormComponent wrapper (controller wrapping, hidden input, output format, system-argument merging), the SegmentedControl form DSL input behind boolean rows, and the shared BaseFilterForm row contract.

Screenshots

No visual changes.

What approach did you choose and why?

Specs render through the existing Primer form-DSL test harnesses and assert on accessible roles/names and semantic attributes rather than CSS, so they track behaviour rather than markup. BaseFilterForm is exercised directly via a throwaway concrete subclass so the abstract base's shared row logic is covered in one place instead of only transitively through each subclass.

Merge checklist

  • Added/updated tests
  • Added/updated documentation in Lookbook (patterns, previews, etc)
  • Tested major browsers (Chrome, Firefox, Edge, ...)

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds RSpec coverage for the advanced filter input form classes used by Filters::FilterFormComponent, asserting the rendered DOM structure, key Stimulus/data-* attributes, and operator/value wiring across different filter input types.

Changes:

  • Added a shared rendered-form context + shared examples for common filter-row expectations.
  • Added form specs for TextForm, ListForm, DateForm, BooleanForm, and AutocompleteForm.
  • Added a spec for AddFilterForm covering option rendering and disabling active filters.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
spec/support/forms/rendered_filter_input_form.rb Shared context + shared examples for rendering filter input forms in a Primer form and asserting common row/operator behavior.
spec/forms/filters/inputs/text_form_spec.rb Verifies text vs numeric rendering and naming/value behavior for TextForm.
spec/forms/filters/inputs/list_form_spec.rb Verifies list filter renders the autocompleter wrapper/options and merges additional autocomplete options.
spec/forms/filters/inputs/date_form_spec.rb Verifies operator-dependent date input variants and visibility/hidden handling.
spec/forms/filters/inputs/boolean_form_spec.rb Verifies segmented control rendering and the (hidden) operator select behavior for boolean filters.
spec/forms/filters/inputs/autocomplete_form_spec.rb Verifies autocomplete-backed filters render as multiple autocompleters with expected wrapper attributes.
spec/forms/filters/inputs/add_filter_form_spec.rb Verifies add-filter select rendering, prompt, option listing, and disabling active filters.

Comment thread spec/support/forms/rendered_filter_input_form.rb
@myabc myabc changed the title [#75510] Add spec coverage for filter input forms [SDS-699] Add spec coverage for filter input forms Jun 2, 2026
@myabc
myabc force-pushed the code-maintenance/75446-filters-form-component-rework branch 2 times, most recently from f6700cc to a9742d0 Compare June 2, 2026 17:01
@myabc
myabc force-pushed the code-maintenance/SDS-699-filters-form-specs branch from 5d4dd07 to cb476df Compare June 2, 2026 17:43
myabc added 3 commits June 2, 2026 19:52
Adds 47 specs across 6 form classes and a shared context.
Covers TextForm, ListForm, DateForm, BooleanForm, AutocompleteForm, and
AddFilterForm with assertions on rendered structure, data attributes,
and operator routing.

https://community.openproject.org/wp/OP-19453
Covers the SegmentedControl DSL input behind boolean filter rows: label
and button rendering, the hidden value field, value defaulting to the
first item, and wrapper data attributes.
Covers BaseFilterForm's shared row contract directly via a throwaway
concrete subclass: row data attributes, the operator select with its
data-no-value branch, label targeting, hidden-when-inactive, the delete
button, hiding the operator select for a boolean filter, and the
abstract add_operand raising SubclassResponsibilityError.
@myabc
myabc force-pushed the code-maintenance/SDS-699-filters-form-specs branch from cb476df to 2d2b97e Compare June 2, 2026 17:52
@myabc myabc changed the title [SDS-699] Add spec coverage for filter input forms [OP-19453] Add spec coverage for filter input forms Jun 2, 2026
@myabc
myabc requested a review from Copilot June 2, 2026 17:53
@myabc
myabc requested review from a team and dfriquet June 2, 2026 17:53
@myabc myabc added maintenance needs review ruby Pull requests that update Ruby code labels Jun 2, 2026
@myabc
myabc marked this pull request as ready for review June 2, 2026 17:55

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 9 out of 9 changed files in this pull request and generated no new comments.

Base automatically changed from code-maintenance/75446-filters-form-component-rework to dev June 3, 2026 13:58
@myabc
myabc merged commit 8448188 into dev Jun 3, 2026
17 of 18 checks passed
@myabc
myabc deleted the code-maintenance/SDS-699-filters-form-specs branch June 3, 2026 13:59
@github-actions github-actions Bot locked and limited conversation to collaborators Jun 3, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

maintenance needs review ruby Pull requests that update Ruby code

Development

Successfully merging this pull request may close these issues.

3 participants