Add JS test
[MAILPOET-1710]
This commit is contained in:
@ -132,6 +132,10 @@ describe('Automated latest content layout', function () {
|
|||||||
expect(model.get('featuredImagePosition')).to.match(/^(centered|left|right|alternate|none)$/);
|
expect(model.get('featuredImagePosition')).to.match(/^(centered|left|right|alternate|none)$/);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('has title position', function () {
|
||||||
|
expect(model.get('titlePosition')).to.match(/^(abovePost|aboveExcerpt)$/);
|
||||||
|
});
|
||||||
|
|
||||||
it('has an option to display author', function () {
|
it('has an option to display author', function () {
|
||||||
expect(model.get('showAuthor')).to.match(/^(no|aboveText|belowText)$/);
|
expect(model.get('showAuthor')).to.match(/^(no|aboveText|belowText)$/);
|
||||||
});
|
});
|
||||||
@ -185,6 +189,7 @@ describe('Automated latest content layout', function () {
|
|||||||
titleIsLink: true, // false|true
|
titleIsLink: true, // false|true
|
||||||
imageFullWidth: false, // true|false
|
imageFullWidth: false, // true|false
|
||||||
featuredImagePosition: 'aboveTitle',
|
featuredImagePosition: 'aboveTitle',
|
||||||
|
titlePosition: 'aboveExcerpt',
|
||||||
showAuthor: 'belowText', // 'no'|'aboveText'|'belowText'
|
showAuthor: 'belowText', // 'no'|'aboveText'|'belowText'
|
||||||
authorPrecededBy: 'Custom config author preceded by',
|
authorPrecededBy: 'Custom config author preceded by',
|
||||||
showCategories: 'belowText', // 'no'|'aboveText'|'belowText'
|
showCategories: 'belowText', // 'no'|'aboveText'|'belowText'
|
||||||
@ -231,6 +236,7 @@ describe('Automated latest content layout', function () {
|
|||||||
expect(model.get('titleIsLink')).to.equal(true);
|
expect(model.get('titleIsLink')).to.equal(true);
|
||||||
expect(model.get('imageFullWidth')).to.equal(false);
|
expect(model.get('imageFullWidth')).to.equal(false);
|
||||||
expect(model.get('featuredImagePosition')).to.equal('aboveTitle');
|
expect(model.get('featuredImagePosition')).to.equal('aboveTitle');
|
||||||
|
expect(model.get('titlePosition')).to.equal('aboveExcerpt');
|
||||||
expect(model.get('showAuthor')).to.equal('belowText');
|
expect(model.get('showAuthor')).to.equal('belowText');
|
||||||
expect(model.get('authorPrecededBy')).to.equal('Custom config author preceded by');
|
expect(model.get('authorPrecededBy')).to.equal('Custom config author preceded by');
|
||||||
expect(model.get('showCategories')).to.equal('belowText');
|
expect(model.get('showCategories')).to.equal('belowText');
|
||||||
@ -276,15 +282,16 @@ describe('Automated latest content layout', function () {
|
|||||||
model.set('titleIsLink', true);
|
model.set('titleIsLink', true);
|
||||||
model.set('imageFullWidth', true);
|
model.set('imageFullWidth', true);
|
||||||
model.set('featuredImagePosition', 'aboveTitle');
|
model.set('featuredImagePosition', 'aboveTitle');
|
||||||
|
model.set('titlePosition', 'aboveExcerpt');
|
||||||
model.set('showAuthor', 'belowText');
|
model.set('showAuthor', 'belowText');
|
||||||
model.set('authorPrecededBy', 'Custom config author preceded by');
|
model.set('authorPrecededBy', 'Custom config author preceded by');
|
||||||
model.set('showCategories', 'belowText');
|
model.set('showCategories', 'belowText');
|
||||||
model.set('categoriesPrecededBy', 'Custom config categories preceded by');
|
model.set('categoriesPrecededBy', 'Custom config categories preceded by');
|
||||||
model.set('sortBy', 'oldest');
|
model.set('sortBy', 'oldest');
|
||||||
model.set('showDivider', false);
|
model.set('showDivider', false);
|
||||||
expect(stub.callCount).to.equal(16);
|
expect(stub.callCount).to.equal(17);
|
||||||
expect(stub.getCall(15).args[0]).to.equal('blockDefaults.automatedLatestContentLayout');
|
expect(stub.getCall(16).args[0]).to.equal('blockDefaults.automatedLatestContentLayout');
|
||||||
expect(stub.getCall(15).args[1]).to.deep.equal(model.toJSON());
|
expect(stub.getCall(16).args[1]).to.deep.equal(model.toJSON());
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -474,6 +481,12 @@ describe('Automated latest content layout', function () {
|
|||||||
expect(model.get('featuredImagePosition')).to.equal(newValue);
|
expect(model.get('featuredImagePosition')).to.equal(newValue);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('changes the model if featured image position changes', function () {
|
||||||
|
var newValue = 'aboveExcerpt';
|
||||||
|
view.$('.mailpoet_automated_latest_content_title_position').val(newValue).change();
|
||||||
|
expect(model.get('titlePosition')).to.equal(newValue);
|
||||||
|
});
|
||||||
|
|
||||||
it('changes the model if show author changes', function () {
|
it('changes the model if show author changes', function () {
|
||||||
var newValue = 'belowText';
|
var newValue = 'belowText';
|
||||||
view.$('.mailpoet_automated_latest_content_show_author').val(newValue).change();
|
view.$('.mailpoet_automated_latest_content_show_author').val(newValue).change();
|
||||||
|
Reference in New Issue
Block a user