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

Commit

Permalink
Tests: Update tests to the newest list feature schema.
Browse files Browse the repository at this point in the history
  • Loading branch information
jodator committed Jun 13, 2018
1 parent 3e74554 commit b128b66
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 26 deletions.
4 changes: 2 additions & 2 deletions src/model/schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -1047,7 +1047,7 @@ mix( Schema, ObservableMixin );
*
* schema.register( 'listItem', {
* inheritAllFrom: '$block',
* allowAttributes: [ 'type', 'indent' ]
* allowAttributes: [ 'listType', 'listIndent' ]
* } );
*
* Which translates to:
Expand All @@ -1057,7 +1057,7 @@ mix( Schema, ObservableMixin );
* allowContentOf: '$block',
* allowAttributesOf: '$block',
* inheritTypesFrom: '$block',
* allowAttributes: [ 'type', 'indent' ]
* allowAttributes: [ 'listType', 'listIndent' ]
* } );
*
* # Tips
Expand Down
4 changes: 2 additions & 2 deletions tests/dev-utils/enableenginedebug.js
Original file line number Diff line number Diff line change
Expand Up @@ -634,7 +634,7 @@ describe( 'debug tools', () => {
new ModelElement( 'paragraph', { foo: 'bar' }, [
new ModelText( 'This is ' ), new ModelText( 'bold', { bold: true } ), new ModelText( '.' )
] ),
new ModelElement( 'listItem', { type: 'numbered', indent: 0 }, new ModelText( 'One.' ) ),
new ModelElement( 'listItem', { listType: 'numbered', listIndent: 0 }, new ModelText( 'One.' ) ),
] );

