Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Coverage for splitBy and friends #71

Merged
merged 2 commits into from
Dec 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -482,4 +482,4 @@
"@wdio/spec-reporter": "^8.40.3",
"ts-node": "^10.9.2"
}
}
}
2 changes: 1 addition & 1 deletion test/specs/filterSelections.ux.mts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import 'wdio-vscode-service';
import {cleanWhitespace, setupEditor, storeCoverageStats} from './utils.mts';
import {sleep, TextEditor} from 'wdio-vscode-service';

describe('Number changes', () => {
describe('Selection filtering', () => {
let editor: TextEditor;

async function setupCursors() {
Expand Down
131 changes: 131 additions & 0 deletions test/specs/splitSelections.ux.mts
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
import '@wdio/globals';
import 'wdio-vscode-service';
import {cleanWhitespace, setupEditor, storeCoverageStats} from './utils.mts';
import {sleep, TextEditor} from 'wdio-vscode-service';

describe('Selection splitting', () => {
let editor: TextEditor;

async function setup() {
editor = await setupEditor(`joe, boe, woe
moe,b foe,c doe,d
bill
phill
`);
await browser.executeWorkbench(async vscode => {
await vscode.commands.executeCommand('editor.action.selectAll');
});
}

it('can split by string', async () => {
await setup();
await browser.executeWorkbench(async vscode => {
await vscode.commands.executeCommand('selection-utilities.splitBy', {
text: ',',
});
});
await sleep(100);
await browser.executeWorkbench(async vscode => {
await vscode.commands.executeCommand('cursorRight');
});
await browser.keys('+');

expect(await editor.getText()).toEqual(
cleanWhitespace(`joe+, boe+, woe
moe+,b foe+,c doe+,d
bill
phill
+`)
);
});

it('can split by newline', async () => {
await setup();
await browser.executeWorkbench(async vscode => {
await vscode.commands.executeCommand('selection-utilities.splitByNewline');
});
await sleep(100);
await browser.executeWorkbench(async vscode => {
await vscode.commands.executeCommand('cursorRight');
});

await browser.keys('+');
expect(await editor.getText()).toEqual(
cleanWhitespace(`joe, boe, woe+
moe,b foe,c doe,d+
bill+
phill+
`)
);
});

it('can split by regex', async () => {
await setup();
await browser.executeWorkbench(async vscode => {
await vscode.commands.executeCommand('selection-utilities.splitByRegex', {
text: ',[a-z]\\s*',
});
});
await sleep(100);
await browser.executeWorkbench(async vscode => {
await vscode.commands.executeCommand('cursorRight');
});

await browser.keys('+');
expect(await editor.getText()).toEqual(
cleanWhitespace(`joe, boe, woe
moe+,b foe+,c doe+,d
bill
phill
+`)
);
});

it('can create by string', async () => {
await setup();
await browser.executeWorkbench(async vscode => {
await vscode.commands.executeCommand('selection-utilities.createBy', {
text: 'oe',
});
});
await sleep(100);
await browser.executeWorkbench(async vscode => {
await vscode.commands.executeCommand('cursorRight');
});

await browser.keys('+');
expect(await editor.getText()).toEqual(
cleanWhitespace(`joe+, boe+, woe+
moe+,b foe+,c doe+,d
bill
phill
`)
);
});

it('can create by regex', async () => {
await setup();
await browser.executeWorkbench(async vscode => {
await vscode.commands.executeCommand('selection-utilities.createByRegex', {
text: '[a-z]\\s+',
});
});
await sleep(100);
await browser.executeWorkbench(async vscode => {
await vscode.commands.executeCommand('cursorRight');
});

await browser.keys('+');
expect(await editor.getText()).toEqual(
cleanWhitespace(`joe, boe, woe
moe,b +foe,c +doe,d
bill
phill
`)
);
});

after(async () => {
await storeCoverageStats('filterSelections');
});
});
Loading