How to use the @ckeditor/ckeditor5-utils/src/keyboard.keyCodes.arrowdown function in @ckeditor/ckeditor5-utils

To help you get started, we’ve selected a few @ckeditor/ckeditor5-utils 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
const clock = testUtils.sinon.useFakeTimers();
		const spy = sinon.spy();

		viewDocument.on( 'selectionChangeDone', spy );

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

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

		// Check if spy was called.
		sinon.assert.notCalled( spy );

		// Change selection one more time.
		changeFakeSelectionPressing( keyCodes.arrowdown );

		// Wait 210ms (debounced function should be called).
		clock.tick( 210 );
		sinon.assert.calledOnce( spy );
	} );
github ckeditor / ckeditor5-engine / src / view / observer / fakeselectionobserver.js View on Github external
_handleSelectionMove( keyCode ) {
		const selection = this.document.selection;
		const newSelection = new ViewSelection( selection.getRanges(), { backward: selection.isBackward, fake: false } );

		// Left or up arrow pressed - move selection to start.
		if ( keyCode == keyCodes.arrowleft || keyCode == keyCodes.arrowup ) {
			newSelection.setTo( newSelection.getFirstPosition() );
		}

		// Right or down arrow pressed - move selection to end.
		if ( keyCode == keyCodes.arrowright || keyCode == keyCodes.arrowdown ) {
			newSelection.setTo( newSelection.getLastPosition() );
		}

		const data = {
			oldSelection: selection,
			newSelection,
			domSelection: null
		};

		// Fire dummy selection change event.
		this.document.fire( 'selectionChange', data );

		// Call` #_fireSelectionChangeDoneDebounced` every time when `selectionChange` event is fired.
		// This function is debounced what means that `selectionChangeDone` event will be fired only when
		// defined int the function time will elapse since the last time the function was called.
		// So `selectionChangeDone` will be fired when selection will stop changing.
github ckeditor / ckeditor5-engine / tests / view / observer / fakeselectionobserver.js View on Github external
it( 'should fire selectionChange event with new selection when down arrow key is pressed', () => {
		return checkSelectionChange(
			'foo[<strong>bar</strong>]baz',
			keyCodes.arrowdown,
			'foo<strong>bar</strong>[]baz'
		);
	} );
github ckeditor / ckeditor5-media-embed / tests / ui / mediaformview.js View on Github external
it( 'intercepts the arrow* events and overrides the default toolbar behavior', () => {
			const keyEvtData = {
				stopPropagation: sinon.spy()
			};

			keyEvtData.keyCode = keyCodes.arrowdown;
			view.keystrokes.press( keyEvtData );
			sinon.assert.calledOnce( keyEvtData.stopPropagation );

			keyEvtData.keyCode = keyCodes.arrowup;
			view.keystrokes.press( keyEvtData );
			sinon.assert.calledTwice( keyEvtData.stopPropagation );

			keyEvtData.keyCode = keyCodes.arrowleft;
			view.keystrokes.press( keyEvtData );
			sinon.assert.calledThrice( keyEvtData.stopPropagation );

			keyEvtData.keyCode = keyCodes.arrowright;
			view.keystrokes.press( keyEvtData );
			sinon.assert.callCount( keyEvtData.stopPropagation, 4 );
		} );
github ckeditor / ckeditor5-image / tests / widget / widget.js View on Github external
'[]foo',
				{ keyCode: keyCodes.arrowright, altKey: true },
				'[]foo'
			);

			test(
				'should work correctly with modifier key: right arrow + shift',
				'[]foo',
				{ keyCode: keyCodes.arrowright, shiftKey: true },
				'[]foo'
			);

			test(
				'should work correctly with modifier key: down arrow + ctrl',
				'[]foo',
				{ keyCode: keyCodes.arrowdown, ctrlKey: true },
				'[]foo'
			);

			test(
				'should work correctly with modifier key: down arrow + alt',
				'[]foo',
				{ keyCode: keyCodes.arrowdown, altKey: true },
				'[]foo'
			);

			test(
				'should work correctly with modifier key: down arrow + shift',
				'[]foo',
				{ keyCode: keyCodes.arrowdown, shiftKey: true },
				'[]foo'
			);
github ckeditor / ckeditor5-engine / tests / view / observer / fakeselectionobserver.js View on Github external
it( 'should prevent default for down arrow key', ( ) => {
		return checkEventPrevention( keyCodes.arrowdown );
	} );
github ckeditor / ckeditor5-image / tests / widget / widget.js View on Github external
'[]foo',
				keyCodes.arrowup,
				'[]foo'
			);

			test(
				'do nothing on non objects - right arrow',
				'foo[]bar',
				keyCodes.arrowright,
				'foo[]bar'
			);

			test(
				'do nothing on non objects - down arrow',
				'foo[]bar',
				keyCodes.arrowdown,
				'foo[]bar'
			);

			test(
				'do nothing on non objects - left arrow',
				'foo[]bar',
				keyCodes.arrowleft,
				'foo[]bar'
			);

			test(
				'do nothing on non objects - up arrow',
				'foo[]bar',
				keyCodes.arrowup,
				'foo[]bar'
			);
github ckeditor / ckeditor5-image / src / widget / widget.js View on Github external
function isArrowKeyCode( keyCode ) {
	return keyCode == keyCodes.arrowright ||
		keyCode == keyCodes.arrowleft ||
		keyCode == keyCodes.arrowup ||
		keyCode == keyCodes.arrowdown;
}