-
+
Unsupported element
- internalName: @Model.InternalName
- nodeType: @Model.NodeType
diff --git a/src/Dfe.ContentSupport.Web/Views/Sitemap/Index.cshtml b/src/Dfe.ContentSupport.Web/Views/Sitemap/Index.cshtml
new file mode 100644
index 0000000..33c6f37
--- /dev/null
+++ b/src/Dfe.ContentSupport.Web/Views/Sitemap/Index.cshtml
@@ -0,0 +1,2 @@
+@model CsPage
+
diff --git a/src/Dfe.ContentSupport.Web/wwwroot/assets/images/generic-file-icon.svg b/src/Dfe.ContentSupport.Web/wwwroot/assets/images/generic-file-icon.svg
index 44eade0..78e30f8 100644
--- a/src/Dfe.ContentSupport.Web/wwwroot/assets/images/generic-file-icon.svg
+++ b/src/Dfe.ContentSupport.Web/wwwroot/assets/images/generic-file-icon.svg
@@ -1,4 +1,4 @@
-
+
\ No newline at end of file
diff --git a/src/Dfe.ContentSupport.Web/wwwroot/assets/images/html-file-icon.svg b/src/Dfe.ContentSupport.Web/wwwroot/assets/images/html-file-icon.svg
index f2a2d34..f900dc6 100644
--- a/src/Dfe.ContentSupport.Web/wwwroot/assets/images/html-file-icon.svg
+++ b/src/Dfe.ContentSupport.Web/wwwroot/assets/images/html-file-icon.svg
@@ -1,4 +1,4 @@
-
+
diff --git a/src/Dfe.ContentSupport.Web/wwwroot/assets/images/pdf-file-icon.svg b/src/Dfe.ContentSupport.Web/wwwroot/assets/images/pdf-file-icon.svg
index 3ee17bc..9e7af34 100644
--- a/src/Dfe.ContentSupport.Web/wwwroot/assets/images/pdf-file-icon.svg
+++ b/src/Dfe.ContentSupport.Web/wwwroot/assets/images/pdf-file-icon.svg
@@ -1,4 +1,4 @@
-
+
diff --git a/src/Dfe.ContentSupport.Web/wwwroot/assets/images/spreadsheet-file-icon.svg b/src/Dfe.ContentSupport.Web/wwwroot/assets/images/spreadsheet-file-icon.svg
index 295a6f0..da7102c 100644
--- a/src/Dfe.ContentSupport.Web/wwwroot/assets/images/spreadsheet-file-icon.svg
+++ b/src/Dfe.ContentSupport.Web/wwwroot/assets/images/spreadsheet-file-icon.svg
@@ -1,4 +1,4 @@
-
+
diff --git a/src/Dfe.ContentSupport.Web/wwwroot/css/cands-site.css b/src/Dfe.ContentSupport.Web/wwwroot/css/cands-site.css
index 7afd307..f66be84 100644
--- a/src/Dfe.ContentSupport.Web/wwwroot/css/cands-site.css
+++ b/src/Dfe.ContentSupport.Web/wwwroot/css/cands-site.css
@@ -38,9 +38,8 @@ video {
margin-bottom: 15px;
padding: 5px;
display: block;
- max-width: 280px;
- width: 140px;
- height: auto;
+ max-height: 140px;
+ max-width: 99px;
border: #e6e6e6;
outline: 5px solid #e6e6e6;
background: #ffffff;
@@ -52,7 +51,7 @@ video {
.attachment .attachment-metadata {
font-weight: 400;
font-size: 1.1875rem;
- line-height: 1.25;
+ line-height: 1.32;
margin: 0 0 15px;
color: #505a5f;
}
@@ -84,3 +83,151 @@ video {
.dfe-page-header {
background-color: #ebf2f6;
}
+
+.guidance-container {
+ border: 1px solid #b1b4b6;
+}
+
+#backtotop-button {
+ margin-top: 2rem;
+}
+
+.gem-c-metadata {
+ -webkit-font-smoothing: antialiased;
+ -moz-osx-font-smoothing: grayscale;
+ font-weight: 400;
+ font-size: 14px;
+ font-size: 0.875rem;
+ line-height: 1.1429;
+}
+
+@media (min-width: 40.0625em) {
+ .gem-c-metadata {
+ font-size: 16px;
+ font-size: 1rem;
+ line-height: 1.25;
+ }
+
+ .gem-c-metadata a {
+ font-family: sans-serif;
+ }
+
+ .gem-c-metadata--inverse-padded .gem-c-metadata__list {
+ margin: 15px;
+ }
+
+ .gem-c-metadata__term {
+ box-sizing: border-box;
+ float: left;
+ clear: left;
+ padding-right: 5px;
+ margin-top: 0;
+ }
+
+ .gem-c-metadata__term .gem-c-metadata__definition {
+ line-height: 1.4;
+ }
+
+ .gem-c-metadata__definition:not(:last-of-type) {
+ margin-bottom: 5px;
+ }
+}
+
+.gem-c-metadata a {
+ -webkit-font-smoothing: antialiased;
+ -moz-osx-font-smoothing: grayscale;
+ text-decoration: underline;
+ font-weight: bold;
+ color: #0b0c0c;
+}
+
+.gem-c-metadata .gem-c-metadata::after {
+ content: "";
+ display: block;
+ clear: both;
+}
+
+.gem-c-metadata .direction-rtl {
+ direction: rtl;
+ text-align: start;
+}
+
+.gem-c-metadata-inverse {
+ color: #ffffff;
+}
+
+.gem-c-metadata-inverse a:link,
+.gem-c-metadata-inverse a:hover,
+.gem-c-metadata-inverse a:visited,
+.gem-c-metadata-inverse a:active {
+ color: #ffffff;
+}
+
+.gem-c-metadata-inverse a:focus {
+ color: #0b0c0c;
+}
+
+.gem-c-metadata-inverse-padded {
+ padding: 10px;
+}
+
+.gem-c-metadata-inverse-padded .gem-c-metadata-inverse.gem-c-metadata__list {
+ margin: 10px;
+}
+
+.gem-c-metadata__definition {
+ margin: 0;
+}
+
+.gem-c-metadata__toggle-wrap {
+ display: none;
+}
+
+.gem-c-metadata .gem-c-metadata__definition-link {
+ font-weight: normal;
+}
+
+.gem-c-metadata.direction-rtl .gem-c-metadata__definition {
+ float: right;
+}
+
+@media (min-width: 40.0625em) {
+ .gem-c-metadata--inverse-padded .gem-c-metadata__list {
+ margin: 15px;
+ }
+}
+
+@media (min-width: 40.0625em) {
+ .gem-c-metadata.direction-rtl .gem-c-metadata__term {
+ padding-left: 5px;
+ padding-right: 0;
+ }
+}
+
+@media print {
+ .gem-c-metadata {
+ color: #000000;
+ font-family: sans-serif;
+ font-size: 14pt;
+ line-height: 1.2;
+ }
+}
+
+.js-enabled .gem-c-metadata__toggle-wrap {
+ display: block;
+}
+
+.js-enabled .gem-c-metadata__toggle-items .js-hidden {
+ display: none;
+}
+
+dl.gem-c-metadata__list {
+ margin: 0;
+}
+
+.citation {
+ background: rgba(238, 238, 238, 0.4588235294);
+ padding: 15px 10px 15px 20px;
+ margin-top: 60px;
+ border-left: 5px solid #347ca9;
+}
\ No newline at end of file
diff --git a/tests/Dfe.ContentSupport.Web.E2ETests/cypress/e2e/pages/rich-text.cy.js b/tests/Dfe.ContentSupport.Web.E2ETests/cypress/e2e/pages/rich-text.cy.js
index a334c23..d6e5375 100644
--- a/tests/Dfe.ContentSupport.Web.E2ETests/cypress/e2e/pages/rich-text.cy.js
+++ b/tests/Dfe.ContentSupport.Web.E2ETests/cypress/e2e/pages/rich-text.cy.js
@@ -1,6 +1,6 @@
describe('Rich Text Rendering', () => {
beforeEach(() => {
- cy.visit('/hello-world');
+ cy.visit('content/hello-world');
});
describe('Headings', () => {
@@ -113,6 +113,7 @@ describe('Rich Text Rendering', () => {
cy.get('.attachment-link').should('contain', 'Test csv');
cy.get('.attachment-attribute').should('contain', 'CSV');
cy.get('.attachment-attribute').should('contain', '18 KB');
+ cy.get('.attachment-attribute[aria-label="update date"]').should('contain', 'Last updated 31 May 2024');
});
});
diff --git a/tests/Dfe.ContentSupport.Web.Tests/Controllers/SitemapControllerTests.cs b/tests/Dfe.ContentSupport.Web.Tests/Controllers/SitemapControllerTests.cs
index 22d54cb..63225b9 100644
--- a/tests/Dfe.ContentSupport.Web.Tests/Controllers/SitemapControllerTests.cs
+++ b/tests/Dfe.ContentSupport.Web.Tests/Controllers/SitemapControllerTests.cs
@@ -14,19 +14,19 @@ private SitemapController GetController()
}
[Fact]
- public async Task Index_Calls_Service_GenerateSitemap()
+ public async Task Sitemap_Calls_Service_GenerateSitemap()
{
var sut = GetController();
sut.ControllerContext.HttpContext = new DefaultHttpContext();
var baseUrl =
$"{sut.ControllerContext.HttpContext.Request.Scheme}://{sut.ControllerContext.HttpContext.Request.Host}/";
- await sut.Index();
+ await sut.Sitemap();
_contentServiceMock.Verify(o => o.GenerateSitemap(baseUrl), Times.Once);
}
[Fact]
- public async Task Index_Calls_Returns_ContentResult_XmlModel()
+ public async Task Sitemap_Calls_Returns_ContentResult_XmlModel()
{
const string sitemap = "dummy";
_contentServiceMock.Setup(o => o.GenerateSitemap(It.IsAny()))
@@ -41,7 +41,7 @@ public async Task Index_Calls_Returns_ContentResult_XmlModel()
var sut = GetController();
sut.ControllerContext.HttpContext = new DefaultHttpContext();
- var result = await sut.Index();
+ var result = await sut.Sitemap();
result.Should().BeEquivalentTo(expected);
}
diff --git a/tests/Dfe.ContentSupport.Web.Tests/Extensions/DateTimeExtensionsTests.cs b/tests/Dfe.ContentSupport.Web.Tests/Extensions/DateTimeExtensionsTests.cs
new file mode 100644
index 0000000..72324c7
--- /dev/null
+++ b/tests/Dfe.ContentSupport.Web.Tests/Extensions/DateTimeExtensionsTests.cs
@@ -0,0 +1,17 @@
+using Dfe.ContentSupport.Web.Extensions;
+
+namespace Dfe.ContentSupport.Web.Tests.Extensions;
+
+public class DateTimeExtensionsTests
+{
+ [Fact]
+ public void ToLongString_Formats_Returns_Expected()
+ {
+ var testValue = new DateTime(2024, 2, 1, 0, 0, 0, DateTimeKind.Local);
+ const string expected = "01 February 2024";
+
+ var result = testValue.ToLongString();
+
+ result.Should().Be(expected);
+ }
+}
\ No newline at end of file
diff --git a/tests/Dfe.ContentSupport.Web.Tests/Models/Mapped/Custom/CustomAccordionTests.cs b/tests/Dfe.ContentSupport.Web.Tests/Models/Mapped/Custom/CustomAccordionTests.cs
index bfe4401..d34d40f 100644
--- a/tests/Dfe.ContentSupport.Web.Tests/Models/Mapped/Custom/CustomAccordionTests.cs
+++ b/tests/Dfe.ContentSupport.Web.Tests/Models/Mapped/Custom/CustomAccordionTests.cs
@@ -1,6 +1,7 @@
using Dfe.ContentSupport.Web.Common;
using Dfe.ContentSupport.Web.Configuration;
using Dfe.ContentSupport.Web.Models;
+using Dfe.ContentSupport.Web.Models.Mapped;
using Dfe.ContentSupport.Web.Models.Mapped.Custom;
using Dfe.ContentSupport.Web.Models.Mapped.Standard;
using Dfe.ContentSupport.Web.Models.Mapped.Types;
@@ -15,7 +16,7 @@ public class CustomAccordionTests
private const string InternalName = "Internal Name";
private const string Title = "Title";
private const string SummaryLine = "Summary Line";
- private const string Body = "Body";
+ private const string ContentInternalName = "Content Internal Name";
private static ContentItem DummyContentItem() => new()
{
@@ -27,7 +28,6 @@ public class CustomAccordionTests
InternalName = InternalName,
Title = Title,
SummaryLine = SummaryLine,
- Body = Body,
Sys = new Sys
{
ContentType = new ContentType
@@ -43,7 +43,12 @@ public class CustomAccordionTests
new Target(),
new Target(),
new Target()
- ]
+ ],
+ RichText = new ContentItem
+ {
+ InternalName = ContentInternalName,
+ NodeType = "paragraph"
+ }
}
}
};
@@ -61,18 +66,25 @@ public void MapCorrectly()
entry.NodeType.Should().Be(RichTextNodeType.EmbeddedEntry);
entry.InternalName.Should().Be(InternalName);
- entry.RichText.Should().BeNull();
+ entry.RichText.Should().NotBeNull();
entry.CustomComponent.Should().NotBeNull();
var customComponent = entry.CustomComponent;
customComponent.Should().BeAssignableTo();
var accordion = (customComponent as CustomAccordion)!;
+ var expectedBody= new RichTextContentItem
+ {
+ InternalName = ContentInternalName,
+ NodeType = RichTextNodeType.Paragraph,
+ Content = []
+ };
+
accordion.Type.Should().Be(CustomComponentType.Accordion);
accordion.InternalName.Should().Be(InternalName);
accordion.Title.Should().Be(Title);
accordion.SummaryLine.Should().Be(SummaryLine);
- accordion.Body.Should().Be(Body);
+ accordion.Body.Should().BeEquivalentTo(expectedBody);
accordion.Accordions.Count.Should().Be(3);
}
}
\ No newline at end of file
diff --git a/tests/Dfe.ContentSupport.Web.Tests/Services/ContentServiceTests.cs b/tests/Dfe.ContentSupport.Web.Tests/Services/ContentServiceTests.cs
index fc80bc1..704f487 100644
--- a/tests/Dfe.ContentSupport.Web.Tests/Services/ContentServiceTests.cs
+++ b/tests/Dfe.ContentSupport.Web.Tests/Services/ContentServiceTests.cs
@@ -3,6 +3,7 @@
using Contentful.Core.Models;
using Contentful.Core.Search;
using Dfe.ContentSupport.Web.Http;
+using Dfe.ContentSupport.Web.Models;
using Dfe.ContentSupport.Web.Models.Mapped;
namespace Dfe.ContentSupport.Web.Tests.Services;
@@ -18,9 +19,9 @@ public class ContentServiceTests
{
Items = new List
{
- new() { Slug = "slug1", IsSitemap = true },
- new() { Slug = "slug2", IsSitemap = false },
- new() { Slug = "slug3", IsSitemap = true }
+ new() { Slug = "slug1", IsSitemap = true, Sys = new Sys() },
+ new() { Slug = "slug2", IsSitemap = false, Sys = new Sys() },
+ new() { Slug = "slug3", IsSitemap = true, Sys = new Sys() }
}
};
@@ -37,7 +38,9 @@ private void SetupResponse(ContentfulCollection? response =
_mapperMock.Setup(o => o.MapToCsPages(res))
- .Returns(res.Items.Select(page => new ModelMapper(new SupportedAssetTypes()).MapToCsPage(page)).ToList());
+ .Returns(res.Items
+ .Select(page => new ModelMapper(new SupportedAssetTypes()).MapToCsPage(page))
+ .ToList());
}
[Fact]
@@ -74,7 +77,8 @@ public async Task GetContent_Returns_First_Result()
var sut = GetService();
var result = await sut.GetContent(It.IsAny());
- var expected = new ModelMapper(new SupportedAssetTypes()).MapToCsPage(_response.Items.First());
+ var expected =
+ new ModelMapper(new SupportedAssetTypes()).MapToCsPage(_response.Items.First());
result.Should().BeEquivalentTo(expected);
}
diff --git a/tests/Dfe.ContentSupport.Web.Tests/Services/ModelMapperTests.cs b/tests/Dfe.ContentSupport.Web.Tests/Services/ModelMapperTests.cs
index c9d2cfe..9f6b38b 100644
--- a/tests/Dfe.ContentSupport.Web.Tests/Services/ModelMapperTests.cs
+++ b/tests/Dfe.ContentSupport.Web.Tests/Services/ModelMapperTests.cs
@@ -20,9 +20,18 @@ public void MapToCsPages_Return_Correct_Amount()
{
var supportPages = new List
{
- new(),
- new(),
new()
+ {
+ Sys = new Sys()
+ },
+ new()
+ {
+ Sys = new Sys()
+ },
+ new()
+ {
+ Sys = new Sys()
+ }
};
var sut = GetService();