Skip to content

Commit

Permalink
fix(filter): use config from param after latest change to pass only a…
Browse files Browse the repository at this point in the history
…ccordion config
  • Loading branch information
ichim-david committed Aug 16, 2023
1 parent 90ce56e commit aae122e
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 27 deletions.
5 changes: 2 additions & 3 deletions src/components/manage/Blocks/Accordion/AccordionFilter.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,13 @@ const AccordionFilter = ({
filterValue,
handleFilteredValueChange,
}) => {
const accordionConfig = config.blocks.blocksConfig.accordion;
const { titleIcons } = accordionConfig;
const { titleIcons } = config;
const iconOnRight = data.right_arrows;
const iconPosition = iconOnRight ? 'rightPosition' : 'leftPosition';
return (
<Accordion
className={`styled ${
data.styles ? data.styles.theme : accordionConfig?.defaults?.theme
data.styles ? data.styles.theme : config?.defaults?.theme
}`}
>
<Accordion.Title
Expand Down
48 changes: 24 additions & 24 deletions src/components/manage/Blocks/Accordion/AccordionFilter.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,34 +3,34 @@ import React from 'react';
import AccordionFilter from './AccordionFilter';
import '@testing-library/jest-dom/extend-expect';

const accordionConfig = {
defaults: {
theme: 'defaultTheme',
},
titleIcons: {
unfiltered: {
rightPosition: 'chevron left',
leftPosition: 'chevron right',
describe('AccordionFilter', () => {
const accordionConfig = {
defaults: {
theme: 'defaultTheme',
},
filtered: {
rightPosition: 'chevron down',
leftPosition: 'chevron down',
titleIcons: {
unfiltered: {
rightPosition: 'chevron left',
leftPosition: 'chevron right',
},
filtered: {
rightPosition: 'chevron down',
leftPosition: 'chevron down',
},
size: 'tiny',
iconComponent: 'SemanticIcon',
},
size: 'tiny',
iconComponent: 'SemanticIcon',
},
};
};

const handleFilteredValueChange = jest.fn();
let filterValue = '';
const data = {
styles: {
theme: 'custom-theme',
},
right_arrows: true,
};
const handleFilteredValueChange = jest.fn();
let filterValue = '';
const data = {
styles: {
theme: 'custom-theme',
},
right_arrows: true,
};

describe('AccordionFilter', () => {
it('renders correctly with default props', () => {
const { container } = render(
<AccordionFilter
Expand Down

0 comments on commit aae122e

Please sign in to comment.