-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Section Styles: Resolve ref values in variations data (#63172)
Co-authored-by: aaronrobertshaw <[email protected]> Co-authored-by: andrewserong <[email protected]> Co-authored-by: ramonjd <[email protected]> Co-authored-by: daviedR <[email protected]>
- Loading branch information
1 parent
6d3282e
commit 0aa455b
Showing
5 changed files
with
286 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
https://github.com/WordPress/wordpress-develop/pull/6989 | ||
|
||
* https://github.com/WordPress/gutenberg/pull/63172 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
91 changes: 91 additions & 0 deletions
91
packages/block-editor/src/hooks/test/get-variation-styles-with-ref-values.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
/** | ||
* Internal dependencies | ||
*/ | ||
import { getVariationStylesWithRefValues } from '../block-style-variation'; | ||
|
||
describe( 'getVariationStylesWithRefValues', () => { | ||
it( 'should resolve ref values correctly', () => { | ||
const globalStyles = { | ||
styles: { | ||
color: { background: 'red' }, | ||
blocks: { | ||
'core/heading': { | ||
color: { text: 'blue' }, | ||
}, | ||
'core/group': { | ||
variations: { | ||
custom: { | ||
color: { | ||
text: { ref: 'styles.does-not-exist' }, | ||
background: { | ||
ref: 'styles.color.background', | ||
}, | ||
}, | ||
blocks: { | ||
'core/heading': { | ||
color: { | ||
text: { | ||
ref: 'styles.blocks.core/heading.color.text', | ||
}, | ||
background: { ref: '' }, | ||
}, | ||
}, | ||
}, | ||
elements: { | ||
link: { | ||
color: { | ||
text: { | ||
ref: 'styles.elements.link.color.text', | ||
}, | ||
background: { ref: undefined }, | ||
}, | ||
':hover': { | ||
color: { | ||
text: { | ||
ref: 'styles.elements.link.:hover.color.text', | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
elements: { | ||
link: { | ||
color: { text: 'green' }, | ||
':hover': { | ||
color: { text: 'yellow' }, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}; | ||
|
||
expect( | ||
getVariationStylesWithRefValues( | ||
globalStyles, | ||
'core/group', | ||
'custom' | ||
) | ||
).toEqual( { | ||
color: { background: 'red' }, | ||
blocks: { | ||
'core/heading': { | ||
color: { text: 'blue' }, | ||
}, | ||
}, | ||
elements: { | ||
link: { | ||
color: { | ||
text: 'green', | ||
}, | ||
':hover': { | ||
color: { text: 'yellow' }, | ||
}, | ||
}, | ||
}, | ||
} ); | ||
} ); | ||
} ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
0aa455b
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Flaky tests detected in 0aa455b.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.
🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/9834040605
📝 Reported issues:
/test/e2e/specs/site-editor/font-library.spec.js