Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Block variations: Add block-supports flag to add variation specific classname #61864

Open
wants to merge 41 commits into
base: trunk
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
6fe71ec
Block Variations: Add block-support for variation-specific classnames
ockham Jul 4, 2024
d42c4d1
Add new helpers
ockham Jul 4, 2024
1081fe4
Use new helpers
ockham Jul 8, 2024
6cd7199
Change attribute from class to className
ockham Jul 8, 2024
608bfd6
Fix variation attributes in test
ockham Jul 8, 2024
d9036b6
Fix variation attributes in test
ockham Jul 8, 2024
4de031b
Fix variation attributes in test
ockham Jul 8, 2024
b1bd36c
Remove redundant assertion
ockham Jul 8, 2024
3cb6023
Undo whitespace change
ockham Jul 8, 2024
e384ec7
Fix test
ockham Jul 8, 2024
5dce388
Fix other test
ockham Jul 8, 2024
e99838e
Fix more variation attributes in test
ockham Jul 8, 2024
cb9430a
Remove greedy flag from Regex
ockham Jul 8, 2024
b47cc1f
Update comment
ockham Jul 8, 2024
2bde392
Change test to make it more easily extensible
ockham Jul 8, 2024
1568b02
Absorb variation logic into addGeneratedClassName
ockham Jul 8, 2024
818af29
Reuse addGeneratedClassName
ockham Jul 8, 2024
b34a14e
Use shorthand
ockham Jul 8, 2024
8515de7
Simplify test
ockham Jul 8, 2024
2df5db7
More verbose schema descriptions
ockham Jul 8, 2024
d625240
Revert "Reuse addGeneratedClassName"
ockham Jul 8, 2024
faac58c
Replace slash with hyphen
ockham Jul 8, 2024
c8b9a6a
Add getBlockVariationClassName selector
ockham Jul 10, 2024
2b215d7
Use new selector
ockham Jul 10, 2024
0af2def
Update docs
ockham Jul 10, 2024
962a5ae
Missing comma
ockham Jul 10, 2024
173bef2
Add docs
ockham Jul 10, 2024
5cccab7
Change default to true
ockham Jul 10, 2024
cff8fcc
Fix variation default value in docs
ockham Jul 10, 2024
50a0044
typeof classNameSupport === 'boolean'
ockham Jul 23, 2024
0d34163
Backticks
ockham Jul 23, 2024
aaaa855
Bail early
ockham Jul 23, 2024
e819f54
Remove unnecessary export
ockham Jul 23, 2024
7cf6f8e
Add note that the getBlockDefaultClassName filter also affects variat…
ockham Jul 23, 2024
6ad4153
Remove unnecessary check for blockName
ockham Jul 23, 2024
bc3fb00
Add more notes on block default classname filter
ockham Jul 23, 2024
a37f5d3
Move description before type in schema
ockham Jul 23, 2024
25f7a71
toEqual -> toBe
ockham Sep 11, 2024
6f016b3
toEqual -> toBe
ockham Sep 11, 2024
d369a97
Use __ instead of - to append variation name
ockham Sep 12, 2024
7350ced
Missed one test
ockham Sep 17, 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
Fix variation attributes in test
  • Loading branch information
ockham committed Sep 12, 2024
commit 4de031b606d1f21a275f8ff5fc5a49a68fffd914
Original file line number Diff line number Diff line change
Expand Up @@ -95,22 +95,9 @@ describe( 'generated variation className', () => {
it( 'should not inject duplicates into className', () => {
const attributes = { fruit: 'Apples' };
const blockType = getBlockType( 'core/test-block' );
const variationBlockType = {
...blockType,
attributes: {
...blockType.attributes,
fruit: {
type: 'string',
default: 'Apples',
source: 'text',
selector: 'div',
},
},
isActive: ( { fruit } ) => fruit === 'Apples',
};
const extraProps = addSaveProps(
{ className: 'foo wp-block-test-block-variation' },
variationBlockType,
blockType,
attributes
);

Expand Down