-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Global Styles: Use context when translating entries in theme.json (#2…
- Loading branch information
Showing
3 changed files
with
95 additions
and
31 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
<?php | ||
|
||
/** | ||
* Test WP_Theme_JSON_Resolver class. | ||
* | ||
* @package Gutenberg | ||
*/ | ||
|
||
class WP_Theme_JSON_Resolver_Test extends WP_UnitTestCase { | ||
|
||
function test_presets_are_extracted() { | ||
$actual = WP_Theme_JSON_Resolver::get_presets_to_translate(); | ||
|
||
$expected = array( | ||
array( | ||
'path' => array( 'settings', '*', 'typography', 'fontSizes' ), | ||
'key' => 'name', | ||
'context' => 'Font size name', | ||
), | ||
array( | ||
'path' => array( 'settings', '*', 'typography', 'fontStyles' ), | ||
'key' => 'name', | ||
'context' => 'Font style name', | ||
), | ||
array( | ||
'path' => array( 'settings', '*', 'typography', 'fontWeights' ), | ||
'key' => 'name', | ||
'context' => 'Font weight name', | ||
), | ||
array( | ||
'path' => array( 'settings', '*', 'typography', 'fontFamilies' ), | ||
'key' => 'name', | ||
'context' => 'Font family name', | ||
), | ||
array( | ||
'path' => array( 'settings', '*', 'typography', 'textTransforms' ), | ||
'key' => 'name', | ||
'context' => 'Text transform name', | ||
), | ||
array( | ||
'path' => array( 'settings', '*', 'typography', 'textDecorations' ), | ||
'key' => 'name', | ||
'context' => 'Text decoration name', | ||
), | ||
array( | ||
'path' => array( 'settings', '*', 'color', 'palette' ), | ||
'key' => 'name', | ||
'context' => 'Color name', | ||
), | ||
array( | ||
'path' => array( 'settings', '*', 'color', 'gradients' ), | ||
'key' => 'name', | ||
'context' => 'Gradient name', | ||
), | ||
); | ||
|
||
$this->assertEquals( $expected, $actual ); | ||
} | ||
} |