This commit is contained in:
Logan Ramos 2022-02-17 15:15:44 -05:00
parent a34d50b8b9
commit 8437d74b8b
No known key found for this signature in database
GPG key ID: D9CCFF14F0B18183

View file

@ -393,6 +393,42 @@ suite('vscode API - window', () => {
await group1Tabs[0].move(1, ViewColumn.One);
});
test('Tabs - vscode.open & vscode.diff', async function () {
// Simple function to get the active tab
const getActiveTab = () => {
return window.tabGroups.all.find(g => g.isActive)?.activeTab;
};
const [docA, docB, docC] = await Promise.all([
workspace.openTextDocument(await createRandomFile()),
workspace.openTextDocument(await createRandomFile()),
workspace.openTextDocument(await createRandomFile())
]);
await window.showTextDocument(docA, { viewColumn: ViewColumn.One, preview: false });
await window.showTextDocument(docB, { viewColumn: ViewColumn.One, preview: false });
await window.showTextDocument(docC, { viewColumn: ViewColumn.Two, preview: false });
const commandFile = await createRandomFile();
await commands.executeCommand('vscode.open', commandFile, ViewColumn.Three);
// Ensure active tab is correct after calling vscode.opn
assert.strictEqual(getActiveTab()?.viewColumn, ViewColumn.Three);
const leftDiff = await createRandomFile();
const rightDiff = await createRandomFile();
await commands.executeCommand('vscode.diff', leftDiff, rightDiff, 'Diff', { viewColumn: ViewColumn.Four, preview: false });
assert.strictEqual(getActiveTab()?.viewColumn, ViewColumn.Four);
const tabs = window.tabGroups.all.map(g => g.tabs).flat(1);
assert.strictEqual(tabs.length, 5);
assert.strictEqual(tabs[0].resource?.toString(), docA.uri.toString());
assert.strictEqual(tabs[1].resource?.toString(), docB.uri.toString());
assert.strictEqual(tabs[2].resource?.toString(), docC.uri.toString());
assert.strictEqual(tabs[3].resource?.toString(), commandFile.toString());
});
test('Tabs - Ensure tabs getter is correct', async function () {
// Reduce test timeout as this test should be quick, so even with 3 retries it will be under 60s.
this.timeout(10000);