From 744a4e8e0e767802e0f8a3c871e874f72f1c073a Mon Sep 17 00:00:00 2001 From: Sosuke Suzuki Date: Sat, 25 Jul 2020 01:00:21 +0900 Subject: [PATCH] Add tests after remark v8 (#8820) * Add tests for #3753 * Add tests for #4306 * Add tests for #5921 * Add tests fro #6177 * Fix --- .../heading/__snapshots__/jsfmt.spec.js.snap | 23 + tests/markdown/heading/hash-sign.md | 5 + .../list/__snapshots__/jsfmt.spec.js.snap | 558 ++++++++++++++++++ tests/markdown/list/codeblock.md | 35 ++ tests/markdown/list/tab.md | 23 + .../table/__snapshots__/jsfmt.spec.js.snap | 8 + tests/markdown/table/table.md | 4 + 7 files changed, 656 insertions(+) create mode 100644 tests/markdown/heading/hash-sign.md create mode 100644 tests/markdown/list/codeblock.md create mode 100644 tests/markdown/list/tab.md diff --git a/tests/markdown/heading/__snapshots__/jsfmt.spec.js.snap b/tests/markdown/heading/__snapshots__/jsfmt.spec.js.snap index e14482c19..5ee2f1b45 100644 --- a/tests/markdown/heading/__snapshots__/jsfmt.spec.js.snap +++ b/tests/markdown/heading/__snapshots__/jsfmt.spec.js.snap @@ -19,6 +19,29 @@ proseWrap: "always" ================================================================================ `; +exports[`hash-sign.md - {"proseWrap":"always"} format 1`] = ` +====================================options===================================== +parsers: ["markdown"] +printWidth: 80 +proseWrap: "always" + | printWidth +=====================================input====================================== +# Programming languages + +## C# + +## JavaScript + +=====================================output===================================== +# Programming languages + +## C# + +## JavaScript + +================================================================================ +`; + exports[`long-heading.md - {"proseWrap":"always"} format 1`] = ` ====================================options===================================== parsers: ["markdown"] diff --git a/tests/markdown/heading/hash-sign.md b/tests/markdown/heading/hash-sign.md new file mode 100644 index 000000000..0cac4fedf --- /dev/null +++ b/tests/markdown/heading/hash-sign.md @@ -0,0 +1,5 @@ +# Programming languages + +## C# + +## JavaScript diff --git a/tests/markdown/list/__snapshots__/jsfmt.spec.js.snap b/tests/markdown/list/__snapshots__/jsfmt.spec.js.snap index b63658ae5..b24171010 100644 --- a/tests/markdown/list/__snapshots__/jsfmt.spec.js.snap +++ b/tests/markdown/list/__snapshots__/jsfmt.spec.js.snap @@ -590,6 +590,325 @@ proseWrap: "always" ================================================================================ `; +exports[`codeblock.md - {"proseWrap":"always","tabWidth":0} format 1`] = ` +====================================options===================================== +parsers: ["markdown"] +printWidth: 80 +proseWrap: "always" +tabWidth: 0 + | printWidth +=====================================input====================================== +1. ol01 + + \`\`\`js + const a = 1; + + + const b = 2; + \`\`\` + +2. ol02 + + \`\`\`js + const a = 1; + + + const b = 2; + \`\`\` + +- ul01 + + \`\`\`js + const a = 1; + + + const b = 2; + \`\`\` + +- ul02 + + \`\`\`js + const a = 1; + + + const b = 2; + \`\`\` + +=====================================output===================================== +1. ol01 + + \`\`\`js + const a = 1; + + const b = 2; + \`\`\` + +2. ol02 + + \`\`\`js + const a = 1; + + const b = 2; + \`\`\` + +- ul01 + + \`\`\`js + const a = 1; + + const b = 2; + \`\`\` + +- ul02 + + \`\`\`js + const a = 1; + + const b = 2; + \`\`\` + +================================================================================ +`; + +exports[`codeblock.md - {"proseWrap":"always","tabWidth":4} format 1`] = ` +====================================options===================================== +parsers: ["markdown"] +printWidth: 80 +proseWrap: "always" +tabWidth: 4 + | printWidth +=====================================input====================================== +1. ol01 + + \`\`\`js + const a = 1; + + + const b = 2; + \`\`\` + +2. ol02 + + \`\`\`js + const a = 1; + + + const b = 2; + \`\`\` + +- ul01 + + \`\`\`js + const a = 1; + + + const b = 2; + \`\`\` + +- ul02 + + \`\`\`js + const a = 1; + + + const b = 2; + \`\`\` + +=====================================output===================================== +1. ol01 + + \`\`\`js + const a = 1; + + const b = 2; + \`\`\` + +2. ol02 + + \`\`\`js + const a = 1; + + const b = 2; + \`\`\` + +- ul01 + + \`\`\`js + const a = 1; + + const b = 2; + \`\`\` + +- ul02 + + \`\`\`js + const a = 1; + + const b = 2; + \`\`\` + +================================================================================ +`; + +exports[`codeblock.md - {"proseWrap":"always","tabWidth":999} format 1`] = ` +====================================options===================================== +parsers: ["markdown"] +printWidth: 80 +proseWrap: "always" +tabWidth: 999 + | printWidth +=====================================input====================================== +1. ol01 + + \`\`\`js + const a = 1; + + + const b = 2; + \`\`\` + +2. ol02 + + \`\`\`js + const a = 1; + + + const b = 2; + \`\`\` + +- ul01 + + \`\`\`js + const a = 1; + + + const b = 2; + \`\`\` + +- ul02 + + \`\`\`js + const a = 1; + + + const b = 2; + \`\`\` + +=====================================output===================================== +1. ol01 + + \`\`\`js + const a = 1; + + const b = 2; + \`\`\` + +2. ol02 + + \`\`\`js + const a = 1; + + const b = 2; + \`\`\` + +- ul01 + + \`\`\`js + const a = 1; + + const b = 2; + \`\`\` + +- ul02 + + \`\`\`js + const a = 1; + + const b = 2; + \`\`\` + +================================================================================ +`; + +exports[`codeblock.md - {"proseWrap":"always"} format 1`] = ` +====================================options===================================== +parsers: ["markdown"] +printWidth: 80 +proseWrap: "always" + | printWidth +=====================================input====================================== +1. ol01 + + \`\`\`js + const a = 1; + + + const b = 2; + \`\`\` + +2. ol02 + + \`\`\`js + const a = 1; + + + const b = 2; + \`\`\` + +- ul01 + + \`\`\`js + const a = 1; + + + const b = 2; + \`\`\` + +- ul02 + + \`\`\`js + const a = 1; + + + const b = 2; + \`\`\` + +=====================================output===================================== +1. ol01 + + \`\`\`js + const a = 1; + + const b = 2; + \`\`\` + +2. ol02 + + \`\`\`js + const a = 1; + + const b = 2; + \`\`\` + +- ul01 + + \`\`\`js + const a = 1; + + const b = 2; + \`\`\` + +- ul02 + + \`\`\`js + const a = 1; + + const b = 2; + \`\`\` + +================================================================================ +`; + exports[`combined-lists.md - {"proseWrap":"always","tabWidth":0} format 1`] = ` ====================================options===================================== parsers: ["markdown"] @@ -3607,3 +3926,242 @@ proseWrap: "always" ================================================================================ `; + +exports[`tab.md - {"proseWrap":"always","tabWidth":0} format 1`] = ` +====================================options===================================== +parsers: ["markdown"] +printWidth: 80 +proseWrap: "always" +tabWidth: 0 + | printWidth +=====================================input====================================== +* Text + + [title](link) + +* Text + + - foo + - foo + - bar + +* Text + + # foo + +* Text + + \`\`\` + foo + \`\`\` + +* Text + + \`foo\` + +=====================================output===================================== +- Text + + [title](link) + +- Text + + - foo + - foo + - bar + +- Text + + # foo + +- Text + + \`\`\` + foo + \`\`\` + +- Text + + \`foo\` + +================================================================================ +`; + +exports[`tab.md - {"proseWrap":"always","tabWidth":4} format 1`] = ` +====================================options===================================== +parsers: ["markdown"] +printWidth: 80 +proseWrap: "always" +tabWidth: 4 + | printWidth +=====================================input====================================== +* Text + + [title](link) + +* Text + + - foo + - foo + - bar + +* Text + + # foo + +* Text + + \`\`\` + foo + \`\`\` + +* Text + + \`foo\` + +=====================================output===================================== +- Text + + [title](link) + +- Text + + - foo + - foo + - bar + +- Text + + # foo + +- Text + + \`\`\` + foo + \`\`\` + +- Text + + \`foo\` + +================================================================================ +`; + +exports[`tab.md - {"proseWrap":"always","tabWidth":999} format 1`] = ` +====================================options===================================== +parsers: ["markdown"] +printWidth: 80 +proseWrap: "always" +tabWidth: 999 + | printWidth +=====================================input====================================== +* Text + + [title](link) + +* Text + + - foo + - foo + - bar + +* Text + + # foo + +* Text + + \`\`\` + foo + \`\`\` + +* Text + + \`foo\` + +=====================================output===================================== +- Text + + [title](link) + +- Text + + - foo + - foo + - bar + +- Text + + # foo + +- Text + + \`\`\` + foo + \`\`\` + +- Text + + \`foo\` + +================================================================================ +`; + +exports[`tab.md - {"proseWrap":"always"} format 1`] = ` +====================================options===================================== +parsers: ["markdown"] +printWidth: 80 +proseWrap: "always" + | printWidth +=====================================input====================================== +* Text + + [title](link) + +* Text + + - foo + - foo + - bar + +* Text + + # foo + +* Text + + \`\`\` + foo + \`\`\` + +* Text + + \`foo\` + +=====================================output===================================== +- Text + + [title](link) + +- Text + + - foo + - foo + - bar + +- Text + + # foo + +- Text + + \`\`\` + foo + \`\`\` + +- Text + + \`foo\` + +================================================================================ +`; diff --git a/tests/markdown/list/codeblock.md b/tests/markdown/list/codeblock.md new file mode 100644 index 000000000..d7c7e6ad0 --- /dev/null +++ b/tests/markdown/list/codeblock.md @@ -0,0 +1,35 @@ +1. ol01 + + ```js + const a = 1; + + + const b = 2; + ``` + +2. ol02 + + ```js + const a = 1; + + + const b = 2; + ``` + +- ul01 + + ```js + const a = 1; + + + const b = 2; + ``` + +- ul02 + + ```js + const a = 1; + + + const b = 2; + ``` diff --git a/tests/markdown/list/tab.md b/tests/markdown/list/tab.md new file mode 100644 index 000000000..55699cdb6 --- /dev/null +++ b/tests/markdown/list/tab.md @@ -0,0 +1,23 @@ +* Text + + [title](link) + +* Text + + - foo + - foo + - bar + +* Text + + # foo + +* Text + + ``` + foo + ``` + +* Text + + `foo` diff --git a/tests/markdown/table/__snapshots__/jsfmt.spec.js.snap b/tests/markdown/table/__snapshots__/jsfmt.spec.js.snap index b31f31122..8c32a1354 100644 --- a/tests/markdown/table/__snapshots__/jsfmt.spec.js.snap +++ b/tests/markdown/table/__snapshots__/jsfmt.spec.js.snap @@ -157,6 +157,10 @@ proseWrap: "always" |小红|女|79| |小陆|男|92| +| col1 | col2 | col3 | +|---|--|--| +| long text | \`\` | text | + =====================================output===================================== - min-table @@ -174,5 +178,9 @@ proseWrap: "always" | 小红 | 女 | 79 | | 小陆 | 男 | 92 | +| col1 | col2 | col3 | +| --------- | ---- | ---- | +| long text | \`\` | text | + ================================================================================ `; diff --git a/tests/markdown/table/table.md b/tests/markdown/table/table.md index 2096adf14..2afa7167f 100644 --- a/tests/markdown/table/table.md +++ b/tests/markdown/table/table.md @@ -12,3 +12,7 @@ |小明|男|75| |小红|女|79| |小陆|男|92| + +| col1 | col2 | col3 | +|---|--|--| +| long text | `` | text |