diff --git a/src/Renderer/BreakpointStyle/BreakpointStyle.php b/src/Renderer/BreakpointStyle/BreakpointStyle.php index d1bd0b1..c1e94fd 100644 --- a/src/Renderer/BreakpointStyle/BreakpointStyle.php +++ b/src/Renderer/BreakpointStyle/BreakpointStyle.php @@ -25,8 +25,9 @@ final class BreakpointStyle public function __construct(Position $position, Banner $banner) { $selectorMask = sprintf( - '[data-amp-banner="%s"] [data-amp-content-breakpoint="%s"]', + '[data-amp-banner="%s"] [data-amp-banner-id="%s"] [data-amp-content-breakpoint="%s"]', Helpers::escapeHtmlAttr($position->getCode()), + Helpers::escapeHtmlAttr($banner->getId()), '%s', ); diff --git a/src/Renderer/Phtml/Templates/multiple.phtml b/src/Renderer/Phtml/Templates/multiple.phtml index 76c3601..7da1fa5 100644 --- a/src/Renderer/Phtml/Templates/multiple.phtml +++ b/src/Renderer/Phtml/Templates/multiple.phtml @@ -12,13 +12,14 @@ use SixtyEightPublishers\AmpClient\Renderer\Fingerprint; /** @var array $banners */ ?>
- 0 < count($banner->getContents())) ?> + 0 < count($banner->getContents())) ?>
+ data-amp-banner-fingerprint="" + data-amp-banner-id="getId()) ?>">
diff --git a/src/Renderer/Phtml/Templates/random.phtml b/src/Renderer/Phtml/Templates/random.phtml index 21c6143..79c39a0 100644 --- a/src/Renderer/Phtml/Templates/random.phtml +++ b/src/Renderer/Phtml/Templates/random.phtml @@ -14,7 +14,8 @@ use SixtyEightPublishers\AmpClient\Renderer\Fingerprint;
getContents())): ?>
+ data-amp-banner-fingerprint="" + data-amp-banner-id="getId()) ?>">
diff --git a/src/Renderer/Phtml/Templates/single.phtml b/src/Renderer/Phtml/Templates/single.phtml index 544f3b4..cb9422c 100644 --- a/src/Renderer/Phtml/Templates/single.phtml +++ b/src/Renderer/Phtml/Templates/single.phtml @@ -14,7 +14,8 @@ use SixtyEightPublishers\AmpClient\Renderer\Fingerprint;
getContents())): ?>
+ data-amp-banner-fingerprint="" + data-amp-banner-id="getId()) ?>">
diff --git a/tests/Renderer/BreakpointStyle/BreakpointStyleTest.php b/tests/Renderer/BreakpointStyle/BreakpointStyleTest.php index 65d6126..9c864e8 100644 --- a/tests/Renderer/BreakpointStyle/BreakpointStyleTest.php +++ b/tests/Renderer/BreakpointStyle/BreakpointStyleTest.php @@ -58,7 +58,7 @@ public function testStylesOutputInMinModeWhenOnlyContentWithNumericBreakpointDef ]); $expected = <<[data-amp-banner="homepage.top"] [data-amp-content-breakpoint="500"]{display:none}@media(min-width: 500px){[data-amp-banner="homepage.top"] [data-amp-content-breakpoint="500"]{display:block}} + HTML; Assert::same($expected, $style->getCss()); @@ -72,7 +72,7 @@ public function testStylesOutputInMaxModeWhenOnlyContentWithNumericBreakpointDef ]); $expected = <<[data-amp-banner="homepage.top"] [data-amp-content-breakpoint="500"]{display:none}@media(max-width: 500px){[data-amp-banner="homepage.top"] [data-amp-content-breakpoint="500"]{display:block}} + HTML; Assert::same($expected, $style->getCss()); @@ -88,7 +88,7 @@ public function testStylesOutputInMinModeWhenMultipleContentsDefined(): void ]); $expected = <<[data-amp-banner="homepage.top"] [data-amp-content-breakpoint="500"]{display:none}[data-amp-banner="homepage.top"] [data-amp-content-breakpoint="900"]{display:none}@media(min-width: 500px){[data-amp-banner="homepage.top"] [data-amp-content-breakpoint="default"]{display:none}[data-amp-banner="homepage.top"] [data-amp-content-breakpoint="500"]{display:block}[data-amp-banner="homepage.top"] [data-amp-content-breakpoint="900"]{display:none}}@media(min-width: 900px){[data-amp-banner="homepage.top"] [data-amp-content-breakpoint="default"]{display:none}[data-amp-banner="homepage.top"] [data-amp-content-breakpoint="500"]{display:none}[data-amp-banner="homepage.top"] [data-amp-content-breakpoint="900"]{display:block}} + HTML; Assert::same($expected, $style->getCss()); @@ -104,7 +104,7 @@ public function testStylesOutputInMaxModeWhenMultipleContentsDefined(): void ]); $expected = <<[data-amp-banner="homepage.top"] [data-amp-content-breakpoint="900"]{display:none}[data-amp-banner="homepage.top"] [data-amp-content-breakpoint="500"]{display:none}@media(max-width: 900px){[data-amp-banner="homepage.top"] [data-amp-content-breakpoint="default"]{display:none}[data-amp-banner="homepage.top"] [data-amp-content-breakpoint="900"]{display:block}[data-amp-banner="homepage.top"] [data-amp-content-breakpoint="500"]{display:none}}@media(max-width: 500px){[data-amp-banner="homepage.top"] [data-amp-content-breakpoint="default"]{display:none}[data-amp-banner="homepage.top"] [data-amp-content-breakpoint="900"]{display:none}[data-amp-banner="homepage.top"] [data-amp-content-breakpoint="500"]{display:block}} + HTML; Assert::same($expected, $style->getCss()); diff --git a/tests/resources/renderer/multiple/multipleBannersFullFeatured.html b/tests/resources/renderer/multiple/multipleBannersFullFeatured.html index 3a99d00..e0abc1c 100644 --- a/tests/resources/renderer/multiple/multipleBannersFullFeatured.html +++ b/tests/resources/renderer/multiple/multipleBannersFullFeatured.html @@ -1,7 +1,7 @@
-
+

