PluginProbe
Extendify / 3.0.6
Extendify v3.0.6
3.2.1 3.2.0 3.1.6 3.1.5 3.1.4 3.1.3 3.1.2 3.1.1 3.1.0 3.0.6 3.0.5 3.0.4 trunk 0.1.0 0.10.0 0.10.1 0.10.2 0.11.0 0.11.1 0.2.0 0.3.0 0.3.1 0.4.0 0.5.0 0.6.0 All 127 releases
extendify / src / Launch / lib / __tests__ / blocks.test.js

blocks.test.js in Extendify 3.0.6, at src/Launch/lib/__tests__/blocks.test.js

24 lines 805 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 import { addIdAttributeToBlock } from '@launch/lib/blocks';
2
3 describe('addIdAttributeToBlock', () => {
4 const blockCode = '<div class="wp-block-group something">Content</div>';
5
6 it('adds id attribute to block with wp-block-group class', () => {
7 const result = addIdAttributeToBlock(blockCode, 'test-id');
8 expect(result).toContain('id="test-id"');
9 });
10
11 it('does not break other parts of the HTML', () => {
12 const result = addIdAttributeToBlock(blockCode, 'unique-id');
13 expect(result).toContain(
14 '<div class="wp-block-group something" id="unique-id">',
15 );
16 });
17
18 it('does nothing if blockCode doesn’t match the expected pattern', () => {
19 const input = '<div class="something-else">Hello</div>';
20 const result = addIdAttributeToBlock(input, 'abc');
21 expect(result).toBe(input);
22 });
23 });
24