Update form tests to have front end checks [MAILPOET-3334]

[MAILPOET-3334](https://mailpoet.atlassian.net/browse/MAILPOET-3334)
This commit is contained in:
Veljko V
2020-12-02 17:19:15 +01:00
parent f3df805bb3
commit 7d88f3eaea
11 changed files with 118 additions and 51 deletions

View File

@@ -63,7 +63,7 @@ class Date {
$html .= $this->getDays($block);
$html .= '</select>';
} else if ($dateSelector === 'MM') {
$html .= '<select class="mailpoet_select mailpoet_date_month" ';
$html .= '<select class="mailpoet_select mailpoet_date_month" data-automation-id="form_date_month" ';
$html .= ' style="' . $this->blockStylesRenderer->renderForSelect([], $formSettings) . '"';
$html .= $this->rendererHelper->getInputValidation($block, [
'required-message' => __('Please select a month', 'mailpoet'),
@@ -72,7 +72,7 @@ class Date {
$html .= $this->getMonths($block);
$html .= '</select>';
} else if ($dateSelector === 'YYYY') {
$html .= '<select class="mailpoet_date_year" ';
$html .= '<select class="mailpoet_date_year" data-automation-id="form_date_year" ';
$html .= ' style="' . $this->blockStylesRenderer->renderForSelect([], $formSettings) . '"';
$html .= $this->rendererHelper->getInputValidation($block, [
'required-message' => __('Please select a year', 'mailpoet'),

View File

@@ -44,6 +44,6 @@ class Divider {
"width: $width%",
];
$style = implode(";", $dividerStyles);
return "<div class='mailpoet_divider' style='$style'></div>";
return "<div class='mailpoet_divider' data-automation-id='form_divider' style='$style'></div>";
}
}

View File

@@ -41,6 +41,7 @@ class Select {
$html .= $this->rendererHelper->renderLabel($block, $formSettings);
$html .= '<select
class="mailpoet_select"
data-automation-id="form_custom_select"
name="' . $fieldName . '" '
. $automationId
. 'style="' . $this->blockStylesRenderer->renderForSelect([], $formSettings) . '"'

View File

@@ -48,7 +48,7 @@ class Text {
$html .= $this->rendererHelper->renderLabel($block, $formSettings);
$html .= '<input type="' . $type . '" class="mailpoet_text" ';
$html .= '<input type="' . $type . '" class="mailpoet_text" data-automation-id="form_custom_text" ';
$html .= 'name="data[' . $name . ']" ';

View File

@@ -35,7 +35,7 @@ class Textarea {
$lines = (isset($block['params']['lines']) ? (int)$block['params']['lines'] : 1);
$html .= $this->inputStylesRenderer->renderPlaceholderStyles($block, 'textarea[name="data[' . $name . ']"]');
$html .= '<textarea class="mailpoet_textarea" rows="' . $lines . '" ';
$html .= '<textarea class="mailpoet_textarea" data-automation-id="form_custom_text_area" rows="' . $lines . '" ';
$html .= 'name="data[' . $name . ']"';