Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Feature/hints#31

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
ShMcK merged 5 commits intomasterfromfeature/hints
Jun 7, 2020
Merged
Show file tree
Hide file tree
Changes from1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
NextNext commit
setup hint tests
Signed-off-by: shmck <shawn.j.mckay@gmail.com>
  • Loading branch information
@ShMcK
ShMcK committedJun 7, 2020
commit5eed9564d91aab681043c08747e0501a156ac92b
6 changes: 6 additions & 0 deletionssrc/templates/TUTORIAL.md
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -36,3 +36,9 @@ Short description of the step's purpose. Should be short and fit in one line
### L1S2 Another step

Step's short description.

#### Hints

- If a hint exists, the user can request a hint
- Hints will show up in the order they are written
- When all hints are added, the hint option will become disabled
225 changes: 225 additions & 0 deletionstests/parse.test.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -812,4 +812,229 @@ Description.
};
expect(result.config).toEqual(expected.config);
});

// hints
it("should parse hints for a step", () => {
const md = `# Title

Description.

## L1 Title 1

First level content.

### L1S1

The first step

#### Hints

* First Hint
* Second Hint

`;
const skeleton = {
levels: [
{
id: "L1",
steps: [
{
id: "L1S1",
},
],
},
],
};
const result = parse({
text: md,
skeleton,
commits: {
L1S1Q: ["abcdef1", "123456789"],
},
});
const expected = {
summary: {
description: "Description.",
},
levels: [
{
id: "L1",
title: "Title 1",
summary: "First level content.",
content: "First level content.",
steps: [
{
id: "L1S1",
content: "The first step",
setup: {
commits: ["abcdef1", "123456789"],
},
hints: ["First Hint", "Second Hint"],
},
],
},
],
};
expect(result.levels).toEqual(expected.levels);
});

it("should parse hints for a step", () => {
const md = `# Title

Description.

## L1 Title 1

First level content.

### L1S1

The first step

#### Hints

* First Hint with \`markdown\`. See **bold**
* Second Hint has a codeblock

\`\`\`js
var a = 1;
\`\`\`

And spans multiple lines.
`;
const skeleton = {
levels: [
{
id: "L1",
steps: [
{
id: "L1S1",
},
],
},
],
};
const result = parse({
text: md,
skeleton,
commits: {
L1S1Q: ["abcdef1", "123456789"],
},
});
const expected = {
summary: {
description: "Description.",
},
levels: [
{
id: "L1",
title: "Title 1",
summary: "First level content.",
content: "First level content.",
steps: [
{
id: "L1S1",
content: "The first step",
setup: {
commits: ["abcdef1", "123456789"],
},
hints: [
"First Hint with `markdown`. See **bold**",
"Second Hint has a codeblock\n\n```js\nvar a = 1;\n```\n\nAnd spans multiple lines.",
],
},
],
},
],
};
expect(result.levels).toEqual(expected.levels);
});

it("should parse hints and not interrupt next step", () => {
const md = `# Title

Description.

## L1 Title 1

First level content.

### L1S1

The first step

#### Hints

* First Hint with \`markdown\`. See **bold**
* Second Hint has a codeblock

\`\`\`js
var a = 1;
\`\`\`

And spans multiple lines.

### L1S2A

The second uninterrupted step
`;
const skeleton = {
levels: [
{
id: "L1",
steps: [
{
id: "L1S1",
},
{
id: "L1S2",
},
],
},
],
};
const result = parse({
text: md,
skeleton,
commits: {
L1S1Q: ["abcdef1", "123456789"],
L1S2Q: ["fedcba1"],
},
});
const expected = {
summary: {
description: "Description.",
},
levels: [
{
id: "L1",
title: "Title 1",
summary: "First level content.",
content: "First level content.",
steps: [
{
id: "L1S1",
content: "The first step",
setup: {
commits: ["abcdef1", "123456789"],
},
hints: [
"First Hint with `markdown`. See **bold**",
"Second Hint has a codeblock\n\n```js\nvar a = 1;\n```\n\nAnd spans multiple lines.",
],
},
{
id: "L1S2",
content: "The second uninterrupted step",
setup: {
commits: ["fedcba1"],
},
},
],
},
{},
],
};
expect(result.levels).toEqual(expected.levels);
});
});

[8]ページ先頭

©2009-2025 Movatter.jp