Free and Open source Web Builder Framework. Next generation tool for building templates without coding
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.
 
 
 
 

38 lines
1012 B

import ItemView from 'navigator/view/ItemView';
import config from 'navigator/config/config';
describe('ItemView', () => {
let itemView, fakeModel, fakeModelStyle;
beforeEach(() => {
fakeModelStyle = {};
fakeModel = {
get: jest.fn(),
set: jest.fn(),
getStyle: jest.fn(() => fakeModelStyle)
};
itemView = new ItemView({
model: fakeModel,
config: {
...config,
em: {
get: jest.fn(() => ({ stylePrefix: '' }))
}
}
});
});
describe('.isVisible', () => {
it("should return `false` if the model's `style` object has a `display` property set to `none`, `true` otherwise", () => {
expect(itemView.isVisible()).toEqual(true);
fakeModelStyle.display = '';
expect(itemView.isVisible()).toEqual(true);
fakeModelStyle.display = 'none';
expect(itemView.isVisible()).toEqual(false);
fakeModelStyle.display = 'block';
expect(itemView.isVisible()).toEqual(true);
});
});
});