incorperate folding api feedback

This commit is contained in:
Martin Aeschlimann
2018-04-18 15:26:43 +02:00
parent 89163a5f59
commit a1bb202eb6
18 changed files with 232 additions and 180 deletions

View File

@@ -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);
});
});