UNPKG

halvalla

Version:

Generate React elements with CoffeeScript functions

49 lines (44 loc) 1.54 kB
// Generated by CoffeeScript 1.12.7 (function() { var expect, h1, ref, render, renderable, text; expect = require('expect.js'); ref = require('../lib/halvalla'), render = ref.render, renderable = ref.renderable, text = ref.text, h1 = ref.h1; describe('text', function() { it('renders text verbatim', function() { return expect(render(renderable(text)('foobar'))).to.equal('foobar'); }); it('renders numbers', function() { expect(render(renderable(text)(1))).to.equal('1'); return expect(render(renderable(text)(0))).to.equal('0'); }); return it('is assumed when it is returned from contents', function() { var template; template = function() { return h1(function() { return 'hello world'; }); }; expect(render(template)).to.equal('<h1>hello world</h1>'); template = function() { return h1('.title', function() { return 'hello world'; }); }; expect(render(template)).to.equal('<h1 class="title">hello world</h1>'); template = function() { return h1({ "class": 'title' }, function() { return 'hello world'; }); }; expect(render(template)).to.equal('<h1 class="title">hello world</h1>'); template = function() { return h1('.title', function() { return text('hello world'); }); }; return expect(render(template)).to.equal('<h1 class="title">hello world</h1>'); }); }); }).call(this);