diff --git a/dev/tests/integration/testsuite/Magento/PageBuilder/Setup/Converters/PageBuilderStripStylesTest.php b/dev/tests/integration/testsuite/Magento/PageBuilder/Setup/Converters/PageBuilderStripStylesTest.php new file mode 100644 index 00000000000..4dae20a3edb --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/PageBuilder/Setup/Converters/PageBuilderStripStylesTest.php @@ -0,0 +1,119 @@ +objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); + } + + /** + * ... + * + * @dataProvider conversionData + * @param string $htmlString + * @param string $expectedResult + */ + public function testConversion(string $htmlString, string $expectedResult) + { + $converterPageBuilderStripStyles = $this->objectManager->create(PageBuilderStripStyles::class); + $result = $converterPageBuilderStripStyles->convert($htmlString); + $this->assertEquals($result, $expectedResult); + } + + /** + * @return array + */ + public function conversionData(): array + { + // phpcs:disable Generic.Files.LineLength.TooLong + return [ + [ + // Row + '
', + '
' + ], + [ + // Column(s) + '
', + '
' + ], + [ + // Text (Raw) + '
Text
', + '
Text
' + ], + [ + // Text + '
Text
', + '
Text
' + ], + [ + // Heading (Raw) + '

Heading

', + '

Heading

' + ], + [ + // Heading + '

Heading

', + '

Heading

' + ], + [ + // Button (Raw) + '
Browse
', + '
Browse
' + ], + [ + // Button + '
Browse
', + '
Browse
' + ], + [ + // Buttons (Raw) + '
Cancel
OK
', + '
Cancel
OK
', + ], + [ + // Buttons + '
Cancel
OK
', + '
Cancel
OK
', + ], + [ + // Divider (Raw) + '

', + '

' + ], + [ + // Divider + '

', + '

' + ], + [ + // HTML Code (Raw) + '
<iframe allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen frameborder="0" height="315" src="https://www.youtube.com/embed/dQw4w9WgXcQ" style="display: block; opacity: 0.75;" width="560" ></iframe>
', + '
<iframe allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen frameborder="0" height="315" src="https://www.youtube.com/embed/dQw4w9WgXcQ" style="display: block; opacity: 0.75;" width="560" ></iframe>
' + ], + [ + // HTML Code + '
<iframe allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen frameborder="0" height="315" src="https://www.youtube.com/embed/dQw4w9WgXcQ" style="display: block; opacity: 0.75;" width="560" ></iframe>
', + '
<iframe allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen frameborder="0" height="315" src="https://www.youtube.com/embed/dQw4w9WgXcQ" style="display: block; opacity: 0.75;" width="560" ></iframe>
' + ] + ]; + // phpcs:enable Generic.Files.LineLength.TooLong + } +}