Skip to content

Commit 8754b7a

Browse files
committed
Fix
1 parent 6894ab3 commit 8754b7a

File tree

1 file changed

+17
-3
lines changed

1 file changed

+17
-3
lines changed

test/razorIntegrationTests/formatting.integration.test.ts

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,18 @@ import * as jestLib from '@jest/globals';
99
import testAssetWorkspace from './testAssets/testAssetWorkspace';
1010
import * as integrationHelpers from '../integrationTests/integrationHelpers';
1111

12+
function normalizeNewlines(original: string | undefined): string | undefined {
13+
if (!original) {
14+
return original;
15+
}
16+
17+
while (original.indexOf('\r\n') != -1) {
18+
original = original.replace('\r\n', '\n');
19+
}
20+
21+
return original;
22+
}
23+
1224
jestLib.describe(`Razor Formatting ${testAssetWorkspace.description}`, function () {
1325
jestLib.beforeAll(async function () {
1426
if (!integrationHelpers.isRazorWorkspace(vscode.workspace)) {
@@ -54,8 +66,9 @@ jestLib.describe(`Razor Formatting ${testAssetWorkspace.description}`, function
5466
formatEdit.set(activeDocument, edits);
5567
await vscode.workspace.applyEdit(formatEdit);
5668

57-
const contents = vscode.window.activeTextEditor?.document.getText();
58-
jestLib.expect(contents).toEqual(`@page "/bad"
69+
const contents = normalizeNewlines(vscode.window.activeTextEditor?.document.getText());
70+
jestLib.expect(contents).toBe(
71+
normalizeNewlines(`@page "/bad"
5972
6073
@code {
6174
private string _x = "";
@@ -65,6 +78,7 @@ jestLib.describe(`Razor Formatting ${testAssetWorkspace.description}`, function
6578
// hi there
6679
}
6780
}
68-
`);
81+
`)
82+
);
6983
});
7084
});

0 commit comments

Comments
 (0)