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

Commit

Permalink
Merge pull request #161 from revin/mustache-test
Browse files Browse the repository at this point in the history
Add tests to prove we aren't doing mustache template variable replacement
  • Loading branch information
ashleygwilliams committed Mar 6, 2016
2 parents 2671d01 + a74fc16 commit 0302f9f
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
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}}'))
})
})

0 comments on commit 0302f9f

Please sign in to comment.