Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

autop: Include tests for removep functionality #15152

Closed
aduth opened this issue Apr 24, 2019 · 1 comment
Closed

autop: Include tests for removep functionality #15152

aduth opened this issue Apr 24, 2019 · 1 comment
Labels
Good First Issue An issue that's suitable for someone looking to contribute for the first time Needs Dev Ready for, and needs developer efforts [Package] Autop /packages/autop [Type] Automated Testing Testing infrastructure changes impacting the execution of end-to-end (E2E) and/or unit tests. [Type] Task Issues or PRs that have been broken down into an individual action to take

Comments

@aduth
Copy link
Member

aduth commented Apr 24, 2019

Previously: #15128 (comment)

As described at #15128 (comment), due to the method of porting and adapting autop and removep functions from previous core equivalent PHP and JavaScript implementations, there were no unit tests included for removep.

For historical context, the module originated as a direct port of the PHP implementation of autop, including its tests. There is no removep in PHP, so there are no tests. There was a previous removep implementation in JavaScript from which this implementation was adapted, but it had no tests to port over.

This function is notable due to its potential impact on content produced for posts consisting of legacy content (only containing the Classic block).

// For compatibility purposes, treat a post consisting of a single
// freeform block as legacy content and downgrade to a pre-block-editor
// removep'd content format.
const isSingleFreeformBlock = (
blocks.length === 1 &&
blocks[ 0 ].name === getFreeformContentHandlerName()
);
if ( isSingleFreeformBlock ) {
return removep( content );
}

Task: Add unit test coverage for the removep function.

@aduth aduth added [Type] Task Issues or PRs that have been broken down into an individual action to take Good First Issue An issue that's suitable for someone looking to contribute for the first time [Type] Automated Testing Testing infrastructure changes impacting the execution of end-to-end (E2E) and/or unit tests. [Package] Autop /packages/autop labels Apr 24, 2019
@gziolo gziolo added the Needs Dev Ready for, and needs developer efforts label Oct 21, 2019
@gziolo
Copy link
Member

gziolo commented May 18, 2020

Let's move it to the tracking issue that lists all public API functions in packages that don't contain unit tests and link back to this one.

@gziolo gziolo closed this as completed May 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Good First Issue An issue that's suitable for someone looking to contribute for the first time Needs Dev Ready for, and needs developer efforts [Package] Autop /packages/autop [Type] Automated Testing Testing infrastructure changes impacting the execution of end-to-end (E2E) and/or unit tests. [Type] Task Issues or PRs that have been broken down into an individual action to take
Projects
None yet
Development

No branches or pull requests

2 participants