UNPKG

este-library-oldschool

Version:

Library for github.com/steida/este.git

143 lines 5.01 kB
// Generated by github.com/steida/coffee2closure 900.1.18 suite('este.react', function() { var children, context, improve, props; improve = este.react.improve; context = null; props = null; children = null; setup(function() { context = {}; props = {}; return children = ['a']; }); return suite('este.react.improve', function() { test('should work without args', function(done) { var factory, improvedFactory; factory = function(p_props, p_children) { assert.lengthOf(arguments, 0); assert.equal(this, context); return done(); }; improvedFactory = improve(factory); return improvedFactory.call(context); }); test('should work with props', function(done) { var factory, improvedFactory; factory = function(p_props) { assert.lengthOf(arguments, 1); assert.deepEqual(p_props, props); assert.equal(this, context); return done(); }; improvedFactory = improve(factory); return improvedFactory.call(context, props); }); test('should work with props and children', function(done) { var factory, improvedFactory; factory = function(p_props) { assert.lengthOf(arguments, 2); assert.deepEqual(p_props, props); assert.deepEqual([].slice.call(arguments, 1), children); assert.equal(this, context); return done(); }; improvedFactory = improve(factory); return improvedFactory.call(context, props, children); }); suite('should allow to omit props and pass children instead', function() { test('for array', function(done) { var factory, improvedFactory; factory = function(p_props) { assert.lengthOf(arguments, 2); assert.isNull(p_props); assert.deepEqual([].slice.call(arguments, 1), children); assert.equal(this, context); return done(); }; improvedFactory = improve(factory); return improvedFactory.call(context, children); }); test('for string', function(done) { var factory, improvedFactory; factory = function(p_props, p_children) { assert.lengthOf(arguments, 2); assert.isNull(p_props); assert.equal(p_children, 'Text'); assert.equal(this, context); return done(); }; improvedFactory = improve(factory); return improvedFactory.call(context, 'Text'); }); test('for zero', function(done) { var factory, improvedFactory; factory = function(p_props, p_children) { assert.lengthOf(arguments, 2); assert.isNull(p_props); assert.equal(p_children, 0); assert.equal(this, context); return done(); }; improvedFactory = improve(factory); return improvedFactory.call(context, 0); }); test('for instance', function(done) { var factory, improvedFactory, instance; instance = new Function; factory = function(p_props, p_children) { assert.lengthOf(arguments, 2); assert.isNull(p_props); assert.equal(p_children, instance); assert.equal(this, context); return done(); }; improvedFactory = improve(factory); return improvedFactory.call(context, instance); }); return test('for null', function(done) { var factory, improvedFactory, instance; instance = new Function; factory = function(p_props) { assert.lengthOf(arguments, 1); assert.isNull(p_props); return done(); }; improvedFactory = improve(factory); return improvedFactory.call(context, null); }); }); suite('should remove undefined values from children', function() { test('for children', function(done) { var factory, improvedFactory; factory = function(p_props) { assert.lengthOf(arguments, 3); return done(); }; improvedFactory = improve(factory); return improvedFactory.call(context, [0, void 0, '']); }); return test('for props and children', function(done) { var factory, improvedFactory; factory = function(p_props) { assert.lengthOf(arguments, 3); return done(); }; improvedFactory = improve(factory); return improvedFactory.call(context, props, [0, void 0, '']); }); }); return suite('should flatten children', function() { return test('for children', function(done) { var factory, improvedFactory; factory = function(p_props) { var args; args = [].slice.call(arguments); assert.deepEqual(args, [null, '1', '2', '3', '4']); return done(); }; improvedFactory = improve(factory); return improvedFactory.call(context, ['1', ['2', '3'], [['4', void 0]]]); }); }); }); });