UNPKG

este-library-oldschool

Version:

Library for github.com/steida/este.git

71 lines 2.33 kB
// Generated by github.com/steida/coffee2closure 900.1.18 suite('este.labs.app.SimplePagesContainer', function() { var SimplePagesContainer, container, containerEl, data, page; SimplePagesContainer = este.labs.app.SimplePagesContainer; container = null; page = null; containerEl = null; data = null; setup(function() { container = new SimplePagesContainer; page = { show: function() {}, hide: function() {}, getElement: function() {} }; containerEl = { appendChild: function() {}, removeChild: function() {} }; return data = {}; }); suite('constructor', function() { return test('should work', function() { return assert.instanceOf(container, SimplePagesContainer); }); }); return suite('show', function() { suite('first page', function() { return test('should call show on page with containerEl and data', function(done) { page.show = function(p_container, p_data) { assert.equal(p_container, containerEl); assert.equal(p_data, data); return done(); }; return container.show(page, containerEl, data); }); }); suite('next page', function() { test('should call hide on previous page', function(done) { container.show(page, containerEl, data); page.hide = function() { return done(); }; return container.show(page, containerEl, data); }); return test('should remove previous page element from containerEl', function(done) { container.show(page, containerEl, data); page.getElement = function() { return 'element'; }; containerEl.removeChild = function(element) { assert.equal(element, page.getElement()); return done(); }; return container.show(page, containerEl, data); }); }); return suite('yet rendered page', function() { return test('should append page element into containerEl', function(done) { page.getElement = function() { return 'element'; }; containerEl.appendChild = function(element) { assert.equal(element, page.getElement()); return done(); }; return container.show(page, containerEl, data); }); }); }); });