mirror of https://github.com/artf/grapesjs.git
nocodeframeworkdrag-and-dropsite-buildersite-generatortemplate-builderui-builderweb-builderweb-builder-frameworkwebsite-builderno-codepage-builder
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
52 lines
1.2 KiB
52 lines
1.2 KiB
const ButtonsView = require('panels/view/ButtonsView');
|
|
const Buttons = require('panels/model/Buttons');
|
|
|
|
module.exports = {
|
|
run() {
|
|
describe('ButtonsView', () => {
|
|
|
|
var $fixtures;
|
|
var $fixture;
|
|
var model;
|
|
var view;
|
|
|
|
before(() => {
|
|
$fixtures = $("#fixtures");
|
|
$fixture = $('<div class="cssrules-fixture"></div>');
|
|
});
|
|
|
|
beforeEach(() => {
|
|
model = new Buttons([]);
|
|
view = new ButtonsView({
|
|
collection: model
|
|
});
|
|
$fixture.empty().appendTo($fixtures);
|
|
$fixture.html(view.render().el);
|
|
});
|
|
|
|
afterEach(() => {
|
|
view.collection.reset();
|
|
});
|
|
|
|
after(() => {
|
|
$fixture.remove();
|
|
});
|
|
|
|
it("Collection is empty", () => {
|
|
expect(view.$el.html()).toEqual('');
|
|
});
|
|
|
|
it("Add new button", () => {
|
|
sinon.stub(view, "addToCollection");
|
|
view.collection.add({});
|
|
expect(view.addToCollection.calledOnce).toEqual(true);
|
|
});
|
|
|
|
it("Render new button", () => {
|
|
view.collection.add({});
|
|
expect(view.$el.html()).toExist();
|
|
});
|
|
|
|
});
|
|
}
|
|
};
|
|
|