Skip to content
This repository has been archived by the owner on Apr 3, 2024. It is now read-only.

Add tests to prove we aren't doing mustache template variable replacement #161

Merged
merged 1 commit into from
Mar 6, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
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
7 changes: 7 additions & 0 deletions test/fixtures/basic.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,13 @@ alert "hi"
+added
```

Mustache {{template}} variable {{do.not.replace}}

```js
// shouldn't replace these
console.log(faker.fake('{{name.lastName}}, {{name.firstName}} {{name.suffix}}'));
```

### images

![](relative.png)
Expand Down
28 changes: 28 additions & 0 deletions test/markdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,4 +89,32 @@ describe('markdown processing and syntax highlighting', function () {
var $ = marky(fixtures.github)
assert(~$.html().indexOf(':)'))
})

it('does not convert mustache template variables in markdown', function () {
assert(~fixtures.basic.indexOf('{{template}}'))
assert(~fixtures.basic.indexOf('{{do.not.replace}}'))
var $ = marky(fixtures.basic)
assert(~$.html().indexOf('{{template}}'))
assert(~$.html().indexOf('{{do.not.replace}}'))
})

it('does not convert mustache template variables in fenced code blocks with highlighting on', function () {
assert(~fixtures.basic.indexOf('{{name.lastName}}'))
assert(~fixtures.basic.indexOf('{{name.firstName}}'))
assert(~fixtures.basic.indexOf('{{name.suffix}}'))
var $ = marky(fixtures.basic, {highlightSyntax: true})
assert(~$.html().indexOf('{{name.lastName}}'))
assert(~$.html().indexOf('{{name.firstName}}'))
assert(~$.html().indexOf('{{name.suffix}}'))
})

it('does not convert mustache template variables in fenced code blocks with highlighting off', function () {
assert(~fixtures.basic.indexOf('{{name.lastName}}'))
assert(~fixtures.basic.indexOf('{{name.firstName}}'))
assert(~fixtures.basic.indexOf('{{name.suffix}}'))
var $ = marky(fixtures.basic, {highlightSyntax: false})
assert(~$.html().indexOf('{{name.lastName}}'))
assert(~$.html().indexOf('{{name.firstName}}'))
assert(~$.html().indexOf('{{name.suffix}}'))
})
})