Skip to content

Conversation

@louis-bompart
Copy link
Collaborator

This pull request introduces a new no-facet-search attribute to the AtomicFacet component, allowing consumers to explicitly disable the facet search feature. The existing with-search attribute is now deprecated in favor of this new approach. The changes include updates to the component logic, documentation, and test coverage to ensure correct behavior of the new attribute.

Facet Search Attribute Improvements:

  • Added a new no-facet-search boolean property and attribute to AtomicFacet, which disables the facet search feature when set to true. This attribute replaces the previous with-search attribute, which is now deprecated. [1] [2]
  • Updated the facet search rendering logic to use the new noFacetSearch property, ensuring that the search box is only shown when noFacetSearch is false and withSearch is true.

Testing Enhancements:

  • Extended the test suite to cover scenarios for the new noFacetSearch property, including combinations with the legacy withSearch property, to verify correct rendering of search elements.
  • Updated the test setup and rendering to support the new noFacetSearch property. [1] [2]

Copy link
Contributor

Copilot AI left a comment

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 introduces a new no-facet-search attribute to the AtomicFacet component to provide a more intuitive way to disable the facet search feature. The new attribute follows a positive naming pattern (disabling via presence rather than requiring absence) and deprecates the existing with-search attribute. The implementation maintains backward compatibility by combining both attributes in the rendering logic, with noFacetSearch taking precedence.

Key Changes:

  • Added noFacetSearch boolean property to control facet search visibility, replacing the deprecated withSearch attribute
  • Updated rendering logic to respect both attributes during the transition period, with noFacetSearch taking precedence
  • Extended test suite to verify the new property works correctly in isolation and in combination with the legacy withSearch attribute

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
packages/atomic/src/components/search/atomic-facet/atomic-facet.ts Added noFacetSearch property, deprecated withSearch, and updated facet search rendering logic to evaluate both properties
packages/atomic/src/components/search/atomic-facet/atomic-facet.spec.ts Added test cases for noFacetSearch property including edge cases with withSearch combinations

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

* Replaces the `with-search` attribute.
*/
@property({
type: Boolean,
Copy link

Copilot AI Dec 11, 2025

Choose a reason for hiding this comment

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

The noFacetSearch property is missing the converter: booleanConverter option. All boolean properties in this component and across the Atomic codebase use the booleanConverter to ensure consistent handling of boolean attributes according to HTML standards. The converter also warns users about incorrect usage of boolean attributes (like using value="false"), which will not be supported in Atomic v4.

Add converter: booleanConverter to the @property decorator configuration, similar to other boolean properties like withSearch, isCollapsed, filterFacetCount, and enableExclusion in this same file.

Suggested change
type: Boolean,
type: Boolean,
converter: booleanConverter,

Copilot uses AI. Check for mistakes.
*/
@property({
type: Boolean,
attribute: 'no-facet-search',
Copy link

Copilot AI Dec 11, 2025

Choose a reason for hiding this comment

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

The noFacetSearch property is missing the reflect: true option. All similar boolean properties in this component (withSearch, isCollapsed, filterFacetCount, enableExclusion) include reflect: true to synchronize the property value with the HTML attribute. This ensures that when the property changes programmatically, the DOM attribute is updated accordingly, which is important for observability and debugging.

Add reflect: true to the @property decorator configuration for consistency with other boolean properties in this component.

Suggested change
attribute: 'no-facet-search',
attribute: 'no-facet-search',
reflect: true,

Copilot uses AI. Check for mistakes.
Comment on lines +225 to +232
it('should render search parts when both noFacetSearch and withSearch are false', async () => {
const {locators} = await setupElement({
noFacetSearch: false,
withSearch: false,
});
await expect.element(locators.searchWrapper).not.toBeInTheDocument();
await expect.element(locators.searchInput).not.toBeInTheDocument();
});
Copy link

Copilot AI Dec 11, 2025

Choose a reason for hiding this comment

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

The test description states "should render search parts when both noFacetSearch and withSearch are false", but the test assertions verify that search parts are NOT rendered. According to the component logic at line 530 (withSearch: !this.noFacetSearch && this.withSearch), when both are false, the expression evaluates to true && false = false, meaning search parts should NOT be rendered.

The assertions are correct, but the test description is misleading. Change the test description to "should not render search parts when both noFacetSearch and withSearch are false" to accurately reflect what is being tested.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants