filament icon indicating copy to clipboard operation
filament copied to clipboard

[4.x] Create RichContentFaker class

Open awcodes opened this issue 2 months ago • 4 comments

Description

Adds a RichContentFaker class to allow for easier population of rich editor content in factories and tests.

Functional changes

  • [x] Code style has been fixed by running the composer cs command.
  • [x] Changes have been tested to not break existing functionality.
  • [x] Documentation is up-to-date.

awcodes avatar Oct 06 '25 19:10 awcodes

Do you want it tested against the renderer output or the content in the editor in the browser?

awcodes avatar Oct 07 '25 12:10 awcodes

Not sure what you mean? Tested against the output of the PHP function, no need for a browser test

danharrin avatar Oct 11 '25 19:10 danharrin

Maybe I'm just not clear on what you mean by "snapshot" test.

I'm my mind snapshot implies browser. But as long as the RichContentRender outputs the correct html or json/array I think that satisfies the test.

Am I wrong?

awcodes avatar Oct 11 '25 20:10 awcodes

It's not a screenshot, it stores text: https://pestphp.com/docs/snapshot-testing

danharrin avatar Oct 11 '25 21:10 danharrin

I'm not sure snapshot testing is going to work with this since each time the faker is called it would be different text, like in paragraphs which are using the $faker->paragraphs().

Wouldn't that cause the snapshot to fail every time?

awcodes avatar Dec 16 '25 23:12 awcodes