Skip to content

Commit

Permalink
feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonMilord committed Nov 4, 2024
1 parent 2b53f90 commit 6136f07
Showing 1 changed file with 26 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -114,32 +114,6 @@ describe('c-quantic-standalone-search-box', () => {
expect(() => createTestComponent()).not.toThrow();
});

describe('when the current page reference changes', () => {
beforeAll(() => {
Object.defineProperty(window, 'location', {
writable: true,
value: {href: nonStandaloneURL},
});
});

it('should properly pass the keepFiltersOnSearch property to the quanticSearchBox', async () => {
const element = createTestComponent({
...defaultOptions,
keepFiltersOnSearch: false,
});
// eslint-disable-next-line @lwc/lwc/no-unexpected-wire-adapter-usages
CurrentPageReference.emit({url: nonStandaloneURL});
await flushPromises();

const searchBox = element.shadowRoot.querySelector(
'c-quantic-search-box'
);

expect(searchBox).not.toBeNull();
expect(searchBox.keepFiltersOnSearch).toEqual(false);
});
});

describe('controller initialization', () => {
it('should subscribe to the headless state changes', async () => {
createTestComponent();
Expand All @@ -148,6 +122,32 @@ describe('c-quantic-standalone-search-box', () => {
expect(functionsMocks.subscribe).toHaveBeenCalledTimes(1);
});

describe('when the current page reference changes', () => {
beforeAll(() => {
Object.defineProperty(window, 'location', {
writable: true,
value: {href: nonStandaloneURL},
});
});

it('should properly pass the keepFiltersOnSearch property to the quanticSearchBox', async () => {
const element = createTestComponent({
...defaultOptions,
keepFiltersOnSearch: false,
});
// eslint-disable-next-line @lwc/lwc/no-unexpected-wire-adapter-usages
CurrentPageReference.emit({url: nonStandaloneURL});
await flushPromises();

const searchBox = element.shadowRoot.querySelector(
'c-quantic-search-box'
);

expect(searchBox).not.toBeNull();
expect(searchBox.keepFiltersOnSearch).toEqual(false);
});
});

describe('when keepFiltersOnSearch is false (default)', () => {
it('should properly initialize the controller with clear filters enabled', async () => {
createTestComponent();
Expand Down

0 comments on commit 6136f07

Please sign in to comment.