Skip to content

Commit 6a80c82

Browse files
committed
Fix issue with hook steps not being rendered (#379)
1 parent 76288ef commit 6a80c82

File tree

4 files changed

+12
-11
lines changed

4 files changed

+12
-11
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/)
66
and this project adheres to [Semantic Versioning](http://semver.org/).
77

88
## [Unreleased]
9+
### Fixed
10+
- Fix issue with hook steps not being rendered ([#379](https://github.com/cucumber/react-components/pull/379))
911

1012
## [22.4.1] - 2025-03-30
1113
### Fixed

src/components/gherkin/HookStep.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ const DefaultRenderer: React.FunctionComponent<HookStepProps> = ({ step }) => {
3939
)
4040
}
4141

42-
if (attachments) {
42+
if (attachments?.length) {
4343
return (
4444
<StepItem>
4545
{attachments.map((attachment, i) => (

src/components/gherkin/HookSteps.tsx

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,11 @@ interface IProps {
1010
export const HookSteps: React.FunctionComponent<IProps> = ({ hookSteps }) => {
1111
return (
1212
<>
13-
{hookSteps
14-
.map((step, index) => <HookStep key={index} step={step} />)
15-
.filter((el) => !!el.props.children?.length)
16-
.map((el, index) => (
17-
<li key={index}>{el}</li>
18-
))}
13+
{hookSteps.map((step, index) => (
14+
<li key={index}>
15+
<HookStep key={index} step={step} />
16+
</li>
17+
))}
1918
</>
2019
)
2120
}
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
.steps {
22
padding: 0;
3-
margin: 1em;
3+
margin: 0.875em 1em;
44

55
> li {
66
list-style: none;
7-
}
87

9-
> li + li {
10-
margin-top: 0.25em;
8+
&:not(:empty) {
9+
padding: 0.125em 0;
10+
}
1111
}
1212
}

0 commit comments

Comments
 (0)