mirror of
https://github.com/esm7/obsidian-vimrc-support.git
synced 2026-07-22 05:00:25 +00:00
chore: format test file
This commit is contained in:
parent
fdc3aa054e
commit
b46f370b37
1 changed files with 13 additions and 41 deletions
|
|
@ -1,67 +1,39 @@
|
|||
import { describe, expect, test } from "vitest";
|
||||
import {
|
||||
jumpToNextCodeFence,
|
||||
jumpToPreviousCodeFence,
|
||||
} from "../motions/jumpToCodeFence";
|
||||
import { jumpToNextCodeFence, jumpToPreviousCodeFence } from "../motions/jumpToCodeFence";
|
||||
import { createFakeCodeMirrorEditor } from "./createFakeCodeMirrorEditor";
|
||||
|
||||
const CODE_FENCE_CONTENT_LINES = [
|
||||
"intro",
|
||||
"```ts",
|
||||
"const answer = 42;",
|
||||
"```",
|
||||
"outro",
|
||||
];
|
||||
const CODE_FENCE_CONTENT_LINES = ["intro", "```ts", "const answer = 42;", "```", "outro"];
|
||||
|
||||
describe("jumpToNextCodeFence", () => {
|
||||
test("jumps to the next opening code fence", () => {
|
||||
expectNextCodeFencePosition(
|
||||
{ line: 0, ch: 0 },
|
||||
{ line: 1, ch: 0 }
|
||||
);
|
||||
expectNextCodeFencePosition({ line: 0, ch: 0 }, { line: 1, ch: 0 });
|
||||
});
|
||||
|
||||
test("jumps to the next closing code fence", () => {
|
||||
expectNextCodeFencePosition(
|
||||
{ line: 2, ch: 0 },
|
||||
{ line: 3, ch: 0 }
|
||||
);
|
||||
expectNextCodeFencePosition({ line: 2, ch: 0 }, { line: 3, ch: 0 });
|
||||
});
|
||||
|
||||
test("wraps to the first code fence after the last one", () => {
|
||||
expectNextCodeFencePosition(
|
||||
{ line: 4, ch: 0 },
|
||||
{ line: 1, ch: 0 }
|
||||
);
|
||||
expectNextCodeFencePosition({ line: 4, ch: 0 }, { line: 1, ch: 0 });
|
||||
});
|
||||
|
||||
test("ignores backticks that are not code fence lines", () => {
|
||||
expectNextCodeFencePosition(
|
||||
{ line: 0, ch: 0 },
|
||||
{ line: 1, ch: 0 },
|
||||
[
|
||||
"here are inline backticks ``` not a fence",
|
||||
"```ts",
|
||||
"const answer = 42;",
|
||||
"```",
|
||||
]
|
||||
);
|
||||
expectNextCodeFencePosition({ line: 0, ch: 0 }, { line: 1, ch: 0 }, [
|
||||
"here are inline backticks ``` not a fence",
|
||||
"```ts",
|
||||
"const answer = 42;",
|
||||
"```",
|
||||
]);
|
||||
});
|
||||
});
|
||||
|
||||
describe("jumpToPreviousCodeFence", () => {
|
||||
test("jumps to the previous closing code fence", () => {
|
||||
expectPreviousCodeFencePosition(
|
||||
{ line: 4, ch: 0 },
|
||||
{ line: 3, ch: 0 }
|
||||
);
|
||||
expectPreviousCodeFencePosition({ line: 4, ch: 0 }, { line: 3, ch: 0 });
|
||||
});
|
||||
|
||||
test("jumps to the previous opening code fence", () => {
|
||||
expectPreviousCodeFencePosition(
|
||||
{ line: 2, ch: 0 },
|
||||
{ line: 1, ch: 0 }
|
||||
);
|
||||
expectPreviousCodeFencePosition({ line: 2, ch: 0 }, { line: 1, ch: 0 });
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue