use a proxy

This commit is contained in:
Simon Lamon
2021-11-20 14:58:07 +00:00
parent 1a8ac80cdf
commit d6d540e748
2 changed files with 39 additions and 38 deletions
+7 -2
View File
@@ -10,11 +10,16 @@ describe('OptionsService', () => {
describe('constructor', () => {
const originalError = console.error;
beforeEach(() => {
console.error = () => {};
console.error = () => { };
});
afterEach(() => {
console.error = originalError;
});
it('publicOptions and options are modifying the same object', () => {
const optionsService = new OptionsService({ cols: undefined, rows: undefined });
optionsService.options.rows = 25;
assert.equal(optionsService.publicOptions.rows, 25);
});
it('uses default value if invalid constructor option values passed for cols/rows', () => {
const optionsService = new OptionsService({ cols: undefined, rows: undefined });
assert.equal(optionsService.getOption('rows'), DEFAULT_OPTIONS.rows);
@@ -26,7 +31,7 @@ describe('OptionsService', () => {
assert.equal(optionsService.getOption('cols'), 80);
});
it('uses default value if invalid constructor option value passed', () => {
assert.equal(new OptionsService({tabStopWidth: 0}).getOption('tabStopWidth'), DEFAULT_OPTIONS.tabStopWidth);
assert.equal(new OptionsService({ tabStopWidth: 0 }).getOption('tabStopWidth'), DEFAULT_OPTIONS.tabStopWidth);
});
});
describe('setOption', () => {