diff --git a/assets/js/src/forms/list.jsx b/assets/js/src/forms/list.jsx index 9bef8e6c72..21b34c16fa 100644 --- a/assets/js/src/forms/list.jsx +++ b/assets/js/src/forms/list.jsx @@ -5,7 +5,6 @@ import jQuery from 'jquery'; import PropTypes from 'prop-types'; import Listing from 'listing/listing.jsx'; import withNpsPoll from 'nps_poll.jsx'; -import { GlobalContext } from 'context/index.jsx'; const columns = [ { @@ -153,35 +152,10 @@ const itemActions = [ ]; class FormList extends React.Component { - createForm = (templatesEnabled) => { - if (templatesEnabled) { - MailPoet.trackEvent('Forms > Add New', { - 'MailPoet Free version': window.mailpoet_version, - }); - setTimeout(() => { - window.location = window.mailpoet_form_template_selection_url; - }, 200); // leave some time for the event to track - } else { - MailPoet.Ajax.post({ - api_version: window.mailpoet_api_version, - endpoint: 'forms', - action: 'create', - }).done((response) => { - MailPoet.trackEvent('Forms > Add New', { - 'MailPoet Free version': window.mailpoet_version, - }); - setTimeout(() => { - window.location = window.mailpoet_form_edit_url + response.data.id; - }, 200); - }).fail((response) => { - if (response.errors.length > 0) { - MailPoet.Notice.error( - response.errors.map((error) => error.message), - { scroll: true } - ); - } - }); - } + goToSelectTemplate = () => { + setTimeout(() => { + window.location = window.mailpoet_form_template_selection_url; + }, 200); // leave some time for the event to track }; updateStatus = (e) => { @@ -280,37 +254,33 @@ class FormList extends React.Component { render() { return ( - - {(value) => ( -
-

- {MailPoet.I18n.t('pageTitle')} - {' '} - -

+
+

+ {MailPoet.I18n.t('pageTitle')} + {' '} + +

- -
- )} - + +
); } } diff --git a/lib/Features/FeaturesController.php b/lib/Features/FeaturesController.php index 13e4ac7695..b5f753d2d9 100644 --- a/lib/Features/FeaturesController.php +++ b/lib/Features/FeaturesController.php @@ -6,15 +6,9 @@ use MailPoetVendor\Doctrine\DBAL\Exception\TableNotFoundException; class FeaturesController { - // Define features below in the following form: - // const FEATURE_NAME_OF_FEATURE = 'name-of-feature'; - const TEMPLATES_SELECTION = 'templates-selection'; - // Define feature defaults in the array below in the following form: // self::FEATURE_NAME_OF_FEATURE => true, - private $defaults = [ - self::TEMPLATES_SELECTION => false, - ]; + private $defaults = []; /** @var array */ private $flags; diff --git a/tests/acceptance/CreateFormUsingTemplateCest.php b/tests/acceptance/CreateFormUsingTemplateCest.php index d120cbd8d5..d75f064e49 100644 --- a/tests/acceptance/CreateFormUsingTemplateCest.php +++ b/tests/acceptance/CreateFormUsingTemplateCest.php @@ -2,16 +2,9 @@ namespace MailPoet\Test\Acceptance; -use MailPoet\Features\FeaturesController; -use MailPoet\Test\DataFactories\Features; use MailPoet\Test\DataFactories\Segment; class CreateFormUsingTemplateCest { - public function _before() { - $features = new Features(); - $features->withFeatureEnabled(FeaturesController::TEMPLATES_SELECTION); - } - public function createFormUsingTemplate(\AcceptanceTester $i) { $segmentFactory = new Segment(); $segmentName = 'Fancy List'; @@ -23,7 +16,11 @@ class CreateFormUsingTemplateCest { $i->click('[data-automation-id="create_new_form"]'); $i->waitForElement('[data-automation-id="template_selection_list"]'); - $i->click('[data-automation-id="select_template_template_1_popup"]'); + $i->waitForElement('[data-automation-id="select_template_template_1_popup"]'); + $i->wantTo('Switch template category and crete a form'); + $i->click('[data-title="Fixed bar"]'); + $i->waitForElement('[data-automation-id="select_template_template_1_fixed_bar"]'); + $i->click('[data-automation-id="select_template_template_1_fixed_bar"]'); $i->waitForElement('[data-automation-id="form_title_input"]', 20); $i->selectOptionInSelect2($segmentName); diff --git a/tests/acceptance/FormEditorUpdateNewFormCest.php b/tests/acceptance/FormEditorUpdateNewFormCest.php index 32b1637b4c..ce812ee5d8 100644 --- a/tests/acceptance/FormEditorUpdateNewFormCest.php +++ b/tests/acceptance/FormEditorUpdateNewFormCest.php @@ -43,6 +43,8 @@ class FormEditorUpdateNewFormCest { $formName = 'My awesome form'; $updatedFormName = 'My updated awesome form'; $i->click('[data-automation-id="create_new_form"]'); + $i->waitForElement('[data-automation-id="template_selection_list"]'); + $i->click('[data-automation-id="select_template_template_1_popup"]'); $i->waitForElement('[data-automation-id="form_title_input"]'); $i->fillField('[data-automation-id="form_title_input"]', $formName); // Try saving form without selected list