Skip to content

Commit d489778

Browse files
authored
Fix code block creation without block ID (#41)
1 parent 57024db commit d489778

3 files changed

Lines changed: 12 additions & 1 deletion

File tree

src/Blocks/Virtual/VirtualBlock.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ public function getIterator(): Traversable
2626
{
2727
$blocks = parent::getIterator();
2828
if ($this->blockId === null) {
29-
return $blocks;
29+
yield from $blocks;
30+
return;
3031
}
3132

3233
$index = 1;

tests/Functional/CreateTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,9 @@ public function testCreatedVirtualComponentsMatchExpectedOutputJson(): void
8282
my code
8383
CODE,
8484
),
85+
Kit::codeBlock(
86+
code: 'Code block without blockId'
87+
)
8588
],
8689
);
8790

tests/Functional/assets/create/virtual-blocks.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,13 @@
7171
"type": "mrkdwn",
7272
"text": "```\nThis is\nmy code\n```"
7373
}
74+
},
75+
{
76+
"type": "section",
77+
"text": {
78+
"type": "mrkdwn",
79+
"text": "```\nCode block without blockId\n```"
80+
}
7481
}
7582
]
7683
}

0 commit comments

Comments
 (0)