Small content

@@ -19,9 +19,9 @@ Main 2 - +
-
+
Secondary 1 diff --git a/tests/resources/renderer/random/bannerWithBreakpointHtmlContentOnly.html b/tests/resources/renderer/random/bannerWithBreakpointHtmlContentOnly.html index dce30e1..16b12e2 100644 --- a/tests/resources/renderer/random/bannerWithBreakpointHtmlContentOnly.html +++ b/tests/resources/renderer/random/bannerWithBreakpointHtmlContentOnly.html @@ -1,8 +1,8 @@
-
+

My Awesome content!

- +
diff --git a/tests/resources/renderer/random/bannerWithBreakpointImageContentOnly.html b/tests/resources/renderer/random/bannerWithBreakpointImageContentOnly.html index a997274..e33c30b 100644 --- a/tests/resources/renderer/random/bannerWithBreakpointImageContentOnly.html +++ b/tests/resources/renderer/random/bannerWithBreakpointImageContentOnly.html @@ -1,10 +1,10 @@
-
+
Main 1 - +
diff --git a/tests/resources/renderer/random/bannerWithDefaultHtmlContentOnly.html b/tests/resources/renderer/random/bannerWithDefaultHtmlContentOnly.html index f0f5183..1703522 100644 --- a/tests/resources/renderer/random/bannerWithDefaultHtmlContentOnly.html +++ b/tests/resources/renderer/random/bannerWithDefaultHtmlContentOnly.html @@ -1,5 +1,5 @@
-
+

My Awesome content!

