Merge remote-tracking branch 'upstream/master' into 361_circular_list_scrollback
This commit is contained in:
@@ -1,12 +1,7 @@
|
||||
/**
|
||||
* xterm.js: xterm, in the browser
|
||||
* Copyright (c) 2016, SourceLair Private Company <www.sourcelair.com> (MIT License)
|
||||
*/
|
||||
|
||||
/**
|
||||
* Browser utilities module. This module contains attributes and methods to help with
|
||||
* identifying the current browser and platform.
|
||||
* Attributes and methods to help with identifying the current browser and platform.
|
||||
* @module xterm/utils/Browser
|
||||
* @license MIT
|
||||
*/
|
||||
|
||||
import { contains } from './Generic.js';
|
||||
|
||||
@@ -1,12 +1,7 @@
|
||||
/**
|
||||
* xterm.js: xterm, in the browser
|
||||
* Copyright (c) 2016, SourceLair Private Company <www.sourcelair.com> (MIT License)
|
||||
*/
|
||||
|
||||
/**
|
||||
* Generic utilities module. This module contains generic methods that can be helpful at
|
||||
* different parts of the code base.
|
||||
* Generic utilities module with methods that can be helpful at different parts of the code base.
|
||||
* @module xterm/utils/Generic
|
||||
* @license MIT
|
||||
*/
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
import { assert } from 'chai';
|
||||
import * as Keyboard from './Keyboard';
|
||||
|
||||
describe('Keyboard', () => {
|
||||
describe('isModifierOnlyKeyboardEvent', () => {
|
||||
it('should return true when only modifier keys are used', () => {
|
||||
// Note that KeyboardEvent.keyCode is deprecated but we're using it to improve browser
|
||||
// compatibility. This helper returns the `any` type because KeyboardEvent doesn't exist under
|
||||
// NodeJS.
|
||||
function createEvent(keyCode: number): any {
|
||||
return { keyCode };
|
||||
}
|
||||
assert.isTrue(Keyboard.isModifierOnlyKeyboardEvent(createEvent(16)));
|
||||
assert.isTrue(Keyboard.isModifierOnlyKeyboardEvent(createEvent(17)));
|
||||
assert.isTrue(Keyboard.isModifierOnlyKeyboardEvent(createEvent(18)));
|
||||
assert.isTrue(Keyboard.isModifierOnlyKeyboardEvent(createEvent(91)));
|
||||
assert.isFalse(Keyboard.isModifierOnlyKeyboardEvent(createEvent(19)));
|
||||
assert.isFalse(Keyboard.isModifierOnlyKeyboardEvent(createEvent(90)));
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -1,22 +0,0 @@
|
||||
/**
|
||||
* xterm.js: xterm, in the browser
|
||||
* Copyright (c) 2016, SourceLair Private Company <www.sourcelair.com> (MIT License)
|
||||
*/
|
||||
|
||||
/**
|
||||
* Keyboard utilities module. This module contains utilities for dealing with keyboard interaction.
|
||||
* @module xterm/utils/Keyboard
|
||||
*/
|
||||
|
||||
/**
|
||||
* Gets whether a KeyboardEvent is made up entirely of modifier keys.
|
||||
*
|
||||
* @param event The event to check.
|
||||
* @return Whether the KeyboardEvent is made up entirely of modifier keys.
|
||||
*/
|
||||
export function isModifierOnlyKeyboardEvent(event: KeyboardEvent): boolean {
|
||||
return event.keyCode === 16 || // Shift
|
||||
event.keyCode === 17 || // Control
|
||||
event.keyCode === 18 || // Alt
|
||||
event.keyCode === 91; // Meta
|
||||
}
|
||||
Reference in New Issue
Block a user