Skip to content

Commit

Permalink
chore: Add test for commented header (closes jonschlinkert#178; alrea…
Browse files Browse the repository at this point in the history
…dy fixed)
  • Loading branch information
gregdan3 committed Sep 17, 2023
1 parent 76a76dc commit 301a4d8
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 0 deletions.
12 changes: 12 additions & 0 deletions test/expected/commented-header.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<!-- toc -->

- [First Heading](#first-heading)
- [Second Heading](#second-heading)

<!-- tocstop -->

# First Heading

<!-- # Commented Heading -->

# Second Heading
7 changes: 7 additions & 0 deletions test/fixtures/commented-header.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<!-- toc -->

# First Heading

<!-- # Commented Heading -->

# Second Heading
4 changes: 4 additions & 0 deletions test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -431,4 +431,8 @@ describe('toc.insert', function() {
assert.equal(toc.insert('---\nExample\n'), '---\nExample\n');
})

it('should not generate a link to a commented heading', function() {
assert.equal(toc.insert(read('test/fixtures/commented-header.md')), read('test/expected/commented-header.md'));
})

});

0 comments on commit 301a4d8

Please sign in to comment.