Skip to content

Commit

Permalink
applied fix for sortOptions initialization
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonMilord committed Aug 13, 2024
1 parent f76c3a7 commit 70cb789
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 18 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {Interception} from 'cypress/types/net-stubbing';
import {InterceptAliases} from '../../../page-objects/search';
import {getQueryAlias, InterceptAliases} from '../../../page-objects/search';
import {useCaseEnum} from '../../../page-objects/use-case';
import {
completeSearchRequest,
Expand Down Expand Up @@ -45,12 +45,7 @@ function sortExpectations(selector: SortSelector) {
value: string,
useCase: useCaseEnum
) => {
const interceptAliasToUse =
useCase === useCaseEnum.search
? InterceptAliases.Search
: InterceptAliases.Insight;

cy.get<Interception>(interceptAliasToUse)
cy.get<Interception>(getQueryAlias(useCase))
.then((interception) => {
const body = interception.request.body;
expect(body.sortCriteria).to.equal(value);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ export default class QuanticRefineModalContent extends LightningElement {

/** @type {object} */
facetData;
/** @type {boolean} */
isSortComponentReady;
/** @type {object} */
sortData;
/** @type {boolean} */
Expand Down Expand Up @@ -136,6 +138,7 @@ export default class QuanticRefineModalContent extends LightningElement {
*/
getSortOptionsFromStore() {
this.sortData = getAllSortOptionsFromStore(this.engineId);
this.isSortComponentReady = true;
}

/**
Expand Down Expand Up @@ -266,7 +269,7 @@ export default class QuanticRefineModalContent extends LightningElement {
* @returns {Array<SortOption>}
*/
get sortOptions() {
return this.hasSortOptions ? this.sortData : [];
return this.isSortComponentReady ? this.sortData : [];
}

get shouldDisplayFiltersTitle() {
Expand Down Expand Up @@ -294,14 +297,6 @@ export default class QuanticRefineModalContent extends LightningElement {
return this.facetData && !!Object.keys(this.facetData).length;
}

/**
* Indicates whether the sort options are available.
* @returns {boolean}
*/
get hasSortOptions() {
return this.sortData?.length > 0;
}

/**
* @param {CustomEvent} event
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<template lwc:else>
<template if:false={hideSort}>
<div class="slds-var-m-bottom_small slds-clearfix">
<template lwc:if={hasSortOptions}>
<template lwc:if={isSortComponentReady}>
<c-quantic-sort class="slds-float_left" engine-id={engineId}>
<template for:each={sortOptions} for:item="sortOption">
<c-quantic-sort-option
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<template lwc:else>
<template if:false={hideSort}>
<div class="slds-var-m-bottom_small slds-clearfix">
<template lwc:if={hasSortOptions}>
<template lwc:if={isSortComponentReady}>
<c-quantic-sort class="slds-float_left" engine-id={engineId}>
<template for:each={sortOptions} for:item="sortOption">
<c-quantic-sort-option
Expand Down

0 comments on commit 70cb789

Please sign in to comment.