Skip to content

Commit

Permalink
Merge pull request #21 from eea/develop
Browse files Browse the repository at this point in the history
Release
  • Loading branch information
avoinea committed Sep 1, 2023
2 parents f4eba5b + f2bb8a6 commit 8847b07
Show file tree
Hide file tree
Showing 7 changed files with 117 additions and 2 deletions.
10 changes: 9 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,15 @@ 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).

### [3.0.6](https://github.com/eea/volto-block-toc/compare/3.0.5...3.0.6) - 28 August 2023
### [3.0.7](https://github.com/eea/volto-block-toc/compare/3.0.6...3.0.7) - 1 September 2023

#### :bug: Bug Fixes

- fix(test): increase coverage [kreafox - [`1c8a1f7`](https://github.com/eea/volto-block-toc/commit/1c8a1f705787a50a8ba36d56817b9ba17284a1dd)]
- fix(test): increase coverage [kreafox - [`ac76d57`](https://github.com/eea/volto-block-toc/commit/ac76d57349be3c8ebfcf761175cec81ead33bd19)]
- fix(toc): fix empty title [kreafox - [`dcf8f2c`](https://github.com/eea/volto-block-toc/commit/dcf8f2cc9a6e855ad2f32055438ec7db9c43b7a2)]

### [3.0.6](https://github.com/eea/volto-block-toc/compare/3.0.5...3.0.6) - 31 August 2023

#### :house: Documentation changes

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-block-toc",
"version": "3.0.6",
"version": "3.0.7",
"description": "volto-block-toc: Volto add-on",
"main": "src/index.js",
"author": "European Environment Agency: IDM2 A-Team",
Expand Down
18 changes: 18 additions & 0 deletions src/Block/DefaultTocRenderer.test.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import React from 'react';
import renderer from 'react-test-renderer';
import DefaultTocRenderer from './DefaultTocRenderer';

jest.mock('react-intl', () => ({
injectIntl: jest.fn((Component) => Component),
}));

describe('DefaultTocRenderer', () => {
it('renders correctly', () => {
const component = renderer.create(
<DefaultTocRenderer properties={{}} data={{ title: 'Heading title' }} />,
);
const json = component.toJSON();
expect(json).toMatchSnapshot();
expect(component).toMatchSnapshot();
});
});
18 changes: 18 additions & 0 deletions src/Block/HorizontalMenu.test.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import React from 'react';
import renderer from 'react-test-renderer';
import HorizontalMenu from './HorizontalMenu';

jest.mock('react-intl', () => ({
injectIntl: jest.fn((Component) => Component),
}));

describe('HorizontalMenu', () => {
it('renders correctly', () => {
const component = renderer.create(
<HorizontalMenu properties={{}} data={{ title: 'Heading title' }} />,
);
const json = component.toJSON();
expect(json).toMatchSnapshot();
expect(component).toMatchSnapshot();
});
});
1 change: 1 addition & 0 deletions src/Block/TocView.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ export const getBlocksTocEntries = (properties, tocData) => {
const level = entry[0];
const title = entry[1];
const items = [];
if (!title?.trim()) return;
if (!level || !levels.includes(level)) return;
tocEntriesLayout.push(i);
tocEntries[i] = {
Expand Down
25 changes: 25 additions & 0 deletions src/Block/__snapshots__/DefaultTocRenderer.test.jsx.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`DefaultTocRenderer renders correctly 1`] = `
Array [
<h2>
Heading title
</h2>,
<ul
className="ui bulleted list"
role="list"
/>,
]
`;

exports[`DefaultTocRenderer renders correctly 2`] = `
Array [
<h2>
Heading title
</h2>,
<ul
className="ui bulleted list"
role="list"
/>,
]
`;
45 changes: 45 additions & 0 deletions src/Block/__snapshots__/HorizontalMenu.test.jsx.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`HorizontalMenu renders correctly 1`] = `
Array [
<h2>
Heading title
</h2>,
<div
className=""
>
<div
style={Object {}}
/>
<div
className="ui sticky"
>
<div
className="ui menu"
/>
</div>
</div>,
]
`;

exports[`HorizontalMenu renders correctly 2`] = `
Array [
<h2>
Heading title
</h2>,
<div
className=""
>
<div
style={Object {}}
/>
<div
className="ui sticky"
>
<div
className="ui menu"
/>
</div>
</div>,
]
`;

0 comments on commit 8847b07

Please sign in to comment.