var DOM = require('dom.js').DOM; describe('dom', function(){ var dom; beforeEach(function(){ dom = new DOM(); }); describe('example', function(){ it('should render code, live, test', function(){ dom.example('desc', 'src', 'scenario'); expect(dom.toString()).toEqual( '

Example

\n' + '
' + 'descsrc\n' + 'scenario\n'+ '\n' + '
\n'); }); it('should render non-live, test with description', function(){ dom.example('desc', 'src', false); expect(dom.toString()).toEqual('

Example

\n' + '
' + 'desc
' + '
src
\n' + '
\n' + '
\n'); }); it('should render non-live, test', function(){ dom.example('desc', 'src', false); expect(dom.toString()).toContain('
src
'); }); }); describe('h', function(){ it('should render using function', function(){ var cbThis; var cdValue; dom.h('heading', 'content', function(value){ cbThis = this; cbValue = value; }); expect(cbThis).toEqual(dom); expect(cbValue).toEqual('content'); }); it('should update heading numbers', function(){ dom.h('heading', function(){ this.html('

sub-heading

'); }); expect(dom.toString()).toContain('

heading

'); expect(dom.toString()).toContain('

sub-heading

'); }); }); });