Update tests and add a test case for the button block

[MAILPOET-4905]
This commit is contained in:
Rostislav Wolny
2024-05-29 16:12:57 +02:00
committed by Aschepikov
parent a50ca402b0
commit 98c721feed
2 changed files with 24 additions and 2 deletions

View File

@@ -413,11 +413,33 @@ describe('Button', function () {
it('updates the model when link is changed', function () {
var newValue = 'http://google.com/?q=123456';
view.$('.mailpoet_field_button_url').val(newValue).trigger('input');
view.$('.mailpoet_field_button_url').val(newValue).trigger('change');
expect(model.get('url')).to.equal(newValue);
});
it('adds https protocol to url when needed', function () {
let newValue = 'example.com';
view.$('.mailpoet_field_button_url').val(newValue).trigger('change');
expect(model.get('url')).to.equal('https://example.com');
newValue = 'https://example2.com';
view.$('.mailpoet_field_button_url').val(newValue).trigger('change');
expect(model.get('url')).to.equal('https://example2.com');
newValue = 'http://example3.com';
view.$('.mailpoet_field_button_url').val(newValue).trigger('change');
expect(model.get('url')).to.equal('http://example3.com');
newValue = 'mailto:test@example.com';
view.$('.mailpoet_field_button_url').val(newValue).trigger('change');
expect(model.get('url')).to.equal('mailto:test@example.com');
newValue = '[shortcode]';
view.$('.mailpoet_field_button_url').val(newValue).trigger('change');
expect(model.get('url')).to.equal('[shortcode]');
});
it('updates the model when font color changes', function () {
var newValue = '#cccccc';