Introduce options service

This commit is contained in:
Daniel Imms
2019-06-01 09:29:11 -07:00
parent 343d4c3348
commit 3ba7069787
12 changed files with 361 additions and 252 deletions
+28 -28
View File
@@ -43,7 +43,7 @@ describe('Terminal', () => {
});
it('should not mutate the options parameter', () => {
term.setOption('cols', 1000);
term.options.cols = 1000;
assert.deepEqual(termOptions, {
cols: INIT_COLS,
@@ -51,21 +51,21 @@ describe('Terminal', () => {
});
});
describe('getOption', () => {
it('should retrieve the option correctly', () => {
// In the `options` namespace.
term.options.cursorBlink = true;
assert.equal(term.getOption('cursorBlink'), true);
// describe('getOption', () => {
// it('should retrieve the option correctly', () => {
// // In the `options` namespace.
// term.options.cursorBlink = true;
// assert.equal(term.getOption('cursorBlink'), true);
// On the Terminal instance
delete term.options.cursorBlink;
term.options.cursorBlink = false;
assert.equal(term.getOption('cursorBlink'), false);
});
it('should throw when retrieving a non-existant option', () => {
assert.throws(term.getOption.bind(term, 'fake', true));
});
});
// // On the Terminal instance
// delete term.options.cursorBlink;
// term.options.cursorBlink = false;
// assert.equal(term.getOption('cursorBlink'), false);
// });
// it('should throw when retrieving a non-existant option', () => {
// assert.throws(term.getOption.bind(term, 'fake', true));
// });
// });
describe('events', () => {
it('should fire the onData evnet', (done) => {
@@ -335,17 +335,17 @@ describe('Terminal', () => {
});
});
describe('setOption', () => {
it('should set option correctly', () => {
term.setOption('cursorBlink', true);
assert.equal(term.options.cursorBlink, true);
term.setOption('cursorBlink', false);
assert.equal(term.options.cursorBlink, false);
});
it('should throw when setting a non-existant option', () => {
assert.throws(term.setOption.bind(term, 'fake', true));
});
});
// describe('setOption', () => {
// it('should set option correctly', () => {
// term.setOption('cursorBlink', true);
// assert.equal(term.options.cursorBlink, true);
// term.setOption('cursorBlink', false);
// assert.equal(term.options.cursorBlink, false);
// });
// it('should throw when setting a non-existant option', () => {
// assert.throws(term.setOption.bind(term, 'fake', true));
// });
// });
describe('reset', () => {
it('should not affect cursorState', () => {
@@ -625,7 +625,7 @@ describe('Terminal', () => {
describe('when scrollback === 0', () => {
beforeEach(() => {
term.setOption('scrollback', 0);
term.optionsService.setOption('scrollback', 0);
assert.equal(term.buffer.lines.maxLength, INIT_ROWS);
});
@@ -730,7 +730,7 @@ describe('Terminal', () => {
describe('with macOptionIsMeta', () => {
beforeEach(() => {
term.browser.isMac = true;
term.setOption('macOptionIsMeta', true);
term.options.macOptionIsMeta = true;
});
it('should interfere with the alt key on keyDown', () => {