const modelRootTree = modelRoot.printTree();
Expand All @@ -646,7 +646,7 @@ describe( 'debug tools', () => {
'\n\t\t<$text bold=true>bold</$text>' +
'\n\t\t.' +
'\n\t</paragraph>' +
'\n\t<listItem type="numbered" indent=0>' +
'\n\t<listItem listType="numbered" listIndent=0>' +
'\n\t\tOne.' +
'\n\t</listItem>' +
'\n</main>'
Expand Down
18 changes: 9 additions & 9 deletions tests/model/schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -2270,7 +2270,7 @@ describe( 'Schema', () => {
() => {
schema.register( 'listItem', {
inheritAllFrom: '$block',
allowAttributes: [ 'indent', 'type' ]
allowAttributes: [ 'listIndent', 'listType' ]
} );
},
() => {
Expand Down Expand Up @@ -2351,11 +2351,11 @@ describe( 'Schema', () => {
root1 = new Element( '$root', null, [
new Element( 'paragraph', null, 'foo' ),
new Element( 'paragraph', { alignment: 'right' }, 'bar' ),
new Element( 'listItem', { type: 'x', indent: 0 }, 'foo' ),
new Element( 'listItem', { listType: 'x', listIndent: 0 }, 'foo' ),
new Element( 'heading1', null, 'foo' ),
new Element( 'blockQuote', null, [
new Element( 'paragraph', null, 'foo' ),
new Element( 'listItem', { type: 'x', indent: 0 }, 'foo' ),
new Element( 'listItem', { listType: 'x', listIndent: 0 }, 'foo' ),
new Element( 'image', null, [
new Element( 'caption', null, 'foo' )
] )
Expand Down Expand Up @@ -2522,11 +2522,11 @@ describe( 'Schema', () => {
} );

it( 'accepts attribute $root>listItem[indent]', () => {
expect( schema.checkAttribute( r1lI, 'indent' ) ).to.be.true;
expect( schema.checkAttribute( r1lI, 'listIndent' ) ).to.be.true;
} );

it( 'accepts attribute $root>listItem[type]', () => {
expect( schema.checkAttribute( r1lI, 'type' ) ).to.be.true;
expect( schema.checkAttribute( r1lI, 'listType' ) ).to.be.true;
} );

it( 'accepts attribute $root>image[src]', () => {
Expand All @@ -2542,11 +2542,11 @@ describe( 'Schema', () => {
} );

it( 'rejects attribute $root[indent]', () => {
expect( schema.checkAttribute( root1, 'indent' ) ).to.be.false;
expect( schema.checkAttribute( root1, 'listIndent' ) ).to.be.false;
} );

it( 'rejects attribute $root>paragraph[indent]', () => {
expect( schema.checkAttribute( r1p1, 'indent' ) ).to.be.false;
expect( schema.checkAttribute( r1p1, 'listIndent' ) ).to.be.false;
} );

it( 'accepts attribute $root>heading1>$text[bold]', () => {
Expand All @@ -2558,15 +2558,15 @@ describe( 'Schema', () => {
} );

it( 'rejects attribute $root>blockQuote[indent]', () => {
expect( schema.checkAttribute( r1bQ, 'indent' ) ).to.be.false;
expect( schema.checkAttribute( r1bQ, 'listIndent' ) ).to.be.false;
} );

it( 'rejects attribute $root>blockQuote[alignment]', () => {
expect( schema.checkAttribute( r1bQ, 'alignment' ) ).to.be.false;
} );

it( 'rejects attribute $root>image[indent]', () => {
expect( schema.checkAttribute( r1i, 'indent' ) ).to.be.false;
expect( schema.checkAttribute( r1i, 'listIndent' ) ).to.be.false;
} );

it( 'rejects attribute $root>image[alignment]', () => {
Expand Down
26 changes: 13 additions & 13 deletions tests/model/utils/insertcontent.js
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ describe( 'DataController utils', () => {
} );
schema.register( 'listItem', {
inheritAllFrom: '$block',
allowAttributes: [ 'type', 'indent' ]
allowAttributes: [ 'listType', 'listIndent' ]
} );
} );

Expand Down Expand Up @@ -370,40 +370,40 @@ describe( 'DataController utils', () => {

it( 'inserts one list item', () => {
setData( model, '<paragraph>f[]oo</paragraph>' );
insertHelper( '<listItem indent="0" type="bulleted">xyz</listItem>' );
insertHelper( '<listItem listIndent="0" listType="bulleted">xyz</listItem>' );
expect( getData( model ) ).to.equal( '<paragraph>fxyz[]oo</paragraph>' );
} );

it( 'inserts list item to empty element', () => {
setData( model, '<paragraph>[]</paragraph>' );
insertHelper( '<listItem indent="0" type="bulleted">xyz</listItem>' );
expect( getData( model ) ).to.equal( '<listItem indent="0" type="bulleted">xyz[]</listItem>' );
insertHelper( '<listItem listIndent="0" listType="bulleted">xyz</listItem>' );
expect( getData( model ) ).to.equal( '<listItem listIndent="0" listType="bulleted">xyz[]</listItem>' );
} );

it( 'inserts three list items at the end of paragraph', () => {
setData( model, '<paragraph>foo[]</paragraph>' );
insertHelper(
'<listItem indent="0" type="bulleted">xxx</listItem>' +
'<listItem indent="0" type="bulleted">yyy</listItem>' +
'<listItem indent="0" type="bulleted">zzz</listItem>'
'<listItem listIndent="0" listType="bulleted">xxx</listItem>' +
'<listItem listIndent="0" listType="bulleted">yyy</listItem>' +
'<listItem listIndent="0" listType="bulleted">zzz</listItem>'
);
expect( getData( model ) ).to.equal(
'<paragraph>fooxxx</paragraph>' +
'<listItem indent="0" type="bulleted">yyy</listItem>' +
'<listItem indent="0" type="bulleted">zzz[]</listItem>'
'<listItem listIndent="0" listType="bulleted">yyy</listItem>' +
'<listItem listIndent="0" listType="bulleted">zzz[]</listItem>'
);
} );

it( 'inserts two list items to an empty paragraph', () => {
setData( model, '<paragraph>a</paragraph><paragraph>[]</paragraph><paragraph>b</paragraph>' );
insertHelper(
'<listItem indent="0" type="bulleted">xxx</listItem>' +
'<listItem indent="0" type="bulleted">yyy</listItem>'
'<listItem listIndent="0" listType="bulleted">xxx</listItem>' +
'<listItem listIndent="0" listType="bulleted">yyy</listItem>'
);
expect( getData( model ) ).to.equal(
'<paragraph>a</paragraph>' +
'<listItem indent="0" type="bulleted">xxx</listItem>' +
'<listItem indent="0" type="bulleted">yyy[]</listItem>' +
'<listItem listIndent="0" listType="bulleted">xxx</listItem>' +
'<listItem listIndent="0" listType="bulleted">yyy[]</listItem>' +
'<paragraph>b</paragraph>'
);
} );
Expand Down

0 comments on commit b128b66

Please sign in to comment.