Skip to content
Merged
Changes from 1 commit
Commits
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
Integration Test helpers - Expand pasteIntoRichText to support passin…
…g files as a parameter
  • Loading branch information
Gerardo committed Jun 3, 2024
commit 4d3f9aff597f9f10c46626d474837593268f3f78
13 changes: 7 additions & 6 deletions test/native/integration-test-helpers/rich-text-paste.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,20 @@ import { fireEvent } from '@testing-library/react-native';
/**
* Paste content into a RichText component.
*
* @param {import('react-test-renderer').ReactTestInstance} richText RichText test instance.
* @param {Object} content Content to paste.
* @param {string} content.text Text format of the content.
* @param {string} [content.html] HTML format of the content. If not provided, text format will be used.
* @param {import('react-test-renderer').ReactTestInstance} richText RichText test instance.
* @param {Object} content Content to paste.
* @param {string} content.text Text format of the content.
* @param {string} [content.html] HTML format of the content. If not provided, text format will be used.
* @param {string} [content.files] Files array to add to the editor.
*/
export const pasteIntoRichText = ( richText, { text, html } ) => {
export const pasteIntoRichText = ( richText, { text, html, files = [] } ) => {
fireEvent( richText, 'focus' );
fireEvent( richText, 'paste', {
preventDefault: jest.fn(),
nativeEvent: {
eventCount: 1,
target: undefined,
files: [],
files,
pastedHtml: html || text,
pastedText: text,
},
Expand Down