Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
78f9601
Pattern overrides: use block binding editing API
ellatrix May 9, 2024
17b31b8
Update only the needed attributes with bindings
SantosGuillamot May 9, 2024
63c6b6d
Keep blocks as normal when editing pattern
SantosGuillamot May 9, 2024
46063db
Use inner blocks for set edit mode
SantosGuillamot May 9, 2024
f1f78ae
Change indiviual reset logic
SantosGuillamot May 9, 2024
8121723
Move variable after early return
SantosGuillamot May 9, 2024
ec4daec
Add inline comment for bindings setAttributes
SantosGuillamot May 9, 2024
35aa0ab
Change variable to isOverriden
SantosGuillamot May 9, 2024
a71ba38
Change missing isOverriden
SantosGuillamot May 9, 2024
29afc1f
Fix detaching of synced patterns
SantosGuillamot May 9, 2024
31bf94c
Sync values of bound attributes
SantosGuillamot May 9, 2024
6c60eb3
Adapt synced pattern tests
SantosGuillamot May 9, 2024
49b062a
Use overriden values when detaching pattern
SantosGuillamot May 9, 2024
766a762
Adapt pattern-overrides tests
SantosGuillamot May 9, 2024
49286e1
Add workaround for pattern overrides
SantosGuillamot May 9, 2024
ef29ab3
Don't update non-bound attributes when using patterns
SantosGuillamot May 9, 2024
ba8b618
Add test for blocks with a shared name
SantosGuillamot May 9, 2024
e695fb4
Support button rel in bindings editor logic
SantosGuillamot May 9, 2024
d9d9fd6
Solve undo/redo issues
SantosGuillamot May 9, 2024
4a4465f
Stop using syncDerivedUpdates
SantosGuillamot May 9, 2024
1101667
Ensure change is marked as persistent in pattern overrides
SantosGuillamot May 9, 2024
a95749f
Try to solve undo/redo issues
SantosGuillamot May 9, 2024
e2a1b8a
Manage undefined attrs in pattern overrides
SantosGuillamot May 9, 2024
9d444a3
Remove `content` pattern property if empty
SantosGuillamot May 9, 2024
e28da53
Remove pattern-overrides specific code from `withBlockBindingSupport`…
talldan May 13, 2024
ae534d8
Fix persistent issues with setValues API
ellatrix May 13, 2024
4ec7315
Fall back to ''
ellatrix May 13, 2024
3a7311d
Make sure any previous changes are persisted before resetting.
ellatrix May 13, 2024
e013f6d
Add undo/redo test for resetting
kevin940726 May 13, 2024
950aab9
Fix test... 🤦
kevin940726 May 13, 2024
d99ecb7
Fix remaining undo test
ellatrix May 13, 2024
9ec9bba
Fix individual reset
ellatrix May 13, 2024
7d72a34
Add test for undoing loses the focus
kevin940726 May 13, 2024
4ebdb09
Fix reset button test
ellatrix May 13, 2024
44b51dd
Simplify pattern synced blocks test
SantosGuillamot May 13, 2024
5975f74
Remove focus test
SantosGuillamot May 13, 2024
10fa4e8
Use getBlockParentsByBlockName
SantosGuillamot May 14, 2024
3cfdd44
Add early return if blockName doesn't exist
SantosGuillamot May 14, 2024
8c5f574
Add comment for undefined values
SantosGuillamot May 14, 2024
3866446
Remove comment typo
SantosGuillamot May 14, 2024
33bfb86
Remove unnecessary includeHidden from tests
SantosGuillamot May 14, 2024
d80aba7
Check the frontend in patterns test
SantosGuillamot May 14, 2024
6b97321
Check frontend in updated pattern
SantosGuillamot May 14, 2024
c122b79
Stop using `getPatternRecord`
SantosGuillamot May 14, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Adapt pattern-overrides tests
  • Loading branch information
SantosGuillamot committed May 9, 2024
commit 766a762cf2d7f1154d83f8f906246a3a0e2daa5a
60 changes: 25 additions & 35 deletions test/e2e/specs/editor/various/pattern-overrides.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,8 @@ test.describe( 'Pattern Overrides', () => {
const paragraphs = patternBlocks.first().getByRole( 'document', {
name: 'Block: Paragraph',
} );
// Ensure the first pattern is selected.
await patternBlocks.first().selectText();
await expect( paragraphs.first() ).not.toHaveAttribute(
'inert',
'true'
Expand All @@ -164,6 +166,8 @@ test.describe( 'Pattern Overrides', () => {
await paragraphs.first().selectText();
await page.keyboard.type( 'I would word it this way' );

// Ensure the second pattern is selected.
await patternBlocks.last().selectText();
await patternBlocks
.last()
.getByRole( 'document', {
Expand Down Expand Up @@ -417,7 +421,7 @@ test.describe( 'Pattern Overrides', () => {

const postId = await editor.publishPost();

// Check it renders correctly.
// Check the pattern has the correct attributes.
await expect.poll( editor.getBlocks ).toMatchObject( [
{
name: 'core/block',
Expand All @@ -429,41 +433,22 @@ test.describe( 'Pattern Overrides', () => {
},
},
},
innerBlocks: [
{
name: 'core/heading',
attributes: { content: 'Outer heading (edited)' },
},
{
name: 'core/block',
attributes: {
ref: innerPattern.id,
content: {
[ paragraphName ]: {
content: 'Inner paragraph (edited)',
},
},
},
innerBlocks: [
{
name: 'core/paragraph',
attributes: {
content: 'Inner paragraph (edited)',
},
},
],
},
],
innerBlocks: [],
},
] );

await expect(
editor.canvas.getByRole( 'document', {
name: 'Block: Paragraph',
includeHidden: true,
} ),
'The inner paragraph should not be editable'
).toHaveAttribute( 'inert', 'true' );
// Check it renders correctly.
const headingBlock = editor.canvas.getByRole( 'document', {
name: 'Block: Heading',
includeHidden: true,
} );
const paragraphBlock = editor.canvas.getByRole( 'document', {
name: 'Block: Paragraph',
includeHidden: true,
} );
await expect( headingBlock ).toHaveText( 'Outer heading (edited)' );
await expect( headingBlock ).not.toHaveAttribute( 'inert', 'true' );
await expect( paragraphBlock ).toHaveText( 'Inner paragraph (edited)' );
await expect( paragraphBlock ).toHaveAttribute( 'inert', 'true' );

// Edit the outer pattern.
await editor.selectBlocks(
Expand All @@ -478,11 +463,16 @@ test.describe( 'Pattern Overrides', () => {
.click();

// The inner paragraph should be editable in the pattern focus mode.
await editor.selectBlocks(
editor.canvas
.getByRole( 'document', { name: 'Block: Pattern' } )
.first()
);
await expect(
editor.canvas.getByRole( 'document', {
name: 'Block: Paragraph',
} ),
'The inner paragraph should not be editable'
'The inner paragraph should be editable'
).not.toHaveAttribute( 'inert', 'true' );

// Visit the post on the frontend.
Expand Down