From ed88e66f492c7f8e345d47878374c3e0b442800b Mon Sep 17 00:00:00 2001 From: Maria Date: Wed, 9 Oct 2024 11:05:04 +0100 Subject: [PATCH] test added and comments removed --- .../Contentful/Renderers/ListRendererTests.cs | 45 +++++++++++++++++++ .../Contentful/Renderers/ListRenderer.cs | 1 - 2 files changed, 45 insertions(+), 1 deletion(-) diff --git a/Childrens-Social-Care-CPD-Tests/Contentful/Renderers/ListRendererTests.cs b/Childrens-Social-Care-CPD-Tests/Contentful/Renderers/ListRendererTests.cs index 129c170b..ce3d50b1 100644 --- a/Childrens-Social-Care-CPD-Tests/Contentful/Renderers/ListRendererTests.cs +++ b/Childrens-Social-Care-CPD-Tests/Contentful/Renderers/ListRendererTests.cs @@ -131,4 +131,49 @@ public void List_Only_Renders_Paragraphs() actual.Should().Be(""); } + [Test] + public void Numbered_List_Renders() + { + // arrange + var stringWriter = new StringWriter(); + var list = new List() + { + NodeType = "ordered-list", + Content = new List + { + new ListItem + { + Content = new List + { + new Paragraph + { + Content = new List { new Text() } + } + } + }, + new ListItem + { + Content = new List + { + new Paragraph + { + Content = new List { new Hyperlink() } + } + } + + } + } + }; + _textLinkRenderer.Render(Arg.Any()).Returns(new HtmlString("AAA")); + _hyperlinkRenderer.Render(Arg.Any()).Returns(new HtmlString("BBB")); + + // act + var htmlContent = _sut.Render(list); + htmlContent.WriteTo(stringWriter, new HtmlTestEncoder()); + var actual = stringWriter.ToString(); + + // assert + actual.Should().Be("
  1. AAA
  2. BBB
"); + } + } diff --git a/Childrens-Social-Care-CPD/Contentful/Renderers/ListRenderer.cs b/Childrens-Social-Care-CPD/Contentful/Renderers/ListRenderer.cs index b457f2b4..8c295c61 100644 --- a/Childrens-Social-Care-CPD/Contentful/Renderers/ListRenderer.cs +++ b/Childrens-Social-Care-CPD/Contentful/Renderers/ListRenderer.cs @@ -14,7 +14,6 @@ public IHtmlContent Render(List item) return null; } - // if node type = ol then use tag builder for orderedlist TagBuilder listTag; string cssClass; if (item.NodeType == "unordered-list")