Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,9 @@
<span class="govuk-caption-l">@Constants.CompareYourSchools</span>
@ViewData["Header"]
</h1>

<govuk-pagination id="about-the-school-pagination">
<govuk-pagination-next href="@Url.RouteUrl(RouteConstants.CompareSecondaryAcademicPerformancePupilAttainment, new { urns = Model.URNs })">Academic Performance</govuk-pagination-next>
</govuk-pagination>
</div>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,9 @@
</ul>
</nav>

<govuk-pagination id="academic-performance-english-maths-pagination">
<govuk-pagination-previous href="@Url.RouteUrl(RouteConstants.CompareSecondaryAcademicPerformancePupilAttainment, new { urns = Model.URNs })">Academic performance: Pupil attainment</govuk-pagination-previous>
<govuk-pagination-next href="@Url.RouteUrl(RouteConstants.CompareSecondaryDestinations, new { urns = Model.URNs })">Destinations after year 11</govuk-pagination-next>
</govuk-pagination>
</div>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,10 @@
</li>
</ul>
</nav>

<govuk-pagination id="academic-performance-attainment-pagination">
<govuk-pagination-previous href="@Url.RouteUrl(RouteConstants.CompareSecondaryAboutYourSchools, new { urns = Model.URNs })">About your schools</govuk-pagination-previous>
<govuk-pagination-next href="@Url.RouteUrl(RouteConstants.CompareSecondaryAcademicPerformanceEnglishAndMathsResults, new { urns = Model.URNs })">Academic performance: English and maths results</govuk-pagination-next>
</govuk-pagination>
</div>
</div>
5 changes: 5 additions & 0 deletions SAPPub.Web/Areas/Compare/Views/Secondary/Destinations.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,10 @@
<span class="govuk-caption-l">@Constants.CompareYourSchools</span>
@ViewData["Header"]
</h1>

<govuk-pagination id="destinations-pagination">
<govuk-pagination-previous href="@Url.RouteUrl(RouteConstants.CompareSecondaryAcademicPerformanceEnglishAndMathsResults, new { urns = Model.URNs })">Academic performance: English and maths results</govuk-pagination-previous>
<govuk-pagination-next href="@Url.RouteUrl(RouteConstants.CompareSecondaryNextSteps, new { urns = Model.URNs })">Next steps</govuk-pagination-next>
</govuk-pagination>
</div>
</div>
4 changes: 4 additions & 0 deletions SAPPub.Web/Areas/Compare/Views/Secondary/NextSteps.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,9 @@
You can find out more about each school you're comparing by viewing the school profile or visiting the school website.
</p>

<govuk-pagination id="next-steps-pagination">
<govuk-pagination-previous href="@Url.RouteUrl(RouteConstants.CompareSecondaryDestinations, new { urns = Model.URNs })">Destinations after year 11</govuk-pagination-previous>
</govuk-pagination>

</div>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -67,4 +67,21 @@ public async Task AboutYourSchools_Displays_VerticalNavigation()
Assert.Equal(4, doc.QuerySelectorAll(".moj-side-navigation__item").Length);
Assert.Single(doc.QuerySelectorAll(".moj-side-navigation__item--active"));
}

[Fact]
public async Task DisplaysPagination()
{
// Arrange
var doc = await Fixture.BrowseToPage(_pageUrl);

// Act
var nav = doc.QuerySelector("#about-the-school-pagination");
var navNext = doc.QuerySelector("#about-the-school-pagination .govuk-pagination__next a");
var navPrevious = doc.QuerySelector("#about-the-school-pagination .govuk-pagination__prev a");

Assert.NotNull(nav);
Assert.NotNull(navNext);
Assert.Null(navPrevious);
Assert.Contains("Academic Performance", navNext.TextContent);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -70,4 +70,22 @@ public async Task DestinationsPage_Displays_VerticalNavigation()
Assert.Equal(4, doc.QuerySelectorAll(".moj-side-navigation__item").Length);
Assert.Single(doc.QuerySelectorAll(".moj-side-navigation__item--active"));
}

