@@ -3651,6 +3651,35 @@ Feature: Generate a POT file of a WordPress project
36513651 msgid "Black"
36523652 """
36533653
3654+ Scenario : Skips theme.json file if excluding it
3655+ Given an empty foo-theme directory
3656+ And a foo-theme/theme.json file:
3657+ """
3658+ {
3659+ "version": "1",
3660+ "settings": {
3661+ "color": {
3662+ "palette": [
3663+ { "slug": "black", "color": "#000000", "name": "Black" }
3664+ ]
3665+ }
3666+ }
3667+ }
3668+ """
3669+
3670+ When I try `wp i18n make-pot foo-theme --exclude=theme.json`
3671+ Then STDOUT should be:
3672+ """
3673+ Success: POT file successfully generated.
3674+ """
3675+ And the foo-theme/foo-theme.pot file should exist
3676+ But the foo-theme/foo-theme.pot file should not contain:
3677+ """
3678+ msgctxt "Color name"
3679+ msgid "Black"
3680+ """
3681+
3682+
36543683 Scenario : Extract strings from the top-level section of theme.json files
36553684 Given an empty foo-theme directory
36563685 And a foo-theme/theme.json file:
@@ -3756,7 +3785,13 @@ Feature: Generate a POT file of a WordPress project
37563785 """
37573786
37583787 Scenario : Extract strings from style variations
3759- Given an empty foo-theme/styles directory
3788+ Given an empty foo-theme directory
3789+ And a foo-theme/style.css file:
3790+ """
3791+ /*
3792+ Theme Name: foo theme
3793+ */
3794+ """
37603795 And a foo-theme/styles/my-style.json file:
37613796 """
37623797 {
@@ -3774,7 +3809,7 @@ Feature: Generate a POT file of a WordPress project
37743809 }
37753810 }
37763811 """
3777- And a foo-theme/incorrect/ styles/my-style .json file:
3812+ And a foo-theme/styles/deeply/nested/variation .json file:
37783813 """
37793814 {
37803815 "version": "1",
@@ -3791,9 +3826,26 @@ Feature: Generate a POT file of a WordPress project
37913826 }
37923827 }
37933828 """
3829+ And a foo-theme/incorrect/styles/my-style.json file:
3830+ """
3831+ {
3832+ "version": "1",
3833+ "settings": {
3834+ "blocks": {
3835+ "core/paragraph": {
3836+ "color": {
3837+ "palette": [
3838+ { "slug": "red", "color": "#ff00000", "name": "Red" }
3839+ ]
3840+ }
3841+ }
3842+ }
3843+ }
3844+ }
3845+ """
37943846
37953847 When I try `wp i18n make-pot foo-theme`
3796- Then STDOUT should be :
3848+ Then STDOUT should contain :
37973849 """
37983850 Success: POT file successfully generated.
37993851 """
@@ -3803,10 +3855,15 @@ Feature: Generate a POT file of a WordPress project
38033855 msgctxt "Color name"
38043856 msgid "Black"
38053857 """
3806- And the foo-theme/foo-theme.pot file should not contain:
3858+ And the foo-theme/foo-theme.pot file should contain:
38073859 """
3860+ msgctxt "Color name"
38083861 msgid "White"
38093862 """
3863+ And the foo-theme/foo-theme.pot file should not contain:
3864+ """
3865+ msgid "Red"
3866+ """
38103867
38113868 Scenario : Extract strings from the patterns directory
38123869 Given an empty foo-theme/patterns directory
@@ -3972,3 +4029,71 @@ Feature: Generate a POT file of a WordPress project
39724029 """
39734030 msgid "foo-plugin/longertests/foo-plugin.php"
39744031 """
4032+
4033+ Scenario : Extract strings from theme.json files in any level
4034+ Given an empty foo-project directory
4035+ And a foo-project/theme.json file:
4036+ """
4037+ {
4038+ "version": "1",
4039+ "title": "My style variation",
4040+ "description": "My style variation description"
4041+ }
4042+ """
4043+
4044+ And a foo-project/nested/theme.json file:
4045+ """
4046+ {
4047+ "version": "1",
4048+ "title": "Nested style variation",
4049+ "description": "Nested style variation description"
4050+ }
4051+ """
4052+
4053+ And a foo-project/nested/notatheme.json file:
4054+ """
4055+ {
4056+ "version": "1",
4057+ "title": "Not extracted style variation",
4058+ "description": "Not extracted style variation description"
4059+ }
4060+ """
4061+
4062+ When I try `wp i18n make-pot foo-project`
4063+ Then STDOUT should be:
4064+ """
4065+ Success: POT file successfully generated.
4066+ """
4067+ And the foo-project/foo-project.pot file should exist
4068+ And the foo-project/foo-project.pot file should contain:
4069+ """
4070+ #: theme.json
4071+ msgctxt "Style variation name"
4072+ msgid "My style variation"
4073+ """
4074+ And the foo-project/foo-project.pot file should contain:
4075+ """
4076+ #: theme.json
4077+ msgctxt "Style variation description"
4078+ msgid "My style variation description"
4079+ """
4080+ And the foo-project/foo-project.pot file should contain:
4081+ """
4082+ #: nested/theme.json
4083+ msgctxt "Style variation name"
4084+ msgid "Nested style variation"
4085+ """
4086+ And the foo-project/foo-project.pot file should contain:
4087+ """
4088+ #: nested/theme.json
4089+ msgctxt "Style variation description"
4090+ msgid "Nested style variation description"
4091+ """
4092+ And the foo-project/foo-project.pot file should not contain:
4093+ """
4094+ msgid "Not extract style variation"
4095+ """
4096+ And the foo-project/foo-project.pot file should not contain:
4097+ """
4098+ msgid "Not extracted style variation description"
4099+ """
0 commit comments