Skip to content

Commit 24d602a

Browse files
Handles null key in FindPercentComplete method
Modifies the FindPercentComplete method to return null when the key is null. Updates the unit test to reflect the change in behavior. Updates styling for elements related to current page display.
1 parent 47fe4d1 commit 24d602a

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

EssentialCSharp.Web.Tests/SiteMappingTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ public void FindCSyntaxFundamentalsSanitizedWithAnchorReturnsCorrectSiteMap()
8484
}
8585

8686
[Fact]
87-
public void FindPercentComplete_KeyIsNull_ThrowsArgumentNullException()
87+
public void FindPercentComplete_KeyIsNull_ReturnsNull()
8888
{
8989
// Arrange
9090

EssentialCSharp.Web/Extensions/SiteMappingListExtensions.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public static class SiteMappingListExtensions
2929
/// Finds percent complete based on a key.
3030
/// </summary>
3131
/// <param name="siteMappings">IList of SiteMappings</param>
32-
/// <param name="key">If null, uses the first key in the list</param>
32+
/// <param name="key">The key to search for. If null, returns null.</param>
3333
/// <returns>Returns a formatted double for use as the percent complete.</returns>
3434
public static string? FindPercentComplete(this IList<SiteMapping> siteMappings, string? key)
3535
{
@@ -39,7 +39,7 @@ public static class SiteMappingListExtensions
3939
}
4040
if (key.Trim().Length is 0)
4141
{
42-
throw new ArgumentException("Parameter key is whitespace or empty: ", nameof(key));
42+
throw new ArgumentException("Parameter 'key' cannot be null or whitespace.", nameof(key));
4343
}
4444
int currentMappingCount = 0;
4545
int overallMappingCount = 0;

EssentialCSharp.Web/Views/Shared/_Layout.cshtml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,10 +121,10 @@
121121
</div>
122122
</div>
123123

124-
<a v-if="chapterParentPage" :href="chapterParentPage.href" class="menu menu-chapter-title text-light">
124+
<a v-if="chapterParentPage" :href="chapterParentPage.href" class="page-menu menu-chapter-title text-light">
125125
<span v-cloak>{{chapterParentPage.title}}</span>
126126
</a>
127-
<div class="menu menu-progress text-light" v-if="isContentPage">
127+
<div class="page-menu menu-progress text-light" v-if="isContentPage">
128128
<span v-cloak>{{percentComplete}}%</span>
129129
</div>
130130

EssentialCSharp.Web/wwwroot/css/styles.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ a:hover {
224224
}
225225
}
226226

227-
.menu {
227+
.page-menu {
228228
white-space: nowrap;
229229
overflow: hidden;
230230
text-decoration: none;

0 commit comments

Comments
 (0)