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

A few raw-handling API unit tests fail in the native test environment #55652

Open
fluiddot opened this issue Oct 26, 2023 · 2 comments
Open

A few raw-handling API unit tests fail in the native test environment #55652

fluiddot opened this issue Oct 26, 2023 · 2 comments
Labels
Mobile App - i.e. Android or iOS Native mobile impl of the block editor. (Note: used in scripts, ping mobile folks to change) [Type] Bug An existing feature does not function as intended

Comments

@fluiddot
Copy link
Contributor

fluiddot commented Oct 26, 2023

Description

The following unit tests of raw-handling API fail when running them in the native test environment:

We currently don't run them as part of the mobile unit test suite (reference), but it would be recommended as the logic covered is used in the content pasting functionality used in the native version.

const filters = [
googleDocsUIDRemover,
msListConverter,
headRemover,
listReducer,
imageCorrector,
phrasingContentReducer,
specialCommentConverter,
commentRemover,
iframeRemover,
figureContentReducer,
blockquoteNormaliser,
divNormaliser,
];
const schema = {
...blockContentSchema,
// Keep top-level phrasing content, normalised by `normaliseBlocks`.
...phrasingContentSchema,
};
piece = deepFilterHTML( piece, filters, blockContentSchema );
piece = removeInvalidHTML( piece, schema );
piece = normaliseBlocks( piece );
piece = deepFilterHTML(
piece,
[ htmlFormattingRemover, brRemover, emptyParagraphRemover ],
blockContentSchema
);
// Allows us to ask for this information when we get a report.
console.log( 'Processed HTML piece:\n\n', piece );

In fact, I found that three of them produce a crash in the editor (only referencing iOS issues but we should expect the same on Android):

Step-by-step reproduction instructions

⚠️ : When copying HTML into the editor, use the button ) located in the top-right corner of the HTML content in GitHub.

ms-list-converter

  1. Create/open a post in the app.
  2. Copy the following HTML content:
<p style="mso-list:l0 level1 lfo1"><span style="mso-list:Ignore">* </span>test</p>
  1. Paste the HTML content into a Paragraph block.
  2. Observe the crash.

special-comment-converter

  1. Create/open a post in the app.
  2. Copy the following HTML content:
<p><!--more--></p>
  1. Paste the HTML content into a Paragraph block.
  2. Observe the crash.

image-corrector

  1. Create/open a post in the app.
  2. Copy the following HTML content.
<div><img src="file:LOW-RES.png"></div>
  1. Paste the HTML content into a Paragraph block.
  2. Observe the crash.

Expected behaviour

  • raw-handling unit tests should pass when running them in the native test environment.
  • Pasting content into the editor shouldn't produce a crash.

Actual behaviour

  • A few of the raw-handling unit tests fail when running them in the native test environment.
  • Pasting content into the editor produces a crash in some cases.

Screenshots or screen recording (optional)

N/A

WordPress information

  • WordPress version: N/A
  • Gutenberg version: N/A
  • Are all plugins except Gutenberg deactivated? N/A
  • Are you using a default theme (e.g. Twenty Twenty-One)? N/A

Device information

  • Device: iPhone 15 (simulator)
  • Operating system: iOS 17.0
  • WordPress app version: 23.5
@fluiddot fluiddot added [Type] Bug An existing feature does not function as intended Mobile App - i.e. Android or iOS Native mobile impl of the block editor. (Note: used in scripts, ping mobile folks to change) labels Oct 26, 2023
@fluiddot
Copy link
Contributor Author

The unit tests related to ms-list-converter will be enabled via #56653.

@fluiddot
Copy link
Contributor Author

fluiddot commented Dec 4, 2023

ℹ️ Related to this issue, in #56723 we discovered that several test cases related to processing raw blocks fail in the native version. As part of resolving this issue, we should enable/uncomment the test cases from test/native/integration/blocks-raw-handling.native.js and provide fixes to address the failures.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Mobile App - i.e. Android or iOS Native mobile impl of the block editor. (Note: used in scripts, ping mobile folks to change) [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

No branches or pull requests

1 participant