[Fact]
public async Task DisplaysPagination()
{
// Arrange
var doc = await Fixture.BrowseToPage($"{_pageUrl}?{QueryString}");

// Act
var nav = doc.QuerySelector("#destinations-pagination");
var navNext = doc.QuerySelector("#destinations-pagination .govuk-pagination__next a");
var navPrevious = doc.QuerySelector("#destinations-pagination .govuk-pagination__prev a");

Assert.NotNull(nav);
Assert.NotNull(navNext);
Assert.NotNull(navPrevious);
Assert.Contains("Academic performance: English and maths results", navPrevious.TextContent);
Assert.Contains("Next steps", navNext.TextContent);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
using Moq;
using SAPPub.Core.Entities;
using SAPPub.Core.Interfaces.Services;
using SAPPub.Core.Tests.TestBuilders;
using SAPPub.Web.Tests.Unit.Page.Infrastructure;

namespace SAPPub.Web.Tests.Unit.Page.Areas.Compare.Secondary;

[Collection("WebAppCollection")]
public class EnglishAndMathsResultsTests : PageTestsBase
{
private string _pageUrl = "compare/secondary/english-and-maths-results?urns=123456&urns=123457";
private readonly Mock<IEstablishmentService> _establishmentService;

public EnglishAndMathsResultsTests(WebAppFixture fixture) : base(fixture)
{
// set up the mock establishment service to return establishments for the URNs in the query string
// this is used by the page validation filter to determine if the establishments are secondary and should be compared
_establishmentService = UseMock<IEstablishmentService>();
var establishmentList = (new List<Establishment>
{
new EstablishmentTestBuilder().WithURN("123456").WithIsKeyStage4(true).Build(),
new EstablishmentTestBuilder().WithURN("123457").WithIsKeyStage4(true).Build(),
}).ToList();

establishmentList.Select(e =>
_establishmentService.Setup(s =>
s.GetEstablishmentAsync(e.URN, It.IsAny<CancellationToken>())).ReturnsAsync(e)).ToList();
}

[Fact]
public async Task DisplaysPagination()
{
// Arrange
var doc = await Fixture.BrowseToPage(_pageUrl);

// Act
var nav = doc.QuerySelector("#academic-performance-english-maths-pagination");
var navNext = doc.QuerySelector("#academic-performance-english-maths-pagination .govuk-pagination__next a");
var navPrevious = doc.QuerySelector("#academic-performance-english-maths-pagination .govuk-pagination__prev a");

Assert.NotNull(nav);
Assert.NotNull(navNext);
Assert.NotNull(navPrevious);
Assert.Contains("Academic performance: Pupil attainment", navPrevious.TextContent);
Assert.Contains("Destinations after year 11", navNext.TextContent);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,21 @@ public async Task NextSteps_Show_ExploreMoreInformation_Header()

Assert.NotNull(h2Header);
}

[Fact]
public async Task DisplaysPagination()
{
// Arrange
var doc = await Fixture.BrowseToPage(_pageUrl);

// Act
var nav = doc.QuerySelector("#next-steps-pagination");
var navNext = doc.QuerySelector("#next-steps-pagination .govuk-pagination__next a");
var navPrevious = doc.QuerySelector("#next-steps-pagination .govuk-pagination__prev a");

Assert.NotNull(nav);
Assert.Null(navNext);
Assert.NotNull(navPrevious);
Assert.Contains("Destinations after year 11", navPrevious.TextContent);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,22 @@ public async Task AcademicPerformanceProgressAndAttainmentTests_Has_Correct_Sub_
Assert.Equal("/compare/secondary/pupil-attainment?urns=123456&urns=123457", links[0].GetAttribute("href"));
Assert.Equal("/compare/secondary/english-and-maths-results?urns=123456&urns=123457", links[1].GetAttribute("href"));
}

[Fact]
public async Task DisplaysPagination()
{
// Arrange
var doc = await Fixture.BrowseToPage(_pageUrl);

// Act
var nav = doc.QuerySelector("#academic-performance-attainment-pagination");
var navNext = doc.QuerySelector("#academic-performance-attainment-pagination .govuk-pagination__next a");
var navPrevious = doc.QuerySelector("#academic-performance-attainment-pagination .govuk-pagination__prev a");

Assert.NotNull(nav);
Assert.NotNull(navNext);
Assert.NotNull(navPrevious);
Assert.Contains("About your schools", navPrevious.TextContent);
Assert.Contains("Academic performance: English and maths results", navNext.TextContent);
}
}
Loading