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,
`
- first
- second
text
- 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('');
expectSameDom(
output,
'
'
);
});
it('class', async function() {
const { docsify } = await init();
const output = docsify.compiler.compile(
""
);
expectSameDom(
output,
'
'
);
});
it('id', async function() {
const { docsify } = await init();
const output = docsify.compiler.compile(
""
);
expectSameDom(
output,
'
'
);
});
it('no-zoom', async function() {
const { docsify } = await init();
const output = docsify.compiler.compile(
""
);
expectSameDom(
output,
'
'
);
});
describe('size', function() {
it('width and height', async function() {
const { docsify } = await init();
const output = docsify.compiler.compile(
""
);
expectSameDom(
output,
'
'
);
});
it('width', async function() {
const { docsify } = await init();
const output = docsify.compiler.compile(
""
);
expectSameDom(
output,
'
'
);
});
});
});
describe('heading', function() {
it('h1', async function() {
const { docsify } = await init();
const output = docsify.compiler.compile('# h1 tag');
expectSameDom(
output,
`
`
);
});
it('h2', async function() {
const { docsify } = await init();
const output = docsify.compiler.compile('## h2 tag');
expectSameDom(
output,
`
`
);
});
it('h3', async function() {
const { docsify } = await init();
const output = docsify.compiler.compile('### h3 tag');
expectSameDom(
output,
`
`
);
});
it('h4', async function() {
const { docsify } = await init();
const output = docsify.compiler.compile('#### h4 tag');
expectSameDom(
output,
`
`
);
});
it('h5', async function() {
const { docsify } = await init();
const output = docsify.compiler.compile('##### h5 tag');
expectSameDom(
output,
`
`
);
});
it('h6', async function() {
const { docsify } = await init();
const output = docsify.compiler.compile('###### h6 tag');
expectSameDom(
output,
`
`
);
});
});
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
'
);
});
});
});