Move cursorState into core service
This commit is contained in:
@@ -43,6 +43,9 @@ export class MockCoreMouseService implements ICoreMouseService {
|
||||
}
|
||||
|
||||
export class MockCoreService implements ICoreService {
|
||||
isCursorInitialized: boolean = false;
|
||||
isCursorHidden: boolean = false;
|
||||
isFocused: boolean = false;
|
||||
serviceBrand: any;
|
||||
decPrivateModes: IDecPrivateModes = {} as any;
|
||||
onData: IEvent<string> = new EventEmitter<string>().event;
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
/**
|
||||
* Copyright (c) 2019 The xterm.js authors. All rights reserved.
|
||||
* @license MIT
|
||||
*/
|
||||
|
||||
import { ICoreService } from 'common/services/Services';
|
||||
import { CoreService } from 'common/services/CoreService';
|
||||
import { MockBufferService, MockLogService, MockOptionsService } from 'common/TestUtils.test';
|
||||
import { assert } from 'chai';
|
||||
|
||||
describe('CoreService', () => {
|
||||
let coreService: ICoreService;
|
||||
|
||||
beforeEach(() => {
|
||||
coreService = new CoreService(
|
||||
() => {},
|
||||
new MockBufferService(80, 30),
|
||||
new MockLogService(),
|
||||
new MockOptionsService());
|
||||
});
|
||||
|
||||
describe('reset', () => {
|
||||
it('should not affect isCursorInitialized', () => {
|
||||
coreService.isCursorInitialized = true;
|
||||
coreService.reset();
|
||||
assert.equal(coreService.isCursorInitialized, true);
|
||||
coreService.isCursorInitialized = false;
|
||||
coreService.reset();
|
||||
assert.equal(coreService.isCursorInitialized, false);
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -15,6 +15,9 @@ const DEFAULT_DEC_PRIVATE_MODES: IDecPrivateModes = Object.freeze({
|
||||
export class CoreService implements ICoreService {
|
||||
serviceBrand: any;
|
||||
|
||||
public isCursorInitialized: boolean = false;
|
||||
public isCursorHidden: boolean = false;
|
||||
public isFocused: boolean = false;
|
||||
public decPrivateModes: IDecPrivateModes;
|
||||
|
||||
private _onData = new EventEmitter<string>();
|
||||
|
||||
@@ -58,6 +58,13 @@ export const ICoreService = createDecorator<ICoreService>('CoreService');
|
||||
export interface ICoreService {
|
||||
serviceBrand: any;
|
||||
|
||||
/**
|
||||
* Initially the cursor will not be visible until the first time the terminal
|
||||
* is focused.
|
||||
*/
|
||||
isCursorInitialized: boolean;
|
||||
isCursorHidden: boolean;
|
||||
isFocused: boolean;
|
||||
readonly decPrivateModes: IDecPrivateModes;
|
||||
|
||||
readonly onData: IEvent<string>;
|
||||
|
||||
Reference in New Issue
Block a user