Skip to content

Commit f88405d

Browse files
committed
#558: Content Types Output Style Attribute Removal
- Fixing Integration Tests
1 parent 043b358 commit f88405d

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

app/code/Magento/PageBuilder/Setup/Converters/PageBuilderStripStyles.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class PageBuilderStripStyles implements DataConverterInterface
1919
{
2020
private const BODY_ID = 'html-body';
2121
private const DATA_ATTRIBUTE = 'data-pb-style';
22-
private const SELECTOR = '[style]';
22+
private const QUERY_SELECTOR = '[style]';
2323

2424
/**
2525
* @var HtmlDocumentFactory
@@ -69,7 +69,7 @@ public function convert($value): string
6969
{
7070
$document = $this->htmlDocumentFactory->create([ 'document' => $value ]);
7171
$body = $document->querySelector('body');
72-
$nodes = $document->querySelectorAll(self::SELECTOR);
72+
$nodes = $document->querySelectorAll(self::QUERY_SELECTOR);
7373

7474
if ($nodes->count() > 0) {
7575
$styleMap = [];

dev/tests/integration/testsuite/Magento/PageBuilder/Setup/Converters/PageBuilderStripStylesTest.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ public function conversionData(): array
9797
[
9898
// Basic CMS Content with Inline Style
9999
'<h1 style="color: #101020;">Magento, an Adobe Company</h1>',
100-
0
100+
1
101101
],
102102
[
103103
// Basic CMS Content with Existing Style
@@ -107,12 +107,12 @@ public function conversionData(): array
107107
[
108108
// Basic CMS Content with Inline/Existing Style
109109
'<h1 style="color: #101020;">Magento, an Adobe Company</h1><style>h1 { background-color: #dadada; }</style>',
110-
1
110+
2
111111
],
112112
[
113113
// Basic CMS Content with Inline/Existing Style (Unclosed)
114114
'<h1 style="color: #101020;">Magento, an Adobe Company<style>h1 { background-color: #dadada; }</style>',
115-
1
115+
2
116116
],
117117
[
118118
// Row
@@ -126,7 +126,7 @@ public function conversionData(): array
126126
],
127127
[
128128
// Text
129-
'<div data-content-type="row" data-appearance="contained" data-element="main"><div data-enable-parallax="0" data-parallax-speed="0.5" data-background-images="{}" data-background-type="image" data-video-loop="true" data-video-play-only-visible="true" data-video-lazy-load="true" data-video-fallback-src="" data-element="inner" style="justify-content: flex-start; display: flex; flex-direction: column; background-position: left top; background-size: cover; background-repeat: no-repeat; background-attachment: scroll; border-style: none; border-width: 1px; border-radius: 0px; margin: 0px 0px 10px; padding: 10px;"><div class="elephant news" data-content-type="text" data-appearance="default" data-element="main" style="text-align: left; border-style: none; border-width: 1px; border-radius: 0px; margin: 0px 0px 10px; padding: 10px 15px;">Text</div></div></div>',
129+
'<div data-content-type="row" data-appearance="contained" data-element="main"><div data-enable-parallax="0" data-parallax-speed="0.5" data-background-images="{}" data-background-type="image" data-video-loop="true" data-video-play-only-visible="true" data-video-lazy-load="true" data-video-fallback-src="" data-element="inner" style="justify-content: flex-start; display: flex; flex-direction: column; background-position: left top; background-size: cover; background-repeat: no-repeat; background-attachment: scroll; border-style: none; border-width: 1px; border-radius: 0px; margin: 0px 0px 10px; padding: 10px;"><div data-content-type="text" data-appearance="default" data-element="main" style="text-align: left; border-style: none; border-width: 1px; border-radius: 0px; margin: 0px 0px 10px; padding: 10px 15px;">Text</div></div></div>',
130130
1
131131
],
132132
[
@@ -182,7 +182,7 @@ public function conversionDataRaw(): array
182182
return [
183183
[
184184
// Text (Raw)
185-
'<div class="elephant news" data-content-type="text" data-appearance="default" data-element="main" style="text-align: left; border-style: none; border-width: 1px; border-radius: 0px; margin: 0px 0px 10px; padding: 10px 15px;">Text</div>',
185+
'<div data-content-type="text" data-appearance="default" data-element="main" style="text-align: left; border-style: none; border-width: 1px; border-radius: 0px; margin: 0px 0px 10px; padding: 10px 15px;">Text</div>',
186186
1
187187
],
188188
[

0 commit comments

Comments
 (0)