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

Commit

Permalink
Tests: Change the name of helper function.
Browse files Browse the repository at this point in the history
  • Loading branch information
scofalik committed Aug 9, 2018
1 parent 6dca97e commit 3d9af07
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions tests/model/schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -1121,7 +1121,7 @@ describe( 'Schema', () => {
schema.extend( '$text', { allowIn: '$root' } );
} );

function test( input, attribute, output ) {
function testValidRangesForAttribute( input, attribute, output ) {
setData( model, input );

const validRanges = schema.getValidRanges( doc.selection.getRanges(), attribute );
Expand All @@ -1133,7 +1133,7 @@ describe( 'Schema', () => {
it( 'should return a range with p for an attribute allowed only on p', () => {
schema.extend( 'p', { allowAttributes: 'foo' } );

test(
testValidRangesForAttribute(
'[<p>foo<img></img>bar</p>]',
'foo',
'[<p>foo<img></img>bar</p>]'
Expand All @@ -1143,7 +1143,7 @@ describe( 'Schema', () => {
it( 'should return ranges on text nodes for an attribute allowed only on text', () => {
schema.extend( '$text', { allowAttributes: 'bold' } );

test(
testValidRangesForAttribute(
'[<p>foo<img></img>bar</p>]',
'bold',
'<p>[foo]<img></img>[bar]</p>'
Expand All @@ -1153,7 +1153,7 @@ describe( 'Schema', () => {
it( 'should return a range on img for an attribute allowed only on img', () => {
schema.extend( 'img', { allowAttributes: 'src' } );

test(
testValidRangesForAttribute(
'[<p>foo<img></img>bar</p>]',
'src',
'<p>foo[<img></img>]bar</p>'
Expand All @@ -1164,7 +1164,7 @@ describe( 'Schema', () => {
schema.extend( '$text', { allowAttributes: 'bold' } );
schema.extend( 'img', { allowAttributes: 'bold' } );

test(
testValidRangesForAttribute(
'[<p>foo<img></img>bar</p>]',
'bold',
'<p>[foo<img></img>bar]</p>'
Expand Down Expand Up @@ -1192,7 +1192,7 @@ describe( 'Schema', () => {
it( 'should not break a range if children are not allowed to have the attribute', () => {
schema.extend( 'p', { allowAttributes: 'foo' } );

test(
testValidRangesForAttribute(
'[<p>foo</p><p>bar</p>]',
'foo',
'[<p>foo</p><p>bar</p>]'
Expand All @@ -1202,7 +1202,7 @@ describe( 'Schema', () => {
it( 'should search deeply', () => {
schema.extend( '$text', { allowAttributes: 'bold', allowIn: 'img' } );

test(
testValidRangesForAttribute(
'[<p>foo<img>xxx</img>bar</p>]',
'bold',
'<p>[foo]<img>[xxx]</img>[bar]</p>'
Expand All @@ -1212,7 +1212,7 @@ describe( 'Schema', () => {
it( 'should work with multiple ranges', () => {
schema.extend( '$text', { allowAttributes: 'bold' } );

test(
testValidRangesForAttribute(
'[<p>a</p><p>b</p>]<p>c</p><p>[d]</p>',
'bold',
'<p>[a]</p><p>[b]</p><p>c</p><p>[d]</p>'
Expand All @@ -1222,7 +1222,7 @@ describe( 'Schema', () => {
it( 'should work with non-flat ranges', () => {
schema.extend( '$text', { allowAttributes: 'bold' } );

test(
testValidRangesForAttribute(
'[<p>a</p><p>b</p><p>c]</p><p>d</p>',
'bold',
'<p>[a]</p><p>[b]</p><p>[c]</p><p>d</p>'
Expand All @@ -1232,7 +1232,7 @@ describe( 'Schema', () => {
it( 'should not leak beyond the given ranges', () => {
schema.extend( '$text', { allowAttributes: 'bold' } );

test(
testValidRangesForAttribute(
'[<p>foo</p><p>b]a[r</p><p>x]yz</p>',
'bold',
'<p>[foo]</p><p>[b]a[r]</p><p>[x]yz</p>'
Expand All @@ -1249,7 +1249,7 @@ describe( 'Schema', () => {
}
} );

test(
testValidRangesForAttribute(
'[<p>foo<img>xx]x</img>bar</p>',
'bold',
'<p>[foo]<img>xxx</img>bar</p>'
Expand Down

0 comments on commit 3d9af07

Please sign in to comment.