summaryrefslogtreecommitdiffstats
path: root/test/page.js
blob: 5f5c311852b10222b6cf7d68b4087c3257e0ea7c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
var mock = require('./mock');

describe('Page', function() {
    var book;

    before(function() {
        return mock.setupDefaultBook({
            'heading.md': '# Hello\n\n## World'
        })
        .then(function(_book) {
            book = _book;
            return book.summary.load();
        });
    });

    it('should add a default ID to headings', function() {
        var page = book.addPage('heading.md');

        return page.parse()
        .then(function() {
            page.content.should.be.html({
                'h1#hello': {
                    count: 1
                },
                'h2#world': {
                    count: 1
                }
            });
        });

    });

});