|
|
@@ -364,92 +364,6 @@ describe( 'Title', () => {
|
|
|
} );
|
|
|
} );
|
|
|
|
|
|
- describe( 'setTitle()', () => {
|
|
|
- it( 'should set new content of a title element', () => {
|
|
|
- setData( model,
|
|
|
- '<title><title-content></title-content></title>' +
|
|
|
- '<paragraph>Bar</paragraph>'
|
|
|
- );
|
|
|
-
|
|
|
- editor.plugins.get( 'Title' ).setTitle( 'Biz' );
|
|
|
-
|
|
|
- expect( getData( model ) ).to.equal(
|
|
|
- '<title><title-content>[]Biz</title-content></title>' +
|
|
|
- '<paragraph>Bar</paragraph>'
|
|
|
- );
|
|
|
- } );
|
|
|
-
|
|
|
- it( 'should replace old content of a title element', () => {
|
|
|
- setData( model,
|
|
|
- '<title><title-content>Foo</title-content></title>' +
|
|
|
- '<paragraph>Bar</paragraph>'
|
|
|
- );
|
|
|
-
|
|
|
- editor.plugins.get( 'Title' ).setTitle( 'Biz' );
|
|
|
-
|
|
|
- expect( getData( model ) ).to.equal(
|
|
|
- '<title><title-content>[]Biz</title-content></title>' +
|
|
|
- '<paragraph>Bar</paragraph>'
|
|
|
- );
|
|
|
- } );
|
|
|
-
|
|
|
- it( 'should clear content of a title element', () => {
|
|
|
- setData( model,
|
|
|
- '<title><title-content>Foo</title-content></title>' +
|
|
|
- '<paragraph>Bar</paragraph>'
|
|
|
- );
|
|
|
-
|
|
|
- editor.plugins.get( 'Title' ).setTitle( '' );
|
|
|
-
|
|
|
- expect( getData( model ) ).to.equal(
|
|
|
- '<title><title-content>[]</title-content></title>' +
|
|
|
- '<paragraph>Bar</paragraph>'
|
|
|
- );
|
|
|
- } );
|
|
|
-
|
|
|
- it( 'should properly handle HTML element', () => {
|
|
|
- setData( model,
|
|
|
- '<title><title-content></title-content></title>' +
|
|
|
- '<paragraph>Bar</paragraph>'
|
|
|
- );
|
|
|
-
|
|
|
- editor.plugins.get( 'Title' ).setTitle( '<p>Foo</p>' );
|
|
|
-
|
|
|
- expect( getData( model ) ).to.equal(
|
|
|
- '<title><title-content>[]Foo</title-content></title>' +
|
|
|
- '<paragraph>Bar</paragraph>'
|
|
|
- );
|
|
|
- } );
|
|
|
-
|
|
|
- it( 'should properly handle multiple HTML elements', () => {
|
|
|
- setData( model,
|
|
|
- '<title><title-content>Foo</title-content></title>' +
|
|
|
- '<paragraph>Bar</paragraph>'
|
|
|
- );
|
|
|
-
|
|
|
- editor.plugins.get( 'Title' ).setTitle( '<p>Foo</p><p>bar</p>' );
|
|
|
-
|
|
|
- expect( getData( model ) ).to.equal(
|
|
|
- '<title><title-content>[]Foobar</title-content></title>' +
|
|
|
- '<paragraph>Bar</paragraph>'
|
|
|
- );
|
|
|
- } );
|
|
|
-
|
|
|
- it( 'should do nothing when setting empty content to the empty title', () => {
|
|
|
- setData( model,
|
|
|
- '<title><title-content></title-content></title>' +
|
|
|
- '<paragraph>Bar</paragraph>'
|
|
|
- );
|
|
|
-
|
|
|
- editor.plugins.get( 'Title' ).setTitle( '' );
|
|
|
-
|
|
|
- expect( getData( model ) ).to.equal(
|
|
|
- '<title><title-content>[]</title-content></title>' +
|
|
|
- '<paragraph>Bar</paragraph>'
|
|
|
- );
|
|
|
- } );
|
|
|
- } );
|
|
|
-
|
|
|
describe( 'getTitle()', () => {
|
|
|
it( 'should return content of a title element', () => {
|
|
|
setData( model,
|
|
|
@@ -512,51 +426,6 @@ describe( 'Title', () => {
|
|
|
} );
|
|
|
} );
|
|
|
|
|
|
- describe( 'setBody()', () => {
|
|
|
- it( 'should set new content to body', () => {
|
|
|
- setData( model,
|
|
|
- '<title><title-content>Foo</title-content></title>' +
|
|
|
- '<paragraph>Bar</paragraph>'
|
|
|
- );
|
|
|
-
|
|
|
- editor.plugins.get( 'Title' ).setBody( 'Biz' );
|
|
|
-
|
|
|
- expect( getData( model ) ).to.equal(
|
|
|
- '<title><title-content>[]Foo</title-content></title>' +
|
|
|
- '<paragraph>Biz</paragraph>'
|
|
|
- );
|
|
|
- } );
|
|
|
-
|
|
|
- it( 'should set empty content to body', () => {
|
|
|
- setData( model,
|
|
|
- '<title><title-content>Foo</title-content></title>' +
|
|
|
- '<paragraph>Bar</paragraph>'
|
|
|
- );
|
|
|
-
|
|
|
- editor.plugins.get( 'Title' ).setBody( '' );
|
|
|
-
|
|
|
- expect( getData( model ) ).to.equal(
|
|
|
- '<title><title-content>[]Foo</title-content></title>' +
|
|
|
- '<paragraph></paragraph>'
|
|
|
- );
|
|
|
- } );
|
|
|
-
|
|
|
- it( 'should set html content to body', () => {
|
|
|
- setData( model,
|
|
|
- '<title><title-content>Foo</title-content>' +
|
|
|
- '</title><paragraph>Bar</paragraph>'
|
|
|
- );
|
|
|
-
|
|
|
- editor.plugins.get( 'Title' ).setBody( '<blockQuote>Bar</blockQuote><p>Biz</p>' );
|
|
|
-
|
|
|
- expect( getData( model ) ).to.equal(
|
|
|
- '<title><title-content>[]Foo</title-content></title>' +
|
|
|
- '<blockQuote><paragraph>Bar</paragraph></blockQuote>' +
|
|
|
- '<paragraph>Biz</paragraph>'
|
|
|
- );
|
|
|
- } );
|
|
|
- } );
|
|
|
-
|
|
|
describe( 'getBody()', () => {
|
|
|
it( 'should return all data except the title element', () => {
|
|
|
setData( model,
|