summaryrefslogtreecommitdiff
path: root/test/clarktown/renderers/heading_block_test.clj
diff options
context:
space:
mode:
authorAsko Nõmm <ano@ano.ee>2022-05-11 18:10:02 +0300
committerGitHub <noreply@github.com>2022-05-11 18:10:02 +0300
commit94c1c0ca639f55ff9073cb1fdf2ad6015bb6bae1 (patch)
tree8f941e88d070118acf4c807bee380b013912e4c9 /test/clarktown/renderers/heading_block_test.clj
parentb97891cc45b9a087a372767e25aa36788bc979bf (diff)
parent9276a14c41e95e5ca17c648fe71c162f35551057 (diff)
Merge pull request #30 from askonomm/29-add-id-attributes-to-headings-based-on-value-to-enable-linking-to-a-heading
Add `id` attributes to headings based on value.
Diffstat (limited to 'test/clarktown/renderers/heading_block_test.clj')
-rw-r--r--test/clarktown/renderers/heading_block_test.clj26
1 files changed, 13 insertions, 13 deletions
diff --git a/test/clarktown/renderers/heading_block_test.clj b/test/clarktown/renderers/heading_block_test.clj
index 8f229fb..a0852e8 100644
--- a/test/clarktown/renderers/heading_block_test.clj
+++ b/test/clarktown/renderers/heading_block_test.clj
@@ -6,27 +6,27 @@
(deftest atx-heading-renderer-test
(testing "ATX heading block that's a H1"
- (is (= "<h1>This is a heading block.</h1>"
+ (is (= "<h1 id=\"this-is-a-heading-block\">This is a heading block.</h1>"
(heading-block/render "# This is a heading block." nil nil))))
(testing "ATX heading block that's a H2"
- (is (= "<h2>This is a heading block.</h2>"
+ (is (= "<h2 id=\"this-is-a-heading-block\">This is a heading block.</h2>"
(heading-block/render "## This is a heading block." nil nil))))
(testing "ATX heading block that's a H3"
- (is (= "<h3>This is a heading block.</h3>"
+ (is (= "<h3 id=\"this-is-a-heading-block\">This is a heading block.</h3>"
(heading-block/render "### This is a heading block." nil nil))))
(testing "ATX heading block that's a H4"
- (is (= "<h4>This is a heading block.</h4>"
+ (is (= "<h4 id=\"this-is-a-heading-block\">This is a heading block.</h4>"
(heading-block/render "#### This is a heading block." nil nil))))
(testing "ATX heading block that's a H5"
- (is (= "<h5>This is a heading block.</h5>"
+ (is (= "<h5 id=\"this-is-a-heading-block\">This is a heading block.</h5>"
(heading-block/render "##### This is a heading block." nil nil))))
(testing "ATX heading block that's a H6"
- (is (= "<h6>This is a heading block.</h6>"
+ (is (= "<h6 id=\"this-is-a-heading-block\">This is a heading block.</h6>"
(heading-block/render "###### This is a heading block." nil nil))))
(testing "No H tag when 7 or more # characters"
@@ -38,11 +38,11 @@
(heading-block/render "#This is not a heading block." nil nil))))
(testing "ATX heading can precede up to 3 spaces"
- (is (= "<h1>This is a heading.</h1>"
+ (is (= "<h1 id=\"this-is-a-heading\">This is a heading.</h1>"
(heading-block/render " # This is a heading." nil nil)))
- (is (= "<h1>This is a heading.</h1>"
+ (is (= "<h1 id=\"this-is-a-heading\">This is a heading.</h1>"
(heading-block/render " # This is a heading." nil nil)))
- (is (= "<h1>This is a heading.</h1>"
+ (is (= "<h1 id=\"this-is-a-heading\">This is a heading.</h1>"
(heading-block/render " # This is a heading." nil nil))))
(testing "But no more than 3 spaces"
@@ -53,17 +53,17 @@
(deftest settext-heading-renderer-text
(testing "Settext heading block that's a H1"
- (is (= "<h1>This is a heading block.</h1>"
+ (is (= "<h1 id=\"this-is-a-heading-block\">This is a heading block.</h1>"
(heading-block/render "This is a heading block.\n=========" nil nil))))
(testing "Settext heading block that's a H1 spanning multiple lines"
- (is (= "<h1>This is a \nheading block spanning multiple lines.</h1>"
+ (is (= "<h1 id=\"this-is-a-heading-block-spanning-multiple-lines\">This is a \nheading block spanning multiple lines.</h1>"
(heading-block/render "This is a \nheading block spanning multiple lines.\n========" nil nil))))
(testing "Settext heading block that's a H2"
- (is (= "<h2>This is a heading block.</h2>"
+ (is (= "<h2 id=\"this-is-a-heading-block\">This is a heading block.</h2>"
(heading-block/render "This is a heading block.\n---------" nil nil))))
(testing "Settext heading block that's a H2 spanning multiple lines"
- (is (= "<h2>This is a \nheading block spanning multiple lines.</h2>"
+ (is (= "<h2 id=\"this-is-a-heading-block-spanning-multiple-lines\">This is a \nheading block spanning multiple lines.</h2>"
(heading-block/render "This is a \nheading block spanning multiple lines.\n--------" nil nil)))))