diff --git a/packages/block-library/src/column/block.json b/packages/block-library/src/column/block.json index 826b916811cadc..44ef3438b2344a 100644 --- a/packages/block-library/src/column/block.json +++ b/packages/block-library/src/column/block.json @@ -17,7 +17,7 @@ "type": "array" }, "templateLock": { - "type": "string", + "type": [ "string", "boolean" ], "enum": [ "all", "insert", false ] } }, diff --git a/packages/block-library/src/cover/block.json b/packages/block-library/src/cover/block.json index cac312ec13386c..aa00d403411f8b 100644 --- a/packages/block-library/src/cover/block.json +++ b/packages/block-library/src/cover/block.json @@ -67,7 +67,7 @@ "type": "array" }, "templateLock": { - "type": "string", + "type": [ "string", "boolean" ], "enum": [ "all", "insert", false ] } }, diff --git a/packages/block-library/src/group/block.json b/packages/block-library/src/group/block.json index c10790d28c427c..d34729441d09e8 100644 --- a/packages/block-library/src/group/block.json +++ b/packages/block-library/src/group/block.json @@ -12,7 +12,7 @@ "default": "div" }, "templateLock": { - "type": "string", + "type": [ "string", "boolean" ], "enum": [ "all", "insert", false ] } }, diff --git a/packages/blocks/src/api/parser/test/get-block-attributes.js b/packages/blocks/src/api/parser/test/get-block-attributes.js index 727f052a54c803..7b48db67fdb940 100644 --- a/packages/blocks/src/api/parser/test/get-block-attributes.js +++ b/packages/blocks/src/api/parser/test/get-block-attributes.js @@ -222,6 +222,22 @@ describe( 'attributes parsing', () => { expect( value ).toBe( 10 ); } ); + it( 'should return the comment attribute value when using multiple types', () => { + const value = getBlockAttribute( + 'templateLock', + { + type: [ 'string', 'boolean' ], + enum: [ 'all', 'insert', false ], + }, + '', + { + templateLock: false, + } + ); + + expect( value ).toBe( false ); + } ); + it( 'should reject type-invalid value, with default', () => { const value = getBlockAttribute( 'number',