Skip to content

Commit

Permalink
Merge pull request #78 from eea/develop
Browse files Browse the repository at this point in the history
Release
  • Loading branch information
avoinea authored Nov 29, 2023
2 parents c1ea9e7 + 6dd929e commit 0179dd8
Show file tree
Hide file tree
Showing 7 changed files with 48 additions and 6 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file. Dates are d

Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).

### [7.0.3](https://github.com/eea/volto-tabs-block/compare/7.0.2...7.0.3) - 29 November 2023

#### :bug: Bug Fixes

- fix: delete styles on tab - refs #260427 [dobri1408 - [`6925c95`](https://github.com/eea/volto-tabs-block/commit/6925c958780e9446949c9023053970f042052ecf)]

### [7.0.2](https://github.com/eea/volto-tabs-block/compare/7.0.1...7.0.2) - 24 November 2023

#### :bug: Bug Fixes
Expand Down
22 changes: 22 additions & 0 deletions cypress/e2e/01-block-tabs.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,28 @@ describe('Blocks Tests', () => {
beforeEach(slateBeforeEach);
afterEach(slateAfterEach);

it('Check tabs widget', () => {
cy.clearSlateTitle();
cy.getSlateTitle().type('Tabs widget');

cy.get('.documentFirstHeading').contains('Tabs widget');

cy.getSlate().click();

cy.get('.ui.basic.icon.button.block-add-button').first().click();
cy.get('.blocks-chooser .title').contains('Common').click();
cy.get('.content.active.common .button.tabs_block')
.contains('Tabs')
.click({ force: true });

cy.get('.field-wrapper-title input').last().type('Tab 1');
cy.get('.tabs-area .accordion.ui').first().click();
cy.get('#field-assetType-1-data-0').click();
cy.contains('Icon').click();
cy.get('#field-icon-2-data-0').type('delete');
cy.get('#toolbar-save').click();
});

it('Add Tabs default template', () => {
cy.clearSlateTitle();
cy.getSlateTitle().type('Tabs block default template');
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@eeacms/volto-tabs-block",
"version": "7.0.2",
"version": "7.0.3",
"description": "volto-tabs-block: Volto add-on",
"main": "src/index.js",
"author": "European Environment Agency: IDM2 A-Team",
Expand Down
3 changes: 2 additions & 1 deletion src/components/templates/accordion/Edit.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ const Edit = (props) => {
const accordionConfig = config.blocks.blocksConfig[
TABS_BLOCK
].variations.filter((v, _i) => v.id === data.variation);
const { icons, semanticIcon, transformWidth = 800 } = accordionConfig?.[0];
const { icons, semanticIcon, transformWidth = 800 } =
accordionConfig?.[0] || {};

const tabsContainer = React.useRef();
const [mounted, setMounted] = React.useState(false);
Expand Down
3 changes: 2 additions & 1 deletion src/components/templates/accordion/View.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ const View = (props) => {
const accordionConfig = config.blocks.blocksConfig[
TABS_BLOCK
].variations.filter((v, _i) => v.id === data.variation);
const { icons, semanticIcon, transformWidth = 800 } = accordionConfig?.[0];
const { icons, semanticIcon, transformWidth = 800 } =
accordionConfig?.[0] || {};

const tabsContainer = React.useRef();
const [mounted, setMounted] = React.useState(false);
Expand Down
2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ const applyConfig = (config) => {
},
],
getBlocks: (data) => {
const { blocks = {}, blocks_layout = {} } = data?.data;
const { blocks = {}, blocks_layout = {} } = data?.data || {};
if (blocks_layout?.items?.length) {
return {
blocks: blocks_layout.items.map((block, index) => ({
Expand Down
16 changes: 14 additions & 2 deletions src/widgets/TabsWidget.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ const TabsWidget = (props) => {
},
blocks_layout: {
...value.blocks_layout,
items: [...value.blocks_layout?.items, newId],
items: [...(value.blocks_layout?.items || []), newId],
},
});
}}
Expand Down Expand Up @@ -170,7 +170,7 @@ const TabsWidget = (props) => {
blocks_layout: {
...value.blocks_layout,
items: without(
[...value.blocks_layout?.items],
[...(value.blocks_layout?.items || [])],
childId,
),
},
Expand Down Expand Up @@ -227,6 +227,7 @@ const TabsWidget = (props) => {
<StyleWrapperEdit
{...props}
selected={activeTabId}
blockData={activeTabData}
isVisible={blockStyleVisible}
setIsVisible={(value) => {
setActiveTabId(null);
Expand All @@ -238,6 +239,17 @@ const TabsWidget = (props) => {
...(activeTabData.size ? { size: activeTabData.size } : {}),
}}
choices={[]}
onChangeBlock={(block, newData) => {
onChange(id, {
...value,
blocks: {
...value.blocks,
[activeTabId]: {
...newData,
},
},
});
}}
onChangeValue={(styleId, styleValue) =>
onChange(id, {
...value,
Expand Down

0 comments on commit 0179dd8

Please sign in to comment.