How to use the @ckeditor/ckeditor5-core/tests/_utils/utils.sinon function in @ckeditor/ckeditor5-core

To help you get started, we’ve selected a few @ckeditor/ckeditor5-core examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ckeditor / ckeditor5-engine / tests / view / observer / fakeselectionobserver.js View on Github external
it( 'should not fire `selectionChangeDone` event when observer will be destroyed', () => {
		const clock = testUtils.sinon.useFakeTimers();
		const spy = sinon.spy();

		viewDocument.on( 'selectionChangeDone', spy );

		// Change selection.
		changeFakeSelectionPressing( keyCodes.arrowdown );

		// Wait 100ms.
		clock.tick( 100 );

		// And destroy observer.
		observer.destroy();

		// Wait another 110ms.
		clock.tick( 110 );
github ckeditor / ckeditor5-image / tests / integration.js View on Github external
beforeEach( () => {
			// Most tests assume non-edge environment but we do not set `contenteditable=false` on Edge so stub `env.isEdge`.
			testUtils.sinon.stub( env, 'isEdge' ).get( () => false );

			editorElement = global.document.createElement( 'div' );
			global.document.body.appendChild( editorElement );

			return ClassicTestEditor
				.create( editorElement, {
					plugins: [ Image, ImageToolbar, BalloonToolbar, Paragraph ]
				} )
				.then( editor => {
					newEditor = editor;
					balloon = newEditor.plugins.get( 'ContextualBalloon' );
					balloonToolbar = newEditor.plugins.get( 'BalloonToolbar' );
					const button = new View();

					button.element = global.document.createElement( 'div' );
github ckeditor / ckeditor5-image / tests / imagestyle / imagestyleediting.js View on Github external
beforeEach( () => {
		// Most tests assume non-edge environment but we do not set `contenteditable=false` on Edge so stub `env.isEdge`.
		testUtils.sinon.stub( env, 'isEdge' ).get( () => false );
	} );
github ckeditor / ckeditor5-table / tests / converters / table-cell-refresh-post-fixer.js View on Github external
beforeEach( () => {
		element = document.createElement( 'div' );
		document.body.appendChild( element );

		// Most tests assume non-edge environment but we do not set `contenteditable=false` on Edge so stub `env.isEdge`.
		testUtils.sinon.stub( env, 'isEdge' ).get( () => false );

		return ClassicTestEditor.create( element, { extraPlugins: [ Delete ] } )
			.then( newEditor => {
				editor = newEditor;
				model = editor.model;
				doc = model.document;
				root = doc.getRoot( 'main' );
				view = editor.editing.view;

				defaultSchema( model.schema );
				defaultConversion( editor.conversion, true );

				editor.model.schema.register( 'block', {
					inheritAllFrom: '$block'
				} );
				editor.conversion.elementToElement( { model: 'block', view: 'div' } );
github ckeditor / ckeditor5-font / tests / fontfamily / fontfamilyui.js View on Github external
it( 'should focus view after command execution', () => {
			const focusSpy = testUtils.sinon.spy( editor.editing.view, 'focus' );
			const dropdown = editor.ui.componentFactory.create( 'fontFamily' );

			dropdown.commandName = 'fontFamily';
			dropdown.fire( 'execute' );

			sinon.assert.calledOnce( focusSpy );
		} );
github ckeditor / ckeditor5-engine / tests / model / liveselection.js View on Github external
it( 'should not add a range that is in graveyard', () => {
			const spy = testUtils.sinon.stub( log, 'warn' );

			selection.addRange( Range.createIn( doc.graveyard ) );

			expect( selection._ranges.length ).to.equal( 0 );
			expect( spy.calledOnce ).to.be.true;
		} );
github ckeditor / ckeditor5-highlight / tests / highlightui.js View on Github external
it( 'should focus view after command execution', () => {
				const focusSpy = testUtils.sinon.spy( editor.editing.view, 'focus' );

				dropdown.buttonView.commandName = 'highlight';
				dropdown.buttonView.fire( 'execute' );

				sinon.assert.calledOnce( focusSpy );
			} );
		} );
github ckeditor / ckeditor5-image / tests / image / ui / imageballoon.js View on Github external
it( 'should remove a view', () => {
			const spy = testUtils.sinon.stub( ContextualBalloon.prototype, 'remove' );
			const view = {};

			plugin.remove( view );
			sinon.assert.calledOnce( spy );
		} );
	} );
github ckeditor / ckeditor5-media-embed / tests / mediaembedtoolbar.js View on Github external
beforeEach( () => {
		element = document.createElement( 'div' );
		document.body.appendChild( element );
		clock = testUtils.sinon.useFakeTimers();

		return BalloonEditor.create( element, {
			plugins: [ Paragraph, MediaEmbed, MediaEmbedToolbar, FakeButton, Bold ],
			balloonToolbar: [ 'bold' ],
			media: {
				toolbar: [ 'fake_button' ]
			}
		} ).then( _editor => {
			editor = _editor;
			model = editor.model;
			widgetToolbarRepository = editor.plugins.get( 'WidgetToolbarRepository' );
			toolbar = widgetToolbarRepository._toolbarDefinitions.get( 'mediaEmbed' ).view;
			balloon = editor.plugins.get( 'ContextualBalloon' );
			balloonToolbar = editor.plugins.get( 'BalloonToolbar' );
		} );
	} );
github ckeditor / ckeditor5-image / tests / imagetextalternative / ui / textalternativeformview.js View on Github external
beforeEach( () => {
		testUtils.sinon.stub( env, 'isEdge' ).get( () => false );

		view = new TextAlternativeFormView( { t: () => {} } );
	} );