Преглед изворни кода

Got back to the origina logic of these tests.

Piotrek Koszuliński пре 7 година
родитељ
комит
6036dae282
1 измењених фајлова са 6 додато и 7 уклоњено
  1. 6 7
      packages/ckeditor5-ui/tests/toolbar/block/blocktoolbar.js

+ 6 - 7
packages/ckeditor5-ui/tests/toolbar/block/blocktoolbar.js

@@ -227,10 +227,9 @@ describe( 'BlockToolbar', () => {
 		} );
 
 		it( 'should not display the button when the selection is placed in a root element', () => {
-			editor.model.schema.register( 'foo', { allowIn: '$root', allowContentOf: [ 'paragraph' ], isObject: true } );
-			editor.conversion.elementToElement( { model: 'foo', view: 'foo' } );
+			editor.model.schema.extend( '$text', { allowIn: '$root' } );
 
-			setData( editor.model, '<paragraph>foo</paragraph><foo>[]</foo><paragraph>bar</paragraph>' );
+			setData( editor.model, '<paragraph>foo</paragraph>[]<paragraph>bar</paragraph>' );
 
 			expect( blockToolbar.buttonView.isVisible ).to.be.false;
 		} );
@@ -403,12 +402,12 @@ describe( 'BlockToolbar', () => {
 		} );
 
 		it( 'should update the button position on browser resize only when the button is visible', () => {
-			editor.model.schema.register( 'foo', { allowIn: '$root', allowContentOf: [ 'paragraph' ], isObject: true } );
-			editor.conversion.elementToElement( { model: 'foo', view: 'foo' } );
+			editor.model.schema.extend( '$text', { allowIn: '$root' } );
 
 			const spy = testUtils.sinon.spy( blockToolbar, '_attachButtonToElement' );
 
-			setData( editor.model, '<foo>[]</foo><paragraph>bar</paragraph>' );
+			// Place the selection outside of any block because the toolbar will not be shown in this case.
+			setData( editor.model, '[]<paragraph>bar</paragraph>' );
 
 			window.dispatchEvent( new Event( 'resize' ) );
 
@@ -422,7 +421,7 @@ describe( 'BlockToolbar', () => {
 
 			sinon.assert.called( spy );
 
-			setData( editor.model, '<foo>[]</foo><paragraph>bar</paragraph>' );
+			setData( editor.model, '[]<paragraph>bar</paragraph>' );
 
 			spy.resetHistory();