Skip to content

Commit ee0884e

Browse files
committed
Added tests for remove CSS and custom styling.
1 parent d61ab47 commit ee0884e

File tree

1 file changed

+55
-0
lines changed

1 file changed

+55
-0
lines changed

tests/cypress/e2e/settings.test.js

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,4 +80,59 @@ describe('Admin can update plugin settings', () => {
8080
cy.get('#mc_subheader').contains(subHeader);
8181
cy.get('#mc_signup_submit').contains(button);
8282
});
83+
84+
it('Admin can remove mailchimp CSS', () => {
85+
// Remove mailchimp CSS.
86+
cy.visit('/wp-admin/admin.php?page=mailchimp_sf_options');
87+
cy.get('#mc_nuke_all_styles').check();
88+
cy.get('input[value="Update Subscribe Form Settings"]').first().click();
89+
90+
// Verify
91+
cy.visit(`/?p=${shortcodePostId}`);
92+
cy.get('#mc_subheader').should('not.have.css', 'margin-bottom', '18px');
93+
94+
cy.visit(`/?p=${blockPostId}`);
95+
cy.get('#mc_subheader').should('not.have.css', 'margin-bottom', '18px');
96+
97+
// Enable mailchimp CSS.
98+
cy.visit('/wp-admin/admin.php?page=mailchimp_sf_options');
99+
cy.get('#mc_nuke_all_styles').uncheck();
100+
cy.get('input[value="Update Subscribe Form Settings"]').first().click();
101+
102+
// Verify
103+
cy.visit(`/?p=${shortcodePostId}`);
104+
cy.get('#mc_subheader').should('have.css', 'margin-bottom', '18px');
105+
106+
cy.visit(`/?p=${blockPostId}`);
107+
cy.get('#mc_subheader').should('have.css', 'margin-bottom', '18px');
108+
});
109+
110+
it('Admin can set custom styling on signup form', () => {
111+
// Remove mailchimp CSS.
112+
cy.visit('/wp-admin/admin.php?page=mailchimp_sf_options');
113+
cy.get('#mc_custom_style').check();
114+
cy.get('#mc_form_border_width').clear().type('10');
115+
cy.get('#mc_form_border_color').clear().type('000000');
116+
cy.get('#mc_form_text_color').clear().type('FF0000');
117+
cy.get('#mc_form_background').clear().type('00FF00');
118+
cy.get('input[value="Update Subscribe Form Settings"]').first().click();
119+
120+
// Verify
121+
cy.visit(`/?p=${shortcodePostId}`);
122+
cy.get('#mc_signup form').should('have.css', 'border-width', '10px');
123+
cy.get('#mc_signup form').should('have.css', 'border-color', 'rgb(0, 0, 0)');
124+
cy.get('#mc_signup form').should('have.css', 'color', 'rgb(255, 0, 0)');
125+
cy.get('#mc_signup form').should('have.css', 'background-color', 'rgb(0, 255, 0)');
126+
127+
cy.visit(`/?p=${blockPostId}`);
128+
cy.get('#mc_signup form').should('have.css', 'border-width', '10px');
129+
cy.get('#mc_signup form').should('have.css', 'border-color', 'rgb(0, 0, 0)');
130+
cy.get('#mc_signup form').should('have.css', 'color', 'rgb(255, 0, 0)');
131+
cy.get('#mc_signup form').should('have.css', 'background-color', 'rgb(0, 255, 0)');
132+
133+
// Enable mailchimp CSS.
134+
cy.visit('/wp-admin/admin.php?page=mailchimp_sf_options');
135+
cy.get('#mc_custom_style').uncheck();
136+
cy.get('input[value="Update Subscribe Form Settings"]').first().click();
137+
});
83138
});

0 commit comments

Comments
 (0)