mirror of
https://github.com/GitbookIO/gitbook.git
synced 2026-09-18 08:35:10 +00:00
29 lines
741 B
JavaScript
29 lines
741 B
JavaScript
var Immutable = require('immutable');
|
|
var Page = require('../page');
|
|
|
|
describe('Page', function() {
|
|
|
|
describe('toText', function() {
|
|
it('must not prepend frontmatter if no attributes', function() {
|
|
var page = Page().merge({
|
|
content: 'Hello World'
|
|
});
|
|
|
|
expect(page.toText()).toBe('Hello World');
|
|
});
|
|
|
|
it('must prepend frontmatter if attributes', function() {
|
|
var page = Page().merge({
|
|
content: 'Hello World',
|
|
attributes: Immutable.fromJS({
|
|
hello: 'world'
|
|
})
|
|
});
|
|
|
|
expect(page.toText()).toBe('---\nhello: world\n---\n\nHello World');
|
|
});
|
|
});
|
|
});
|
|
|
|
|