tackle a todo, implement vscode.TabGroups with the ExtHostTabGroups/apiObject trick, enforce and test readonly-ness, fyi @lramos15

This commit is contained in:
Johannes
2022-03-17 13:01:19 +01:00
parent 249e999a0b
commit b88f400ec8
3 changed files with 76 additions and 22 deletions

View File

@@ -317,4 +317,30 @@ suite('ExtHostEditorTabs', function () {
assert.strictEqual(activeTab2?.isActive, true);
assert.strictEqual(activeTab1?.isActive, false);
});
test('vscode.window.tagGroups is immutable', function () {
const extHostEditorTabs = new ExtHostEditorTabs(
SingleProxyRPCProtocol(new class extends mock<MainThreadEditorTabsShape>() {
// override/implement $moveTab or $closeTab
})
);
assert.throws(() => {
// @ts-expect-error write to readonly prop
extHostEditorTabs.tabGroups.activeTabGroup = undefined;
});
assert.throws(() => {
// @ts-expect-error write to readonly prop
extHostEditorTabs.tabGroups.groups.length = 0;
});
assert.throws(() => {
// @ts-expect-error write to readonly prop
extHostEditorTabs.tabGroups.onDidChangeActiveTabGroup = undefined;
});
assert.throws(() => {
// @ts-expect-error write to readonly prop
extHostEditorTabs.tabGroups.onDidChangeTabGroup = undefined;
});
});
});