@@ -104,6 +104,9 @@ public function testCorporateFooterRendering(): void {
104104 // Site owner is not set yet, let's make sure we don't have a description.
105105 $ assert ->elementNotExists ('css ' , 'div.ecl-site-footer__description ' );
106106
107+ // The subscribe action button is not rendered without a subscribe link.
108+ $ assert ->elementNotExists ('css ' , 'footer.ecl-site-footer a.ecl-site-footer__action-button ' );
109+
107110 $ section = $ assert ->elementExists ('css ' , 'footer.ecl-site-footer div.ecl-site-footer__row--specific div.ecl-site-footer__section--core ' );
108111 foreach (array_values ($ ec_core_links ) as $ key => $ expected ) {
109112 $ index = $ key + 1 ;
@@ -120,13 +123,20 @@ public function testCorporateFooterRendering(): void {
120123 $ this ->assertListLink ($ actual , $ expected );
121124 }
122125
126+ // Set a subscribe link in the corporate site information settings.
127+ $ this ->configFactory ->getEditable ('oe_corporate_site_info.settings ' )->set ('subscribe ' , 'https://example.com/subscribe ' )->save ();
128+
123129 // Update settings, assert footer changed.
124130 $ this ->updateSiteSettings (['http://publications.europa.eu/resource/authority/corporate-body/ACP-EU_JA ' ], 'EC Site Name ' );
125131 $ this ->drupalGet ('<front> ' );
126132
127133 $ actual = $ assert ->elementExists ('css ' , 'div.ecl-site-footer__description ' );
128134 $ this ->assertEquals ('This site is managed by:ACP–EU Joint Assembly ' , $ actual ->getText ());
129135
136+ // Assert the subscribe action button in the site info section.
137+ $ section = $ assert ->elementExists ('css ' , 'footer.ecl-site-footer div.ecl-site-footer__row--specific div.ecl-site-footer__section--site-info ' );
138+ $ this ->assertSubscribeActionButton ($ section , 'secondary-inverted ' , 'https://example.com/subscribe ' );
139+
130140 // Test European Commission footer standardised block rendering.
131141 $ this ->branding = 'standardised ' ;
132142 $ this ->configFactory ->getEditable ('oe_theme.settings ' )->set ('branding ' , $ this ->branding )->save ();
@@ -154,6 +164,9 @@ public function testCorporateFooterRendering(): void {
154164 $ actual = $ section ->find ('css ' , 'div.ecl-site-footer__description ' );
155165 $ this ->assertEquals ('This site is managed by:ACP–EU Joint Assembly ' , $ actual ->getText ());
156166
167+ // Assert the subscribe action button in the site info section.
168+ $ this ->assertSubscribeActionButton ($ section , 'secondary-inverted ' , 'https://example.com/subscribe ' );
169+
157170 $ section = $ assert ->elementExists ('css ' , 'footer.ecl-site-footer div.ecl-site-footer__row--common ' );
158171 // Assert presence of ecl logo in the standardised footer.
159172 $ this ->assertEclLogoPresence ($ section );
@@ -240,6 +253,9 @@ public function testCorporateFooterRendering(): void {
240253 // Assert presence of ecl logo in the core footer.
241254 $ this ->assertEclLogoPresence ($ section );
242255
256+ // Assert the subscribe action button in the site info section.
257+ $ this ->assertSubscribeActionButton ($ section , 'secondary-neutral ' , 'https://example.com/subscribe ' );
258+
243259 $ column = $ assert ->elementExists ('css ' , 'footer.ecl-site-footer div.ecl-site-footer__column:nth-child(2) ' );
244260 $ subsection = $ assert ->elementExists ('css ' , '.ecl-site-footer__section:nth-child(1) ' , $ column );
245261
@@ -332,6 +348,9 @@ public function testCorporateFooterRendering(): void {
332348 $ this ->assertEquals ('Accessibility ' , $ actual ->getText ());
333349 $ this ->assertEquals ('/build/ ' , $ actual ->getAttribute ('href ' ));
334350
351+ // Assert the subscribe action button in the site info section.
352+ $ this ->assertSubscribeActionButton ($ section , 'secondary-neutral ' , 'https://example.com/subscribe ' );
353+
335354 $ section = $ assert ->elementExists ('css ' , 'footer.ecl-site-footer div.ecl-site-footer__row:nth-child(2) div.ecl-site-footer__column:nth-child(1) div.ecl-site-footer__section:nth-child(1) ' );
336355
337356 $ actual = $ section ->find ('css ' , 'div.ecl-site-footer__description ' );
@@ -915,6 +934,26 @@ public function testCorporateFooterRendering(): void {
915934 $ assert ->elementNotExists ('css ' , 'footer.ecl-site-footer div.ecl-site-footer__row--specific .ecl-social-media-follow ' );
916935 }
917936
937+ /**
938+ * Asserts the "Subscribe for updates" action button in a site info section.
939+ *
940+ * @param \Behat\Mink\Element\NodeElement $section
941+ * The footer site info section.
942+ * @param string $type
943+ * The expected ECL link type, e.g. 'secondary-inverted'.
944+ * @param string $href
945+ * The expected button link.
946+ */
947+ protected function assertSubscribeActionButton (NodeElement $ section , string $ type , string $ href ): void {
948+ $ button = $ this ->assertSession ()->elementExists ('css ' , 'a.ecl-site-footer__action-button ' , $ section );
949+ $ this ->assertEquals ('Subscribe for updates ' , $ button ->getText ());
950+ $ this ->assertEquals ($ href , $ button ->getAttribute ('href ' ));
951+ $ this ->assertEquals ("ecl-link ecl-link-- {$ type } ecl-link--icon ecl-site-footer__action-button ecl-button--m " , $ button ->getAttribute ('class ' ));
952+ // Assert the default icon: "envelope-simple" from the "phosphor" family
953+ // with the "inverted" style.
954+ $ this ->assertSession ()->elementExists ('css ' , 'span.ecl-icon.ecl-icon-phosphor--envelope-simple.wt-icon--inverted.ecl-link__icon ' , $ button );
955+ }
956+
918957 /**
919958 * Get fixture content.
920959 *
0 commit comments