mirror of
https://github.com/Microsoft/vscode
synced 2024-08-26 20:39:37 +00:00
Fix #139786
This commit is contained in:
parent
a34d50b8b9
commit
8437d74b8b
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue