File tree Expand file tree Collapse file tree 2 files changed +6
-7
lines changed
LinkDotNet.Blog.UnitTests/Web/Shared
LinkDotNet.Blog.Web/Shared Expand file tree Collapse file tree 2 files changed +6
-7
lines changed Original file line number Diff line number Diff line change 11using System . Linq ;
2- using AngleSharp . Html . Dom ;
2+ using AngleSharp . Dom ;
33using Blazored . Toast . Services ;
44using Bunit ;
55using Bunit . TestDoubles ;
@@ -21,7 +21,7 @@ public void ShouldCopyLinkToClipboard()
2121 Services . GetRequiredService < FakeNavigationManager > ( ) . NavigateTo ( "blogPost/1" ) ;
2222 var cut = RenderComponent < ShareBlogPost > ( ) ;
2323
24- cut . FindAll ( "a" ) [ 1 ] . Click ( ) ;
24+ cut . Find ( "#share-clipboard" ) . Click ( ) ;
2525
2626 var copyToClipboardInvocation = JSInterop . Invocations . SingleOrDefault ( i => i . Identifier == "navigator.clipboard.writeText" ) ;
2727 copyToClipboardInvocation . Arguments [ 0 ] . Should ( ) . Be ( "http://localhost/blogPost/1" ) ;
@@ -35,8 +35,7 @@ public void ShouldShareToLinkedIn()
3535
3636 var cut = RenderComponent < ShareBlogPost > ( ) ;
3737
38- var linkedInShare = ( IHtmlAnchorElement ) cut . FindAll ( "a" ) [ 0 ] ;
39- linkedInShare . Href . Should ( )
40- . Be ( "https://www.linkedin.com/shareArticle?mini=true&url=http://localhost/blogPost/1" ) ;
38+ var linkedInShare = cut . Find ( "#share-linkedin" ) . Attributes . Single ( s => s . Name == "href" ) . Value ;
39+ linkedInShare . Should ( ) . Be ( "https://www.linkedin.com/shareArticle?mini=true&url=http://localhost/blogPost/1" ) ;
4140 }
4241}
Original file line number Diff line number Diff line change 33@inject IToastService toastService
44
55<div class =" flex-row" >
6- <a href =" @LinkedInShare" target =" _blank" ><i class =" fab fa-linkedin fa-lg" ></i ></a >
7- <a href =" javascript:void(0)" @onclick =" CopyToClipboard" ><i class =" fas fa-link fa-lg" ></i ></a >
6+ <a id = " share-linkedin " href =" @LinkedInShare" target =" _blank" ><i class =" fab fa-linkedin fa-lg" ></i ></a >
7+ <a id = " share-clipboard " href =" javascript:void(0)" @onclick =" CopyToClipboard" ><i class =" fas fa-link fa-lg" ></i ></a >
88</div >
99@code {
1010 private string LinkedInShare => $" https://www.linkedin.com/shareArticle?mini=true&url={navigationManager .Uri }" ;
You can’t perform that action at this time.
0 commit comments