Skip to content

Commit 2cdaed6

Browse files
committed
Restyled like button
1 parent d37d491 commit 2cdaed6

File tree

3 files changed

+5
-8
lines changed

3 files changed

+5
-8
lines changed

LinkDotNet.Blog.UnitTests/Infrastructure/Persistence/CachedRepositoryTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ await sut.GetAllAsync(
6060
2,
6161
30);
6262

63-
repositoryMock.Verify(
63+
repositoryMock.Verify(
6464
r => r.GetAllAsync(
6565
It.IsAny<Expression<Func<BlogPost, bool>>>(),
6666
It.IsAny<Expression<Func<BlogPost, object>>>(),

LinkDotNet.Blog.UnitTests/Web/Shared/LikeTests.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ public void ShouldDisplayLikes(int likes, string expectedText)
2222
var cut = RenderComponent<Like>(
2323
p => p.Add(l => l.BlogPost, blogPost));
2424

25-
var label = cut.Find("small").TextContent;
25+
var label = cut.Find("button").TextContent;
2626

27-
label.Should().Be(expectedText);
27+
label.Should().Contain(expectedText);
2828
}
2929

3030
[Fact]
@@ -100,4 +100,4 @@ public void ShouldCheckStorageOnClickAgainAndDoNothingOnMismatch()
100100

101101
wasClicked.Should().BeFalse();
102102
}
103-
}
103+
}

LinkDotNet.Blog.Web/Shared/Like.razor

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22
@using LinkDotNet.Blog.Domain
33
@inject ILocalStorageService localStorage
44
<div class="like-container">
5-
<small>@BlogPost.Likes @LikeText</small>
6-
<button class="btn @BtnClass" @onclick="LikeBlogPost"><i class="far fa-thumbs-up"></i> @LikeTextButton</button>
5+
<button class="btn @BtnClass" @onclick="LikeBlogPost"><i class="far fa-thumbs-up"></i> @BlogPost.Likes @LikeText</button>
76
</div>
87

98
@code {
@@ -17,8 +16,6 @@
1716

1817
private string BtnClass => HasLiked ? "btn-secondary" : "btn-primary";
1918

20-
private string LikeTextButton => HasLiked ? "Unlike" : "Like";
21-
2219
private string LikeText => BlogPost.Likes == 1 ? "Like" : "Likes";
2320

2421
protected override async Task OnAfterRenderAsync(bool firstRender)

0 commit comments

Comments
 (0)