import { expect } from 'chai'; import { normalizeLines } from './utils'; describe(' 工具函数', () => { it('把“1. ”列表处理成空行分隔的格式,以便处理', function () { const lines = normalizeLines(`1. abc 11. def `); expect(lines).eql(` 1. abc 11. def `); }); it('把“- ”列表处理成空行分隔的格式,以便处理', function () { const lines = normalizeLines(`- abc - def `); expect(lines).eql(` - abc - def `); }); it('把“* ”列表处理成空行分隔的格式,以便处理', function () { const lines = normalizeLines(`* abc * def `); expect(lines).eql(` * abc * def `); }); it('把“# ”标题处理成空行分隔的格式,以便处理', function () { const lines = normalizeLines(`\n# abc def`); expect(lines).eql(` # abc def `); }); it('拆解单行的成对 tag', function () { const lines = normalizeLines(` a
DEF
b `); expect(lines).eql(` a
DEF
b `); }); it('拆解单行的自封闭 tag', function () { const lines = normalizeLines(` a
b `); expect(lines).eql(` a
b `); }); it('拆解单行的 h\\d 标签', function () { const lines = normalizeLines(` a

line

b `); expect(lines).eql(` a

line

b `); }); it('拆解多行的 h\\d 标签', function () { const lines = normalizeLines(` a

line

b `); expect(lines).eql(` a

line

b `); }); it('拆解单行的 th 标签', function () { const lines = normalizeLines(` a line b `); expect(lines).eql(` a line b `); }); it('拆解单行注释', function () { const lines = normalizeLines(` a b `); expect(lines).eql(` a b `); }); it('拆解多行注释', function () { const lines = normalizeLines(` a b `); expect(lines).eql(` a b `); }); it('拆解单行br', function () { const lines = normalizeLines(` a
b `); expect(lines).eql(` a
b `); }); it('拆解 code-example', function () { const lines = normalizeLines(` ng generate directive highlight `); expect(lines).eql(` ng generate directive highlight `); }); it('拆解 @a 标记', function () { const lines = normalizeLines(` a {@a test} b `); expect(lines).eql(` a {@a test} b `); }); it('拆解多行代码', function () { const lines = normalizeLines(` a \`\`\` var a = 1 \`\`\` b `); expect(lines).eql(` a \`\`\` var a = 1 \`\`\` b `); }); it('拆解多行的成对 tag', function () { const lines = normalizeLines(`
Angular forms don't require a style library
`); expect(lines).eq(`
Angular forms don't require a style library
`); }); it('拆解多行的成对 tag', function () { const lines = normalizeLines(`

a

`); expect(lines).eq(`

a

`); }); it('拆解独行的 th/td', function () { expect(normalizeLines(` abc `)).eql(` abc `); }); it('拆解任意位置的 ', function () { expect(normalizeLines(` abc `)).eql(` abc `); }); it('拆解独行的 li', function () { expect(normalizeLines(` `)).eql(` `); }); it('不要拆解行内的 html tag', function () { expect(normalizeLines(` a c `)).eql(` a c `); }); it('把连续的三行及以上空行简化为两个空行', function () { const lines = normalizeLines(` a b`); expect(lines).eql(` a b `); }); });