Integrate newsletter editor tests

This commit is contained in:
Tautvidas Sipavičius
2015-08-26 18:24:43 +03:00
parent 4d1fd2b2d8
commit 21a4843a48
29 changed files with 3116 additions and 2805 deletions

View File

@@ -1,41 +1,48 @@
describe('Heading', function() {
describe('view', function() {
var view;
beforeEach(function() {
var model = new Backbone.SuperModel({
newsletter_subject: 'a test subject',
});
view = new (EditorApplication.module("components.heading").HeadingView)({
model: model,
});
});
define('test/newsletter_editor/components/heading', [
'newsletter_editor/App',
'newsletter_editor/components/heading'
], function(EditorApplication) {
it('renders', function() {
expect(view.render).to.not.throw();
});
describe('Heading', function() {
describe('view', function() {
var view;
beforeEach(function() {
var model = new Backbone.SuperModel({
newsletter_subject: 'a test subject',
});
view = new (EditorApplication.module("components.heading").HeadingView)({
model: model,
});
});
describe('once rendered', function() {
var view, model;
beforeEach(function() {
model = new Backbone.SuperModel({
newsletter_subject: 'a test subject',
newsletter_preheader: 'a test preheader',
});
view = new (EditorApplication.module("components.heading").HeadingView)({
model: model,
});
view.render();
});
it('renders', function() {
expect(view.render).to.not.throw();
});
it('changes the model when subject field is changed', function() {
view.$('.mailpoet_input_title').val('a new testing subject').keyup();
expect(model.get('newsletter_subject')).to.equal('a new testing subject');
});
describe('once rendered', function() {
var view, model;
beforeEach(function() {
model = new Backbone.SuperModel({
newsletter_subject: 'a test subject',
newsletter_preheader: 'a test preheader',
});
view = new (EditorApplication.module("components.heading").HeadingView)({
model: model,
});
view.render();
});
it('changes the model when subject field is changed', function() {
view.$('.mailpoet_input_title').val('a new testing subject').keyup();
expect(model.get('newsletter_subject')).to.equal('a new testing subject');
});
it('changes the model when preheader field is changed', function() {
view.$('.mailpoet_input_preheader').val('a new testing preheader').keyup();
expect(model.get('newsletter_preheader')).to.equal('a new testing preheader');
});
});
});
});
it('changes the model when preheader field is changed', function() {
view.$('.mailpoet_input_preheader').val('a new testing preheader').keyup();
expect(model.get('newsletter_preheader')).to.equal('a new testing preheader');
});
});
});
});