-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Expand coverage for commands related to selection filtering.
- Loading branch information
1 parent
0c58b24
commit 56c9115
Showing
1 changed file
with
120 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,120 @@ | ||
import '@wdio/globals'; | ||
import 'wdio-vscode-service'; | ||
import {cleanWhitespace, setupEditor, storeCoverageStats} from './utils.mts'; | ||
import {sleep, TextEditor} from 'wdio-vscode-service'; | ||
|
||
describe('Number changes', () => { | ||
let editor: TextEditor; | ||
|
||
async function setupCursors() { | ||
await browser.executeWorkbench(vscode => { | ||
vscode.commands.executeCommand('selection-utilities.cancelSelection'); | ||
}); | ||
|
||
await editor.moveCursor(1, 1); | ||
|
||
for (let i = 0; i < 3; i++) { | ||
await browser.executeWorkbench(async vscode => { | ||
await vscode.commands.executeCommand('editor.action.insertCursorBelow'); | ||
}); | ||
sleep(100); | ||
} | ||
|
||
await browser.executeWorkbench(vscode => { | ||
vscode.commands.executeCommand('selection-utilities.moveBy', { | ||
unit: 'word', | ||
value: 1, | ||
boundary: 'both', | ||
selectWhole: true, | ||
}); | ||
}); | ||
} | ||
|
||
async function setup() { | ||
editor = await setupEditor(`joe | ||
moe | ||
bill | ||
phill | ||
`); | ||
|
||
await setupCursors(); | ||
await sleep(100); | ||
} | ||
|
||
it('can filter by inclusion', async () => { | ||
await setup(); | ||
await browser.executeWorkbench(async vscode => { | ||
await vscode.commands.executeCommand('selection-utilities.includeBy', { | ||
text: 'oe', | ||
}); | ||
await vscode.commands.executeCommand('deleteRight'); | ||
}); | ||
|
||
expect(await editor.getText()).toEqual( | ||
cleanWhitespace(` | ||
bill | ||
phill | ||
`) | ||
); | ||
}); | ||
|
||
it('can filter by exclusion', async () => { | ||
await setup(); | ||
await setup(); | ||
await browser.executeWorkbench(async vscode => { | ||
await vscode.commands.executeCommand('selection-utilities.excludeBy', { | ||
text: 'oe', | ||
}); | ||
await vscode.commands.executeCommand('deleteRight'); | ||
}); | ||
|
||
expect(await editor.getText()).toEqual( | ||
cleanWhitespace(`joe | ||
moe | ||
`) | ||
); | ||
}); | ||
|
||
it('can filter by regex inclusion', async () => { | ||
await setup(); | ||
await browser.executeWorkbench(async vscode => { | ||
await vscode.commands.executeCommand('selection-utilities.includeByRegex', { | ||
text: '^[jb]', | ||
}); | ||
await vscode.commands.executeCommand('deleteRight'); | ||
}); | ||
|
||
expect(await editor.getText()).toEqual( | ||
cleanWhitespace(` | ||
moe | ||
phill | ||
`) | ||
); | ||
}); | ||
|
||
it('can filter by regex exclusion', async () => { | ||
await setup(); | ||
await browser.executeWorkbench(async vscode => { | ||
await vscode.commands.executeCommand('selection-utilities.excludeByRegex', { | ||
text: '^[jb]', | ||
}); | ||
await vscode.commands.executeCommand('deleteRight'); | ||
}); | ||
|
||
expect(await editor.getText()).toEqual( | ||
cleanWhitespace(`joe | ||
bill | ||
`) | ||
); | ||
}); | ||
|
||
after(async () => { | ||
await storeCoverageStats('filterSelections'); | ||
}); | ||
}); |