From c3be9e13f3285940114ed37641069ea243fcddd3 Mon Sep 17 00:00:00 2001 From: Sarah Rietkerk Date: Tue, 13 Feb 2024 14:40:06 -0800 Subject: [PATCH] specific comments exists now fails if no specific blocks exist --- .../code-validation/validateSpecificBlockCommentsExist.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pxteditor/code-validation/validateSpecificBlockCommentsExist.ts b/pxteditor/code-validation/validateSpecificBlockCommentsExist.ts index d044c1a3281b..377b1a44e733 100644 --- a/pxteditor/code-validation/validateSpecificBlockCommentsExist.ts +++ b/pxteditor/code-validation/validateSpecificBlockCommentsExist.ts @@ -9,5 +9,6 @@ export function validateSpecificBlockCommentsExist({ usedBlocks, blockType }: { } { const allSpecifcBlocks = usedBlocks.filter((block) => block.type === blockType); const uncommentedBlocks = allSpecifcBlocks.filter((block) => !block.getCommentText()); - return { uncommentedBlocks, passed: uncommentedBlocks.length === 0 }; + const passed = allSpecifcBlocks.length === 0 ? false : uncommentedBlocks.length === 0; + return { uncommentedBlocks, passed }; } \ No newline at end of file