@@ -1318,6 +1318,56 @@ public function testFormBlockWithMarginAndPaddingParameters(EndToEndTester $I)
1318
1318
$ I ->seeInSource ('<div class="convertkit-form wp-block-convertkit-form" style="padding-top:var(--wp--preset--spacing--30);margin-top:var(--wp--preset--spacing--30)" ' );
1319
1319
}
1320
1320
1321
+ /**
1322
+ * Test the Form block's alignment parameter works.
1323
+ *
1324
+ * @since 2.8.8
1325
+ *
1326
+ * @param EndToEndTester $I Tester.
1327
+ */
1328
+ public function testFormBlockWithAlignmentParameter (EndToEndTester $ I )
1329
+ {
1330
+ // Setup Plugin and enable debug log.
1331
+ $ I ->setupKitPlugin ($ I );
1332
+ $ I ->setupKitPluginResources ($ I );
1333
+
1334
+ // It's tricky to interact with Gutenberg's margin and padding pickers, so we programmatically create the Page
1335
+ // instead to then confirm the settings apply on the output.
1336
+ // We don't need to test the margin and padding pickers themselves, as they are Gutenberg supplied components, and our
1337
+ // other End To End tests confirm that the block can be added in Gutenberg etc.
1338
+ $ pageID = $ I ->havePostInDatabase (
1339
+ [
1340
+ 'post_type ' => 'page ' ,
1341
+ 'post_name ' => 'kit-page-form-block-alignment-param ' ,
1342
+ 'post_content ' => '<!-- wp:convertkit/form {"form":" ' . $ _ENV ['CONVERTKIT_API_FORM_ID ' ] . '","align":"right"} /--> ' ,
1343
+ 'meta_input ' => [
1344
+ // Configure Kit Plugin to not display a default Form.
1345
+ '_wp_convertkit_post_meta ' => [
1346
+ 'form ' => '0 ' ,
1347
+ 'landing_page ' => '' ,
1348
+ 'tag ' => '' ,
1349
+ ],
1350
+ ],
1351
+ ]
1352
+ );
1353
+
1354
+ // Load the Page on the frontend site.
1355
+ $ I ->amOnPage ('?p= ' . $ pageID );
1356
+
1357
+ // Wait for frontend web site to load.
1358
+ $ I ->waitForElementVisible ('body.page-template-default ' );
1359
+
1360
+ // Check that no PHP warnings or notices were output.
1361
+ $ I ->checkNoWarningsAndNoticesOnScreen ($ I );
1362
+
1363
+ // Confirm that one Kit Form is output in the DOM.
1364
+ // This confirms that there is only one script on the page for this form, which renders the form.
1365
+ $ I ->seeFormOutput ($ I , $ _ENV ['CONVERTKIT_API_FORM_ID ' ]);
1366
+
1367
+ // Confirm that the chosen alignment is applied as a CSS class.
1368
+ $ I ->seeInSource ('<div class="convertkit-form alignright wp-block-convertkit-form" ' );
1369
+ }
1370
+
1321
1371
/**
1322
1372
* Deactivate and reset Plugin(s) after each test, if the test passes.
1323
1373
* We don't use _after, as this would provide a screenshot of the Plugin
0 commit comments