diff --git a/spec/classes/embedded_converter_spec.cr b/spec/classes/embedded_converter_spec.cr index 780bc92..e59c387 100644 --- a/spec/classes/embedded_converter_spec.cr +++ b/spec/classes/embedded_converter_spec.cr @@ -8,6 +8,7 @@ describe EmbeddedConverter do store = GistStore.new paragraph = PostResponse::Paragraph.from_json <<-JSON { + "name": "ab12", "text": "", "type": "IFRAME", "href": null, @@ -44,6 +45,7 @@ describe EmbeddedConverter do store = GistStore.new paragraph = PostResponse::Paragraph.from_json <<-JSON { + "name": "ab12", "text": "", "type": "IFRAME", "href": null, @@ -73,6 +75,7 @@ describe EmbeddedConverter do store = GistStore.new paragraph = PostResponse::Paragraph.from_json <<-JSON { + "name": "ab12", "text": "", "type": "IFRAME", "href": null, diff --git a/spec/classes/gist_scanner_spec.cr b/spec/classes/gist_scanner_spec.cr index a5648e6..24aaf62 100644 --- a/spec/classes/gist_scanner_spec.cr +++ b/spec/classes/gist_scanner_spec.cr @@ -12,6 +12,7 @@ describe GistScanner do ) paragraphs = [ PostResponse::Paragraph.new( + name: "ab12", text: "Check out this gist:", type: PostResponse::ParagraphType::P, markups: [] of PostResponse::Markup, @@ -20,6 +21,7 @@ describe GistScanner do metadata: nil ), PostResponse::Paragraph.new( + name: "ab13", text: "", type: PostResponse::ParagraphType::IFRAME, markups: [] of PostResponse::Markup, @@ -45,6 +47,7 @@ describe GistScanner do ) paragraphs = [ PostResponse::Paragraph.new( + name: "ab12", text: "", type: PostResponse::ParagraphType::IFRAME, markups: [] of PostResponse::Markup, @@ -78,6 +81,7 @@ describe GistScanner do ) paragraphs = [ PostResponse::Paragraph.new( + name: "ab12", text: "", type: PostResponse::ParagraphType::IFRAME, markups: [] of PostResponse::Markup, @@ -86,6 +90,7 @@ describe GistScanner do metadata: nil ), PostResponse::Paragraph.new( + name: "ab13", text: "", type: PostResponse::ParagraphType::IFRAME, markups: [] of PostResponse::Markup, diff --git a/spec/classes/page_converter_spec.cr b/spec/classes/page_converter_spec.cr index ccb07db..6770af2 100644 --- a/spec/classes/page_converter_spec.cr +++ b/spec/classes/page_converter_spec.cr @@ -8,6 +8,7 @@ describe PageConverter do paragraph_json = <<-JSON [ { + "name": "ab12", "text": "#{title}", "type": "H3", "markups": [], @@ -28,6 +29,7 @@ describe PageConverter do it "sets the author" do post_json = <<-JSON { + "name": "ab12", "title": "This is a story", "createdAt": 0, "creator": { @@ -52,6 +54,7 @@ describe PageConverter do it "sets the publish date/time" do post_json = <<-JSON { + "name": "ab12", "title": "This is a story", "createdAt": 1000, "creator": { @@ -77,6 +80,7 @@ describe PageConverter do paragraph_json = <<-JSON [ { + "name": "ab12", "text": "#{title}", "type": "H3", "markups": [], @@ -85,6 +89,7 @@ describe PageConverter do "metadata": null }, { + "name": "ab12", "text": "Content", "type": "P", "markups": [], @@ -117,6 +122,7 @@ def default_post_json( ) <<-JSON { + "name": "ab12", "title": "#{title}", "createdAt": 1628974309758, "creator": { diff --git a/spec/classes/paragraph_converter_spec.cr b/spec/classes/paragraph_converter_spec.cr index e66b824..b7f7b02 100644 --- a/spec/classes/paragraph_converter_spec.cr +++ b/spec/classes/paragraph_converter_spec.cr @@ -8,6 +8,7 @@ describe ParagraphConverter do paragraphs = Array(PostResponse::Paragraph).from_json <<-JSON [ { + "name": "ab12", "text": "Title", "type": "H3", "markups": [], @@ -17,7 +18,7 @@ describe ParagraphConverter do } ] JSON - expected = [Heading3.new(children: [Text.new(content: "Title")] of Child)] + expected = [Heading3.new(children: [Text.new(content: "Title")] of Child, identifier: "ab12")] result = ParagraphConverter.new.convert(paragraphs, gist_store) @@ -29,6 +30,7 @@ describe ParagraphConverter do paragraphs = Array(PostResponse::Paragraph).from_json <<-JSON [ { + "name": "ab12", "text": "inline code", "type": "P", "markups": [ @@ -66,6 +68,7 @@ describe ParagraphConverter do paragraphs = Array(PostResponse::Paragraph).from_json <<-JSON [ { + "name": "ab12", "text": "One", "type": "ULI", "markups": [], @@ -74,6 +77,7 @@ describe ParagraphConverter do "metadata": null }, { + "name": "ab13", "text": "Two", "type": "ULI", "markups": [], @@ -82,6 +86,7 @@ describe ParagraphConverter do "metadata": null }, { + "name": "ab14", "text": "Not a list item", "type": "P", "markups": [], @@ -109,6 +114,7 @@ describe ParagraphConverter do paragraphs = Array(PostResponse::Paragraph).from_json <<-JSON [ { + "name": "ab12", "text": "One", "type": "OLI", "markups": [], @@ -117,6 +123,7 @@ describe ParagraphConverter do "metadata": null }, { + "name": "ab13", "text": "Two", "type": "OLI", "markups": [], @@ -125,6 +132,7 @@ describe ParagraphConverter do "metadata": null }, { + "name": "ab14", "text": "Not a list item", "type": "P", "markups": [], @@ -151,6 +159,7 @@ describe ParagraphConverter do gist_store = GistStore.new paragraph = PostResponse::Paragraph.from_json <<-JSON { + "name": "ab12", "text": "Image by someuser", "type": "IMG", "markups": [ @@ -197,6 +206,7 @@ describe ParagraphConverter do paragraphs = Array(PostResponse::Paragraph).from_json <<-JSON [ { + "name": "ab12", "text": "text", "type": "H2", "markups": [], @@ -205,6 +215,7 @@ describe ParagraphConverter do "metadata": null }, { + "name": "ab13", "text": "text", "type": "H3", "markups": [], @@ -213,6 +224,7 @@ describe ParagraphConverter do "metadata": null }, { + "name": "ab14", "text": "text", "type": "H4", "markups": [], @@ -221,6 +233,7 @@ describe ParagraphConverter do "metadata": null }, { + "name": "ab15", "text": "text", "type": "P", "markups": [], @@ -229,6 +242,7 @@ describe ParagraphConverter do "metadata": null }, { + "name": "ab16", "text": "text", "type": "PRE", "markups": [], @@ -237,6 +251,7 @@ describe ParagraphConverter do "metadata": null }, { + "name": "ab17", "text": "text", "type": "BQ", "markups": [], @@ -245,6 +260,7 @@ describe ParagraphConverter do "metadata": null }, { + "name": "ab18", "text": "text", "type": "PQ", "markups": [], @@ -253,6 +269,7 @@ describe ParagraphConverter do "metadata": null }, { + "name": "ab19", "text": "text", "type": "ULI", "markups": [], @@ -261,6 +278,7 @@ describe ParagraphConverter do "metadata": null }, { + "name": "ab20", "text": "text", "type": "OLI", "markups": [], @@ -269,6 +287,7 @@ describe ParagraphConverter do "metadata": null }, { + "name": "ab21", "text": "text", "type": "IMG", "markups": [], @@ -281,6 +300,7 @@ describe ParagraphConverter do } }, { + "name": "ab22", "text": "", "type": "IFRAME", "markups": [], @@ -296,6 +316,7 @@ describe ParagraphConverter do "metadata": null }, { + "name": "ab23", "text": "Mixtape", "type": "MIXTAPE_EMBED", "href": null, @@ -317,9 +338,9 @@ describe ParagraphConverter do ] JSON expected = [ - Heading1.new([Text.new("text")] of Child), - Heading2.new([Text.new("text")] of Child), - Heading3.new([Text.new("text")] of Child), + Heading1.new([Text.new("text")] of Child, identifier: "ab12"), + Heading2.new([Text.new("text")] of Child, identifier: "ab13"), + Heading3.new([Text.new("text")] of Child, identifier: "ab14"), Paragraph.new([Text.new("text")] of Child), Preformatted.new([Text.new("text")] of Child), BlockQuote.new([Text.new("text")] of Child), # BQ diff --git a/spec/components/page_content_spec.cr b/spec/components/page_content_spec.cr index bdcd9ed..bbdd631 100644 --- a/spec/components/page_content_spec.cr +++ b/spec/components/page_content_spec.cr @@ -184,13 +184,13 @@ describe PageContent do nodes: [ Heading1.new(children: [ Text.new(content: "Title!"), - ] of Child), + ] of Child, identifier: "ab12"), ] of Child ) html = PageContent.new(page: page).render_to_string - html.should eq %(