diff --git a/tests/resources/renderer/random/bannerWithDefaultImageContentOnly.withOptionalValues.html b/tests/resources/renderer/random/bannerWithDefaultImageContentOnly.withOptionalValues.html index 20d17cf..3c9c003 100644 --- a/tests/resources/renderer/random/bannerWithDefaultImageContentOnly.withOptionalValues.html +++ b/tests/resources/renderer/random/bannerWithDefaultImageContentOnly.withOptionalValues.html @@ -1,5 +1,5 @@
-
+
diff --git a/tests/resources/renderer/random/bannerWithDefaultImageContentOnly.withoutOptionalValues.html b/tests/resources/renderer/random/bannerWithDefaultImageContentOnly.withoutOptionalValues.html index 1dafb25..201ca9d 100644 --- a/tests/resources/renderer/random/bannerWithDefaultImageContentOnly.withoutOptionalValues.html +++ b/tests/resources/renderer/random/bannerWithDefaultImageContentOnly.withoutOptionalValues.html @@ -1,5 +1,5 @@
-
+
Main 1 diff --git a/tests/resources/renderer/random/bannerWithMultipleContents.html b/tests/resources/renderer/random/bannerWithMultipleContents.html index 58f2c84..cee2044 100644 --- a/tests/resources/renderer/random/bannerWithMultipleContents.html +++ b/tests/resources/renderer/random/bannerWithMultipleContents.html @@ -1,5 +1,5 @@
-
+

Small content

@@ -17,6 +17,6 @@ Main 2
- +
diff --git a/tests/resources/renderer/single/bannerWithBreakpointHtmlContentOnly.html b/tests/resources/renderer/single/bannerWithBreakpointHtmlContentOnly.html index 3fcab10..7cc5b55 100644 --- a/tests/resources/renderer/single/bannerWithBreakpointHtmlContentOnly.html +++ b/tests/resources/renderer/single/bannerWithBreakpointHtmlContentOnly.html @@ -1,8 +1,8 @@
-
+

My Awesome content!

- +
diff --git a/tests/resources/renderer/single/bannerWithBreakpointImageContentOnly.html b/tests/resources/renderer/single/bannerWithBreakpointImageContentOnly.html index d79ce76..d19ca9c 100644 --- a/tests/resources/renderer/single/bannerWithBreakpointImageContentOnly.html +++ b/tests/resources/renderer/single/bannerWithBreakpointImageContentOnly.html @@ -1,10 +1,10 @@
-
+
Main 1 - +
diff --git a/tests/resources/renderer/single/bannerWithDefaultHtmlContentOnly.html b/tests/resources/renderer/single/bannerWithDefaultHtmlContentOnly.html index 5b0f7a8..98c5f61 100644 --- a/tests/resources/renderer/single/bannerWithDefaultHtmlContentOnly.html +++ b/tests/resources/renderer/single/bannerWithDefaultHtmlContentOnly.html @@ -1,5 +1,5 @@
-
+

My Awesome content!

diff --git a/tests/resources/renderer/single/bannerWithDefaultImageContentOnly.withOptionalValues.html b/tests/resources/renderer/single/bannerWithDefaultImageContentOnly.withOptionalValues.html index c213650..15a6115 100644 --- a/tests/resources/renderer/single/bannerWithDefaultImageContentOnly.withOptionalValues.html +++ b/tests/resources/renderer/single/bannerWithDefaultImageContentOnly.withOptionalValues.html @@ -1,5 +1,5 @@
-
+
diff --git a/tests/resources/renderer/single/bannerWithDefaultImageContentOnly.withoutOptionalValues.html b/tests/resources/renderer/single/bannerWithDefaultImageContentOnly.withoutOptionalValues.html index fc6ae64..5e0fa0a 100644 --- a/tests/resources/renderer/single/bannerWithDefaultImageContentOnly.withoutOptionalValues.html +++ b/tests/resources/renderer/single/bannerWithDefaultImageContentOnly.withoutOptionalValues.html @@ -1,5 +1,5 @@
-
+
Main 1 diff --git a/tests/resources/renderer/single/bannerWithMultipleContents.html b/tests/resources/renderer/single/bannerWithMultipleContents.html index d63f743..bab5f20 100644 --- a/tests/resources/renderer/single/bannerWithMultipleContents.html +++ b/tests/resources/renderer/single/bannerWithMultipleContents.html @@ -1,5 +1,5 @@
-
+

Small content

@@ -17,6 +17,6 @@ Main 2
- +