mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-21 17:19:01 +01:00
incorperate folding api feedback
This commit is contained in:
@@ -16,7 +16,7 @@ const testFileName = vscode.Uri.parse('test.md');
|
||||
suite('markdown.FoldingProvider', () => {
|
||||
test('Should not return anything for empty document', async () => {
|
||||
const folds = await getFoldsForDocument(``);
|
||||
assert.strictEqual(folds.ranges.length, 0);
|
||||
assert.strictEqual(folds.length, 0);
|
||||
});
|
||||
|
||||
test('Should not return anything for document without headers', async () => {
|
||||
@@ -24,7 +24,7 @@ suite('markdown.FoldingProvider', () => {
|
||||
**b** afas
|
||||
a#b
|
||||
a`);
|
||||
assert.strictEqual(folds.ranges.length, 0);
|
||||
assert.strictEqual(folds.length, 0);
|
||||
});
|
||||
|
||||
test('Should fold from header to end of document', async () => {
|
||||
@@ -32,10 +32,10 @@ a`);
|
||||
# b
|
||||
c
|
||||
d`);
|
||||
assert.strictEqual(folds.ranges.length, 1);
|
||||
const firstFold = folds.ranges[0];
|
||||
assert.strictEqual(firstFold.startLine, 1);
|
||||
assert.strictEqual(firstFold.endLine, 3);
|
||||
assert.strictEqual(folds.length, 1);
|
||||
const firstFold = folds[0];
|
||||
assert.strictEqual(firstFold.start, 1);
|
||||
assert.strictEqual(firstFold.end, 3);
|
||||
});
|
||||
|
||||
test('Should leave single newline before next header', async () => {
|
||||
@@ -45,10 +45,10 @@ x
|
||||
|
||||
# b
|
||||
y`);
|
||||
assert.strictEqual(folds.ranges.length, 2);
|
||||
const firstFold = folds.ranges[0];
|
||||
assert.strictEqual(firstFold.startLine, 1);
|
||||
assert.strictEqual(firstFold.endLine, 3);
|
||||
assert.strictEqual(folds.length, 2);
|
||||
const firstFold = folds[0];
|
||||
assert.strictEqual(firstFold.start, 1);
|
||||
assert.strictEqual(firstFold.end, 3);
|
||||
});
|
||||
|
||||
test('Should collapse multuple newlines to single newline before next header', async () => {
|
||||
@@ -60,10 +60,10 @@ x
|
||||
|
||||
# b
|
||||
y`);
|
||||
assert.strictEqual(folds.ranges.length, 2);
|
||||
const firstFold = folds.ranges[0];
|
||||
assert.strictEqual(firstFold.startLine, 1);
|
||||
assert.strictEqual(firstFold.endLine, 5);
|
||||
assert.strictEqual(folds.length, 2);
|
||||
const firstFold = folds[0];
|
||||
assert.strictEqual(firstFold.start, 1);
|
||||
assert.strictEqual(firstFold.end, 5);
|
||||
});
|
||||
|
||||
test('Should not collapse if there is no newline before next header', async () => {
|
||||
@@ -72,10 +72,10 @@ y`);
|
||||
x
|
||||
# b
|
||||
y`);
|
||||
assert.strictEqual(folds.ranges.length, 2);
|
||||
const firstFold = folds.ranges[0];
|
||||
assert.strictEqual(firstFold.startLine, 1);
|
||||
assert.strictEqual(firstFold.endLine, 2);
|
||||
assert.strictEqual(folds.length, 2);
|
||||
const firstFold = folds[0];
|
||||
assert.strictEqual(firstFold.start, 1);
|
||||
assert.strictEqual(firstFold.end, 2);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user