const { init, expectSameDom } = require('../_helper'); const { expect } = require('chai'); describe('render', function() { it('important content (tips)', async function() { const { docsify } = await init(); const output = docsify.compiler.compile('!> **Time** is money, my friend!'); expect(output).equal( '

Time is money, my friend!

' ); }); describe('lists', function() { it('as unordered task list', async function() { const { docsify } = await init(); const output = docsify.compiler.compile(` - [x] Task 1 - [ ] Task 2 - [ ] Task 3`); expect( output, `` ); }); it('as ordered task list', async function() { const { docsify } = await init(); const output = docsify.compiler.compile(` 1. [ ] Task 1 2. [x] Task 2`); expectSameDom( output, `
` ); }); it('normal unordered', async function() { const { docsify } = await init(); const output = docsify.compiler.compile(` - [linktext](link) - just text`); expectSameDom( output, `` ); }); it('unordered with custom start', async function() { const { docsify } = await init(); const output = docsify.compiler.compile(` 1. first 2. second text 3. third`); expectSameDom( output, `
  1. first
  2. second

text

  1. third
` ); }); it('nested', async function() { const { docsify } = await init(); const output = docsify.compiler.compile(` - 1 - 2 - 2 a - 2 b - 3`); expectSameDom( output, `` ); }); }); describe('image', function() { it('regular', async function() { const { docsify } = await init(); const output = docsify.compiler.compile('![alt text](http://imageUrl)'); expectSameDom( output, '

alt text

' ); }); it('class', async function() { const { docsify } = await init(); const output = docsify.compiler.compile( "![alt text](http://imageUrl ':class=someCssClass')" ); expectSameDom( output, '

alt text

' ); }); it('id', async function() { const { docsify } = await init(); const output = docsify.compiler.compile( "![alt text](http://imageUrl ':id=someCssID')" ); expectSameDom( output, '

alt text

' ); }); it('no-zoom', async function() { const { docsify } = await init(); const output = docsify.compiler.compile( "![alt text](http://imageUrl ':no-zoom')" ); expectSameDom( output, '

alt text

' ); }); describe('size', function() { it('width and height', async function() { const { docsify } = await init(); const output = docsify.compiler.compile( "![alt text](http://imageUrl ':size=WIDTHxHEIGHT')" ); expectSameDom( output, '

alt text

' ); }); it('width', async function() { const { docsify } = await init(); const output = docsify.compiler.compile( "![alt text](http://imageUrl ':size=50')" ); expectSameDom( output, '

alt text

' ); }); }); }); describe('heading', function() { it('h1', async function() { const { docsify } = await init(); const output = docsify.compiler.compile('# h1 tag'); expectSameDom( output, `

h1 tag

` ); }); it('h2', async function() { const { docsify } = await init(); const output = docsify.compiler.compile('## h2 tag'); expectSameDom( output, `

h2 tag

` ); }); it('h3', async function() { const { docsify } = await init(); const output = docsify.compiler.compile('### h3 tag'); expectSameDom( output, `

h3 tag

` ); }); it('h4', async function() { const { docsify } = await init(); const output = docsify.compiler.compile('#### h4 tag'); expectSameDom( output, `

h4 tag

` ); }); it('h5', async function() { const { docsify } = await init(); const output = docsify.compiler.compile('##### h5 tag'); expectSameDom( output, `
h5 tag
` ); }); it('h6', async function() { const { docsify } = await init(); const output = docsify.compiler.compile('###### h6 tag'); expectSameDom( output, `
h6 tag
` ); }); }); describe('link', function() { it('regular', async function() { const { docsify } = await init(); const output = docsify.compiler.compile('[alt text](http://url)'); expectSameDom( output, '

alt text

' ); }); it('disabled', async function() { const { docsify } = await init(); const output = docsify.compiler.compile( "[alt text](http://url ':disabled')" ); expectSameDom( output, '

alt text

' ); }); it('target', async function() { const { docsify } = await init(); const output = docsify.compiler.compile( "[alt text](http://url ':target=_self')" ); expectSameDom( output, '

alt text

' ); }); it('class', async function() { const { docsify } = await init(); const output = docsify.compiler.compile( "[alt text](http://url ':class=someCssClass')" ); expectSameDom( output, '

alt text

' ); }); it('id', async function() { const { docsify } = await init(); const output = docsify.compiler.compile( "[alt text](http://url ':id=someCssID')" ); expectSameDom( output, '

alt text

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