Skip to content
This repository has been archived by the owner on Jun 26, 2020. It is now read-only.

Commit

Permalink
Added test case for existing title with title-like elements in the data.
Browse files Browse the repository at this point in the history
  • Loading branch information
jodator committed Sep 4, 2019
1 parent 25d2e3b commit 8ab1e9e
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions tests/title.js
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,32 @@ describe( 'Title', () => {
);
} );

it( 'should use the only title element as a title', () => {
setData( model,
'<heading1>Bar</heading1>' +
'<title><title-content>Foo</title-content></title>'
);

expect( getData( model ) ).to.equal(
'<title><title-content>[]Foo</title-content></title>' +
'<paragraph>Bar</paragraph>'
);
} );

it( 'should use the first title element as a title', () => {
setData( model,
'<heading1>Bar</heading1>' +
'<title><title-content>Foo</title-content></title>' +
'<title><title-content>Baz</title-content></title>'
);

expect( getData( model ) ).to.equal(
'<title><title-content>[]Foo</title-content></title>' +
'<paragraph>Bar</paragraph>' +
'<paragraph>Baz</paragraph>'
);
} );

it( 'should move element after a title element when is not allowed to be a title', () => {
setData( model,
'<blockQuote><paragraph>Foo</paragraph></blockQuote>' +
Expand Down

0 comments on commit 8ab1e9e

Please sign in to comment.