@@ -740,6 +740,102 @@ public function testBroadcastsBlockWithHexColorParameters(EndToEndTester $I)
740740 $ I ->seeInSource ('<div class="convertkit-broadcasts wp-block-convertkit-broadcasts has-text-color has-background" ' );
741741 }
742742
743+ /**
744+ * Test the Broadcasts block's margin and padding parameters works.
745+ *
746+ * @since 2.8.4
747+ *
748+ * @param EndToEndTester $I Tester.
749+ */
750+ public function testBroadcastsBlockWithMarginAndPaddingParameters (EndToEndTester $ I )
751+ {
752+ // Setup Plugin and enable debug log.
753+ $ I ->setupKitPlugin ($ I );
754+ $ I ->setupKitPluginResources ($ I );
755+
756+ // It's tricky to interact with Gutenberg's margin and padding pickers, so we programmatically create the Page
757+ // instead to then confirm the settings apply on the output.
758+ // We don't need to test the margin and padding pickers themselves, as they are Gutenberg supplied components, and our
759+ // other End To End tests confirm that the block can be added in Gutenberg etc.
760+ $ I ->havePageInDatabase (
761+ [
762+ 'post_name ' => 'kit-page-broadcasts-block-margin-padding-params ' ,
763+ 'post_content ' => '<!-- wp:convertkit/broadcasts {"date_format":"m/d/Y","limit": ' . $ _ENV ['CONVERTKIT_API_BROADCAST_COUNT ' ] . ',"style":{"spacing":{"padding":{"top":"var:preset|spacing|30"},"margin":{"top":"var:preset|spacing|30"}}}} /--> ' ,
764+ ]
765+ );
766+
767+ // Load the Page on the frontend site.
768+ $ I ->amOnPage ('/kit-page-broadcasts-block-margin-padding-params ' );
769+
770+ // Wait for frontend web site to load.
771+ $ I ->waitForElementVisible ('body.page-template-default ' );
772+
773+ // Check that no PHP warnings or notices were output.
774+ $ I ->checkNoWarningsAndNoticesOnScreen ($ I );
775+
776+ // Confirm that the block displays correctly with the expected number of Broadcasts.
777+ $ I ->seeBroadcastsOutput (
778+ $ I ,
779+ [
780+ 'number_posts ' => $ _ENV ['CONVERTKIT_API_BROADCAST_COUNT ' ],
781+ ]
782+ );
783+
784+ // Confirm that our stylesheet loaded.
785+ $ I ->seeInSource ('<link rel="stylesheet" id="convertkit-broadcasts-css" href=" ' . $ _ENV ['WORDPRESS_URL ' ] . '/wp-content/plugins/convertkit/resources/frontend/css/broadcasts.css ' );
786+
787+ // Confirm that the chosen margin and padding are applied as CSS styles.
788+ $ I ->seeInSource ('<div class="convertkit-broadcasts wp-block-convertkit-broadcasts" style="padding-top:var(--wp--preset--spacing--30);margin-top:var(--wp--preset--spacing--30)" ' );
789+ }
790+
791+ /**
792+ * Test the Broadcasts block's typography parameters works.
793+ *
794+ * @since 2.8.4
795+ *
796+ * @param EndToEndTester $I Tester.
797+ */
798+ public function testBroadcastsBlockWithTypographyParameters (EndToEndTester $ I )
799+ {
800+ // Setup Plugin and enable debug log.
801+ $ I ->setupKitPlugin ($ I );
802+ $ I ->setupKitPluginResources ($ I );
803+
804+ // It's tricky to interact with Gutenberg's typography pickers, so we programmatically create the Page
805+ // instead to then confirm the settings apply on the output.
806+ // We don't need to test the typography picker itself, as it's a Gutenberg supplied component, and our
807+ // other End To End tests confirm that the block can be added in Gutenberg etc.
808+ $ I ->havePageInDatabase (
809+ [
810+ 'post_name ' => 'kit-page-broadcasts-block-typography-params ' ,
811+ 'post_content ' => '<!-- wp:convertkit/broadcasts {"date_format":"m/d/Y","limit": ' . $ _ENV ['CONVERTKIT_API_BROADCAST_COUNT ' ] . ',"style":{"typography":{"lineHeight":"2"}},"fontSize":"large"} /--> ' ,
812+ ]
813+ );
814+
815+ // Load the Page on the frontend site.
816+ $ I ->amOnPage ('/kit-page-broadcasts-block-typography-params ' );
817+
818+ // Wait for frontend web site to load.
819+ $ I ->waitForElementVisible ('body.page-template-default ' );
820+
821+ // Check that no PHP warnings or notices were output.
822+ $ I ->checkNoWarningsAndNoticesOnScreen ($ I );
823+
824+ // Confirm that the block displays correctly with the expected number of Broadcasts.
825+ $ I ->seeBroadcastsOutput (
826+ $ I ,
827+ [
828+ 'number_posts ' => $ _ENV ['CONVERTKIT_API_BROADCAST_COUNT ' ],
829+ ]
830+ );
831+
832+ // Confirm that our stylesheet loaded.
833+ $ I ->seeInSource ('<link rel="stylesheet" id="convertkit-broadcasts-css" href=" ' . $ _ENV ['WORDPRESS_URL ' ] . '/wp-content/plugins/convertkit/resources/frontend/css/broadcasts.css ' );
834+
835+ // Confirm that the chosen typography settings are applied as CSS styles.
836+ $ I ->seeInSource ('<div class="convertkit-broadcasts wp-block-convertkit-broadcasts has-large-font-size" style="line-height:2" ' );
837+ }
838+
743839 /**
744840 * Deactivate and reset Plugin(s) after each test, if the test passes.
745841 * We don't use _after, as this would provide a screenshot of the Plugin
0 commit comments