Skip to content

Commit

Permalink
prep build 04/09
Browse files Browse the repository at this point in the history
  • Loading branch information
bph committed Apr 9, 2023
2 parents 37ad075 + 7810f7b commit 78c0709
Show file tree
Hide file tree
Showing 8 changed files with 44 additions and 9 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ coverage
.phpunit.result.cache
.reassure


# Directories/files that may appear in your environment
*.log
yarn.lock
Expand Down Expand Up @@ -37,6 +38,7 @@ test/native/junit.xml

# Local overrides
.wp-env.override.json
playwright.config.override.ts
phpcs.xml
phpunit.xml
phpunit-watcher.yml
Expand Down
24 changes: 24 additions & 0 deletions packages/block-library/src/gallery/test/use-get-media.native.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/**
* External dependencies
*/
import { render } from 'test/helpers';

/**
* Internal dependencies
*/
import useGetMedia from '../use-get-media';

describe( 'useGetMedia', () => {
// TODO: Explore why a Gallery block would ever be without inner blocks.
// This test and the associated default function parameter might be unnecessary.
it( 'should not error when receiving zero images', () => {
// Arrange
const TestSubject = () => {
useGetMedia( undefined );
return null;
};

// Assert
expect( () => render( <TestSubject /> ) ).not.toThrow();
} );
} );
2 changes: 1 addition & 1 deletion packages/block-library/src/gallery/use-get-media.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const EMPTY_IMAGE_MEDIA = [];
*
* @return {Array} An array of media info options for each gallery image.
*/
export default function useGetMedia( innerBlockImages ) {
export default function useGetMedia( innerBlockImages = [] ) {
return useSelect(
( select ) => {
const imagesUploading = innerBlockImages.some(
Expand Down
6 changes: 3 additions & 3 deletions packages/block-library/src/post-excerpt/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ function render_block_core_post_excerpt( $attributes, $content, $block ) {
* wp_trim_words is used instead.
*/
$excerpt_length = $attributes['excerptLength'];
$excerpt = get_the_excerpt( $block->context['postId'] );
if ( isset( $excerpt_length ) ) {
$excerpt = wp_trim_words( get_the_excerpt(), $excerpt_length );
} else {
$excerpt = get_the_excerpt();
$excerpt = wp_trim_words( $excerpt, $excerpt_length );
}

$more_text = ! empty( $attributes['moreText'] ) ? '<a class="wp-block-post-excerpt__more-link" href="' . esc_url( get_the_permalink( $block->context['postId'] ) ) . '">' . wp_kses_post( $attributes['moreText'] ) . '</a>' : '';
$filter_excerpt_more = function( $more ) use ( $more_text ) {
return empty( $more_text ) ? $more : '';
Expand Down
6 changes: 5 additions & 1 deletion packages/blocks/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -911,6 +911,10 @@ _Parameters_
Assigns name of block for handling block grouping interactions.
This function lets you select a different block to group other blocks in instead of the
default `core/group` block. This function must be used in a component or when the DOM is fully
loaded. See <https://developer.wordpress.org/block-editor/reference-guides/packages/packages-dom-ready/>
_Usage_
```js
Expand All @@ -919,7 +923,7 @@ import { setGroupingBlockName } from '@wordpress/blocks';
const ExampleComponent = () => {
return (
<Button onClick={ () => setGroupingBlockName( 'core/columns' ) }>
{ __( 'Set the default block to Heading' ) }
{ __( 'Wrap in columns' ) }
</Button>
);
};
Expand Down
6 changes: 5 additions & 1 deletion packages/blocks/src/api/registration.js
Original file line number Diff line number Diff line change
Expand Up @@ -523,6 +523,10 @@ export function setDefaultBlockName( name ) {
/**
* Assigns name of block for handling block grouping interactions.
*
* This function lets you select a different block to group other blocks in instead of the
* default `core/group` block. This function must be used in a component or when the DOM is fully
* loaded. See https://developer.wordpress.org/block-editor/reference-guides/packages/packages-dom-ready/
*
* @param {string} name Block name.
*
* @example
Expand All @@ -533,7 +537,7 @@ export function setDefaultBlockName( name ) {
*
* return (
* <Button onClick={ () => setGroupingBlockName( 'core/columns' ) }>
* { __( 'Set the default block to Heading' ) }
* { __( 'Wrap in columns' ) }
* </Button>
* );
* };
Expand Down
3 changes: 2 additions & 1 deletion packages/react-native-editor/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ For each user feature we should also add a importance categorization label to i
-->

## Unreleased
- [*] Support POST requests [#49371]
- [*] Support POST requests [#49371]
- [*] Avoid empty Gallery block error [#49557]

## 1.92.0
* No User facing changes *
Expand Down
4 changes: 2 additions & 2 deletions packages/scripts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -416,8 +416,8 @@ This is how you execute those scripts using the presented setup:

- `npm run test:e2e` - runs all e2e tests.
- `npm run test:e2e:help` - prints all available options to configure e2e test runner.
- `npm run test-e2e -- --puppeteer-interactive` - runs all e2e tests interactively.
- `npm run test-e2e FILE_NAME -- --puppeteer-interactive` - runs one test file interactively.
- `npm run test:e2e -- --puppeteer-interactive` - runs all e2e tests interactively.
- `npm run test:e2e FILE_NAME -- --puppeteer-interactive` - runs one test file interactively.
- `npm run test:e2e:watch -- --puppeteer-interactive` - runs all tests interactively and watch for changes.
- `npm run test:e2e:debug` - runs all tests interactively and enables [debugging tests](#debugging-e2e-tests).

Expand Down

0 comments on commit 78c0709

Please sign in to comment.