Skip to content

Commit de3f22b

Browse files
committed
TD-4303: Adding automated accessibility tests for LH
2 parents b0b4cde + 5196a33 commit de3f22b

File tree

147 files changed

+37854
-23757
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

147 files changed

+37854
-23757
lines changed

AdminUI/LearningHub.Nhs.AdminUI/Controllers/ResourceController.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,12 +164,17 @@ public async Task<IActionResult> GetDevIdDetails(int resourceVersionId)
164164
public async Task<IActionResult> UpdateDevIdDetails(ResourceVersionDevIdViewModel model)
165165
{
166166
var message = string.Empty;
167-
if (await this.resourceService.DoesDevIdExistsAsync(model.DevId))
167+
if (string.IsNullOrEmpty(model.DevId))
168+
{
169+
message = "Enter a Dev id for the resource";
170+
}
171+
else if (await this.resourceService.DoesDevIdExistsAsync(model.DevId.Trim()))
168172
{
169173
message = "Duplicate";
170174
}
171175
else
172176
{
177+
model.DevId = model.DevId.Trim();
173178
await this.resourceService.UpdateDevIdDetailsAsync(model);
174179
message = "Success";
175180
}

AdminUI/LearningHub.Nhs.AdminUI/LearningHub.Nhs.AdminUI.csproj

Lines changed: 622 additions & 619 deletions
Large diffs are not rendered by default.

AdminUI/LearningHub.Nhs.AdminUI/ServiceCollectionExtension.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,7 @@ public static void ConfigureServices(this IServiceCollection services, IConfigur
141141

142142
services.AddTransient<CookieEventHandler>();
143143
services.AddSingleton<LogoutUserManager>();
144+
services.AddSingleton<VersionService>();
144145

145146
services.AddAuthentication(options =>
146147
{
@@ -195,6 +196,8 @@ public static void ConfigureServices(this IServiceCollection services, IConfigur
195196
// Auto Mapper Configurations
196197
var mappingConfig = new MapperConfiguration(mc =>
197198
{
199+
mc.AllowNullCollections = true;
200+
mc.ShouldMapMethod = m => false;
198201
mc.AddProfile(new MappingProfile());
199202
});
200203
IMapper mapper = mappingConfig.CreateMapper();
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
namespace LearningHub.Nhs.AdminUI.Services
2+
{
3+
/// <summary>
4+
/// Defines the <see cref="VersionService" />.
5+
/// </summary>
6+
public class VersionService
7+
{
8+
/// <summary>
9+
/// The GetVersion.
10+
/// </summary>
11+
/// <returns>The <see cref="string"/>.</returns>
12+
public string GetVersion()
13+
{
14+
var version = typeof(Program).Assembly.GetName().Version;
15+
return $"{version?.Major}.{version?.Minor}.{version?.Build}";
16+
}
17+
}
18+
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
namespace LearningHub.Nhs.AdminUI.ViewComponents
2+
{
3+
using LearningHub.Nhs.AdminUI.Services;
4+
using Microsoft.AspNetCore.Html;
5+
using Microsoft.AspNetCore.Mvc;
6+
using Microsoft.AspNetCore.Mvc.ViewComponents;
7+
8+
/// <summary>
9+
/// Initializes a new instance of the <see cref="VersionViewComponent"/> class.
10+
/// </summary>
11+
public class VersionViewComponent : ViewComponent
12+
{
13+
private readonly VersionService versionService;
14+
15+
/// <summary>
16+
/// Initializes a new instance of the <see cref="VersionViewComponent"/> class.
17+
/// </summary>
18+
/// <param name="versionService">.</param>
19+
public VersionViewComponent(VersionService versionService)
20+
{
21+
this.versionService = versionService;
22+
}
23+
24+
/// <summary>
25+
/// The Invoke.
26+
/// </summary>
27+
/// <returns>A representing the result of the synchronous operation.</returns>
28+
public IViewComponentResult Invoke()
29+
{
30+
var version = this.versionService.GetVersion();
31+
return new HtmlContentViewComponentResult(new HtmlString($"<!-- Version: {version} -->"));
32+
}
33+
}
34+
}

AdminUI/LearningHub.Nhs.AdminUI/Views/Resource/Details.cshtml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -651,13 +651,19 @@
651651
{
652652
<!-- Alert Text -->
653653
<div class="d-flex ml-5 my-2">
654-
<div id="alertInfo" class="alert alert-success">Successfully updated the details</div>
654+
<div id="alertInfo" class="alert alert-success">Successfully added the Dev ID.</div>
655655
</div>
656656
}
657657
@if (this.ViewBag.Status == "Duplicate")
658658
{
659659
<div class="d-flex ml-5 my-2">
660-
<div id="alertInfo" class="alert alert-danger">Dev Id already exists.</div>
660+
<div id="alertInfo" class="alert alert-danger">Dev ID already exists.</div>
661+
</div>
662+
}
663+
else if (this.ViewBag.Status == "Enter a Dev id for the resource")
664+
{
665+
<div class="d-flex ml-5 my-2">
666+
<div id="alertInfo" class="alert alert-danger">You must enter a Dev ID.</div>
661667
</div>
662668
}
663669
<div id="devIdDetails" class="pl-2">

AdminUI/LearningHub.Nhs.AdminUI/Views/Resource/_DevIdDetails.cshtml

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,23 @@
88
<form asp-controller="Resource" asp-action="UpdateDevIdDetails" method="post">
99
<div class="row m-0">
1010
<div class="form-group col-4">
11-
<label asp-for="DevId" class="control-label">Development Id</label>
12-
<input asp-for="DevId" class="form-control" />
11+
<div class="col-12" style="padding-left:0px;" >
12+
<dl>
13+
<dt>Dev ID: </dt>
14+
<dd>
15+
@Html.DisplayFor(model => model.DevId)
16+
</dd>
17+
</dl>
18+
</div>
19+
<label asp-for="DevId" class="control-label">Add Dev ID</label>
20+
<input asp-for="DevId" class="form-control" maxlength="30" />
1321
<input type="hidden" asp-for="ResourceVersionId" />
1422
</div>
1523
</div>
1624
<div class="form-group col-lg-2 d-flex flex-row justify-content-between">
1725
<div>
18-
<button type="submit" class="btn btn-common btn-success">Save</button>
19-
</div>
26+
<button type="submit" class="btn btn-common btn-success nhsuk-button">Save</button>
27+
</div>
2028
</div>
2129
</form>
2230
</div>

AdminUI/LearningHub.Nhs.AdminUI/Views/Shared/_Layout.cshtml

Lines changed: 74 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -2,83 +2,84 @@
22
<!DOCTYPE html>
33
<html>
44
<head>
5-
<meta charset="utf-8" />
6-
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
7-
<title>@ViewData["Title"] - Learning Hub Administration</title>
8-
<link rel="apple-touch-icon" sizes="180x180" href="~/apple-touch-icon.png">
9-
<link rel="icon" type="image/png" sizes="32x32" href="~/favicon-32x32.png">
10-
<link rel="icon" type="image/png" sizes="16x16" href="~/favicon-16x16.png">
5+
<meta charset="utf-8" />
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
7+
<title>@ViewData["Title"] - Learning Hub Administration</title>
8+
<link rel="apple-touch-icon" sizes="180x180" href="~/apple-touch-icon.png">
9+
<link rel="icon" type="image/png" sizes="32x32" href="~/favicon-32x32.png">
10+
<link rel="icon" type="image/png" sizes="16x16" href="~/favicon-16x16.png">
1111

12-
<environment include="Development">
12+
<environment include="Development">
1313

14-
<link rel="stylesheet" href="~/lib/bootstrap/dist/css/bootstrap.css" />
15-
<link rel="stylesheet" type="text/css" href="~/lib/fontawesome-free-6.4.2-web/css/all.css"/>
16-
</environment>
17-
<environment exclude="Development">
18-
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.1.3/css/bootstrap.min.css"
19-
asp-fallback-href="~/lib/bootstrap/dist/css/bootstrap.min.css"
20-
asp-fallback-test-class="sr-only" asp-fallback-test-property="position" asp-fallback-test-value="absolute"
21-
crossorigin="anonymous"
22-
integrity="sha256-eSi1q2PG6J7g7ib17yAaWMcrr5GrtohYChqibrV7PBE=" />
23-
<link rel="stylesheet" type="text/css" href="~/lib/fontawesome-free-6.4.2-web/css/all.min.css" />
24-
</environment>
25-
<link rel="stylesheet" type="text/css" href="~/css/site.css" asp-append-version="true"/>
26-
<link rel="stylesheet" type="text/css" href="~/css/nhsuk/common.css"/>
27-
@RenderSection("Styles", required: false)
28-
@await Html.PartialAsync("_GoogleAnalytics")
29-
<partial name="~/Views/Shared/_TimezoneInfoScriptPartial.cshtml" />
14+
<link rel="stylesheet" href="~/lib/bootstrap/dist/css/bootstrap.css" />
15+
<link rel="stylesheet" type="text/css" href="~/lib/fontawesome-free-6.4.2-web/css/all.css" />
16+
</environment>
17+
<environment exclude="Development">
18+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.1.3/css/bootstrap.min.css"
19+
asp-fallback-href="~/lib/bootstrap/dist/css/bootstrap.min.css"
20+
asp-fallback-test-class="sr-only" asp-fallback-test-property="position" asp-fallback-test-value="absolute"
21+
crossorigin="anonymous"
22+
integrity="sha256-eSi1q2PG6J7g7ib17yAaWMcrr5GrtohYChqibrV7PBE=" />
23+
<link rel="stylesheet" type="text/css" href="~/lib/fontawesome-free-6.4.2-web/css/all.min.css" />
24+
</environment>
25+
<link rel="stylesheet" type="text/css" href="~/css/site.css" asp-append-version="true" />
26+
<link rel="stylesheet" type="text/css" href="~/css/nhsuk/common.css" />
27+
@RenderSection("Styles", required: false)
28+
@await Html.PartialAsync("_GoogleAnalytics")
29+
<partial name="~/Views/Shared/_TimezoneInfoScriptPartial.cshtml" />
3030
</head>
3131
<body>
32-
<header role="banner" id="header">
33-
<partial name="~/Views/Shared/_NavPartial.cshtml" />
34-
</header>
35-
<div class="container-fluid">
36-
<!--<partial name="_CookieConsentPartial" />-->
37-
<main role="main" id="maincontent" tabindex="-1">
38-
@{
39-
var mainWidth = IsSectionDefined("SideMenu") ? "col-sm-9 col-lg-9 col-xl-10 pageWithMenu" : "col-sm-12";
40-
}
41-
<div class="row">
42-
@if (IsSectionDefined("SideMenu"))
43-
{
44-
<div class="col-sm-3 col-lg-3 col-xl-2 side-menu">
45-
@RenderSection("SideMenu", required: false)
46-
</div>
47-
}
48-
<div class="@mainWidth">
49-
@RenderBody()
50-
</div>
51-
</div>
52-
</main>
53-
</div>
54-
<footer class="border-top footer text-muted">
55-
<partial name="~/Views/Shared/_FooterPartial.cshtml" />
56-
</footer>
32+
<header role="banner" id="header">
33+
<partial name="~/Views/Shared/_NavPartial.cshtml" />
34+
</header>
35+
<div class="container-fluid">
36+
<!--<partial name="_CookieConsentPartial" />-->
37+
<main role="main" id="maincontent" tabindex="-1">
38+
@{
39+
var mainWidth = IsSectionDefined("SideMenu") ? "col-sm-9 col-lg-9 col-xl-10 pageWithMenu" : "col-sm-12";
40+
}
41+
<div class="row">
42+
@if (IsSectionDefined("SideMenu"))
43+
{
44+
<div class="col-sm-3 col-lg-3 col-xl-2 side-menu">
45+
@RenderSection("SideMenu", required: false)
46+
</div>
47+
}
48+
<div class="@mainWidth">
49+
@RenderBody()
50+
</div>
51+
</div>
52+
</main>
53+
</div>
54+
<footer class="border-top footer text-muted">
55+
<partial name="~/Views/Shared/_FooterPartial.cshtml" />
56+
</footer>
5757

58-
<environment include="Development">
59-
<script src="~/lib/jquery/dist/jquery.js"></script>
60-
<script src="~/lib/bootstrap/dist/js/bootstrap.bundle.js"></script>
61-
<script src="~/lib/ckeditor/ckeditor.js"></script>
62-
</environment>
63-
<environment exclude="Development">
64-
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"
65-
asp-fallback-src="~/lib/jquery/dist/jquery.min.js"
66-
asp-fallback-test="window.jQuery"
67-
crossorigin="anonymous"
68-
integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8=">
69-
</script>
70-
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.1.3/js/bootstrap.bundle.min.js"
71-
asp-fallback-src="~/lib/bootstrap/dist/js/bootstrap.bundle.min.js"
72-
asp-fallback-test="window.jQuery && window.jQuery.fn && window.jQuery.fn.modal"
73-
crossorigin="anonymous"
74-
integrity="sha256-E/V4cWE4qvAeO5MOhjtGtqDzPndRO1LBk8lJ/PR7CA4=">
75-
</script>
76-
<script src="~/lib/ckeditor/ckeditor.js"></script>
77-
@*<script type="text/javascript" src="~/js/site.min.js"></script>*@
78-
</environment>
79-
@*<script type="text/javascript" src="~/js/bundle/header.js"></script>*@
80-
<partial name="~/Views/Shared/_ValidationScriptsPartial.cshtml" />
81-
@RenderSection("Scripts", required: false)
58+
<environment include="Development">
59+
<script src="~/lib/jquery/dist/jquery.js"></script>
60+
<script src="~/lib/bootstrap/dist/js/bootstrap.bundle.js"></script>
61+
<script src="~/lib/ckeditor/ckeditor.js"></script>
62+
</environment>
63+
<environment exclude="Development">
64+
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"
65+
asp-fallback-src="~/lib/jquery/dist/jquery.min.js"
66+
asp-fallback-test="window.jQuery"
67+
crossorigin="anonymous"
68+
integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8=">
69+
</script>
70+
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.1.3/js/bootstrap.bundle.min.js"
71+
asp-fallback-src="~/lib/bootstrap/dist/js/bootstrap.bundle.min.js"
72+
asp-fallback-test="window.jQuery && window.jQuery.fn && window.jQuery.fn.modal"
73+
crossorigin="anonymous"
74+
integrity="sha256-E/V4cWE4qvAeO5MOhjtGtqDzPndRO1LBk8lJ/PR7CA4=">
75+
</script>
76+
<script src="~/lib/ckeditor/ckeditor.js"></script>
77+
@*<script type="text/javascript" src="~/js/site.min.js"></script>*@
78+
</environment>
79+
@*<script type="text/javascript" src="~/js/bundle/header.js"></script>*@
80+
<partial name="~/Views/Shared/_ValidationScriptsPartial.cshtml" />
81+
@RenderSection("Scripts", required: false)
8282
</body>
8383
</html>
84-
<!-- Build number: @settings.Value.BuildNumber -->
84+
<!-- Build number: @settings.Value.BuildNumber -->
85+
@await Component.InvokeAsync("Version")

0 commit comments

Comments
 (0)