var _ = require('underscore'); var EmbedOverlayView = require('builder/embed/embed-overlay-view'); describe('embed/embed-overlay-view', function () { var TITLE = 'Awesome Embed Map'; var DESCRIPTION = ''; var view; var viewOptions = { title: TITLE, description: DESCRIPTION, showMenu: true }; var createViewFn = function (options) { return new EmbedOverlayView(_.extend({}, viewOptions, options)); }; it('should initialize properly', function () { view = createViewFn(); expect(view.model.get('collapsed')).toBe(false); }); describe('.render', function () { it('should render properly', function () { view = createViewFn(); spyOn(view, '_renderOverlay'); view.render(); expect(view._renderOverlay).toHaveBeenCalled(); }); }); describe('.initBinds', function () { it('should call ._toggleCollapsed when collapsed changes', function () { view = createViewFn(); spyOn(view, '_toggleCollapsed'); view._initBinds(); view.model.set('collapsed', true); expect(view._toggleCollapsed).toHaveBeenCalled(); }); }); describe('._renderOverlay', function () { it('should render overlay template', function () { view = createViewFn(); var options = { title: TITLE, description: DESCRIPTION, legends: true, showMenu: true }; expect(view._renderOverlay(options)).toContain(TITLE); expect(view._renderOverlay(options)).toContain('