Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
05755f3
Add clearer labels and context to BlockPatternsSyncFilter (#54838)
richtabor Oct 2, 2023
089c0a3
Font Library: use snake_case instead of camelCase on fontFamilies end…
matiasbenedetto Oct 2, 2023
020570d
Fix output of Navigation block classnames in the editor. (#54992)
tellthemachines Oct 3, 2023
5c01d3d
Block Editor: Avoid double-wrapping selectors when transforming the s…
Mamaduka Oct 3, 2023
f112f14
Don't display the navigation section in template parts details when a…
Mamaduka Oct 3, 2023
d36bd6d
Scripts: Properly use CommonJS for default Playwright config (#54988)
swissspidy Oct 3, 2023
283f4e7
Add template replace flow to template inspector (#54609)
scruffian Oct 3, 2023
fba6504
List View: Fix performance issue when selecting all blocks (#54900)
andrewserong Oct 4, 2023
2998442
Fix left and right aligmnent in children of Post Template (#54997)
tellthemachines Oct 4, 2023
e2eb0ab
Site Editor: Avoid stale navigation block values when parsing entity …
Mamaduka Oct 4, 2023
d11de67
Removed unwanted space from the string (#54654)
mujuonly Sep 23, 2023
3c227eb
Fix Deleted Navigation Menu warning string (#55033)
getdave Oct 4, 2023
aca3f6d
[Inserter]: Fix reset of registered media categories (#55012)
ntsekouras Oct 4, 2023
202a297
Try fixing the flaky 'Toolbar roving tabindex' e2e test (#54785)
Mamaduka Sep 26, 2023
fcb06c7
Fallback to Twitter provider when embedding X URLs (#54876)
fluiddot Sep 27, 2023
e790617
Based on the efforts in https://github.com/WordPress/gutenberg/pull/5…
ramonjd Sep 22, 2023
e93d348
Update pattern import menu item (#54782)
jameskoster Sep 26, 2023
baf1425
Image Block: Fix browser console error when clicking "Expand on Click…
t-hamano Sep 30, 2023
841537f
Patterns: Remove category description in inserter panel? (#54894)
aaronrobertshaw Oct 2, 2023
dac8a21
Media & Text: Fix React warning (#55038)
Mamaduka Oct 4, 2023
0c89d7e
Block Style: Display default style labels correctly in the block side…
t-hamano Oct 4, 2023
d0630d0
Site Editor: Do not display 'trashed' navigation menus in Sidebar (#5…
Mamaduka Oct 5, 2023
ae40d77
Image: Fix Lightbox display bug in Classic Themes. (#54837)
michalczaplinski Oct 5, 2023
11f6a6d
Latest Posts: add screen reader title text to Read more links and use…
ramonjd Oct 5, 2023
89f5e33
Fix Image block lightbox missing alt attribute and improve accessibil…
afercia Oct 6, 2023
9398b4a
Patterns: Add category selector to pattern creation modal (#55024)
glendaviesnz Oct 9, 2023
2e4bba1
Iframe: Fix positioning when dragging over an iframe (#55150)
andrewserong Oct 9, 2023
95e1f62
Site Editor: Fix template part area listing when a template has no ed…
Mamaduka Oct 9, 2023
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
Font Library: use snake_case instead of camelCase on fontFamilies end…
…point param (#54977)

* use snake_case instead of camelCase on endpoint param

* updating test
  • Loading branch information
matiasbenedetto authored and mikachan committed Oct 4, 2023
commit 089c0a393c418a5d0337a0250185c509e1233714
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public function register_routes() {
'callback' => array( $this, 'install_fonts' ),
'permission_callback' => array( $this, 'update_font_library_permissions_check' ),
'args' => array(
'fontFamilies' => array(
'font_families' => array(
'required' => true,
'type' => 'string',
'validate_callback' => array( $this, 'validate_install_font_families' ),
Expand Down Expand Up @@ -147,13 +147,13 @@ private function get_validation_errors( $font_families, $files ) {
$error_messages = array();

if ( ! is_array( $font_families ) ) {
$error_messages[] = __( 'fontFamilies should be an array of font families.', 'gutenberg' );
$error_messages[] = __( 'font_families should be an array of font families.', 'gutenberg' );
return $error_messages;
}

// Checks if there is at least one font family.
if ( count( $font_families ) < 1 ) {
$error_messages[] = __( 'fontFamilies should have at least one font family definition.', 'gutenberg' );
$error_messages[] = __( 'font_families should have at least one font family definition.', 'gutenberg' );
return $error_messages;
}

Expand Down Expand Up @@ -260,7 +260,7 @@ public function validate_install_font_families( $param, $request ) {
*/
public function uninstall_schema() {
return array(
'fontFamilies' => array(
'font_families' => array(
'type' => 'array',
'description' => __( 'The font families to install.', 'gutenberg' ),
'required' => true,
Expand Down Expand Up @@ -289,7 +289,7 @@ public function uninstall_schema() {
* @return WP_REST_Response|WP_Error Response object on success, or WP_Error object on failure.
*/
public function uninstall_fonts( $request ) {
$fonts_to_uninstall = $request->get_param( 'fontFamilies' );
$fonts_to_uninstall = $request->get_param( 'font_families' );

$errors = array();
$successes = array();
Expand Down Expand Up @@ -397,7 +397,7 @@ private function needs_write_permission( $font_families ) {
*/
public function install_fonts( $request ) {
// Get new fonts to install.
$fonts_param = $request->get_param( 'fontFamilies' );
$fonts_param = $request->get_param( 'font_families' );

/*
* As this is receiving form data, the font families are encoded as a string.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export async function fetchInstallFonts( data ) {

export async function fetchUninstallFonts( fonts ) {
const data = {
fontFamilies: fonts,
font_families: fonts,
};
const config = {
path: '/wp/v2/fonts',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,6 @@ export function makeFormDataFromFontFamilies( fontFamilies ) {
}
return family;
} );
formData.append( 'fontFamilies', JSON.stringify( newFontFamilies ) );
formData.append( 'font_families', JSON.stringify( newFontFamilies ) );
return formData;
}
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ describe( 'makeFormDataFromFontFamilies', () => {
fontFamily: 'Bebas',
},
];
expect( JSON.parse( formData.get( 'fontFamilies' ) ) ).toEqual(
expect( JSON.parse( formData.get( 'font_families' ) ) ).toEqual(
expectedFontFamilies
);
} );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class Tests_Fonts_WPRESTFontLibraryController_InstallFonts extends WP_REST_Font_
public function test_install_fonts( $font_families, $files, $expected_response ) {
$install_request = new WP_REST_Request( 'POST', '/wp/v2/fonts' );
$font_families_json = json_encode( $font_families );
$install_request->set_param( 'fontFamilies', $font_families_json );
$install_request->set_param( 'font_families', $font_families_json );
$install_request->set_file_params( $files );
$response = rest_get_server()->dispatch( $install_request );
$data = $response->get_data();
Expand Down Expand Up @@ -309,7 +309,7 @@ public function data_install_fonts() {
public function test_install_with_improper_inputs( $font_families, $files = array() ) {
$install_request = new WP_REST_Request( 'POST', '/wp/v2/fonts' );
$font_families_json = json_encode( $font_families );
$install_request->set_param( 'fontFamilies', $font_families_json );
$install_request->set_param( 'font_families', $font_families_json );
$install_request->set_file_params( $files );

$response = rest_get_server()->dispatch( $install_request );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public function set_up() {

$install_request = new WP_REST_Request( 'POST', '/wp/v2/fonts' );
$font_families_json = json_encode( $mock_families );
$install_request->set_param( 'fontFamilies', $font_families_json );
$install_request->set_param( 'font_families', $font_families_json );
rest_get_server()->dispatch( $install_request );
}

Expand All @@ -68,7 +68,7 @@ public function test_uninstall() {
);

$uninstall_request = new WP_REST_Request( 'DELETE', '/wp/v2/fonts' );
$uninstall_request->set_param( 'fontFamilies', $font_families_to_uninstall );
$uninstall_request->set_param( 'font_families', $font_families_to_uninstall );
$response = rest_get_server()->dispatch( $uninstall_request );
$this->assertSame( 200, $response->get_status(), 'The response status is not 200.' );
}
Expand All @@ -88,7 +88,7 @@ public function test_uninstall_non_existing_fonts() {
),
);

$uninstall_request->set_param( 'fontFamilies', $non_existing_font_data );
$uninstall_request->set_param( 'font_families', $non_existing_font_data );
$response = rest_get_server()->dispatch( $uninstall_request );
$data = $response->get_data();
$this->assertCount( 2, $data['errors'], 'The response should have 2 errors, one for each font family uninstall failure.' );
Expand Down