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 1
1
using System . Linq ;
2
- using AngleSharp . Html . Dom ;
2
+ using AngleSharp . Dom ;
3
3
using Blazored . Toast . Services ;
4
4
using Bunit ;
5
5
using Bunit . TestDoubles ;
@@ -21,7 +21,7 @@ public void ShouldCopyLinkToClipboard()
21
21
Services . GetRequiredService < FakeNavigationManager > ( ) . NavigateTo ( "blogPost/1" ) ;
22
22
var cut = RenderComponent < ShareBlogPost > ( ) ;
23
23
24
- cut . FindAll ( "a" ) [ 1 ] . Click ( ) ;
24
+ cut . Find ( "#share-clipboard" ) . Click ( ) ;
25
25
26
26
var copyToClipboardInvocation = JSInterop . Invocations . SingleOrDefault ( i => i . Identifier == "navigator.clipboard.writeText" ) ;
27
27
copyToClipboardInvocation . Arguments [ 0 ] . Should ( ) . Be ( "http://localhost/blogPost/1" ) ;
@@ -35,8 +35,7 @@ public void ShouldShareToLinkedIn()
35
35
36
36
var cut = RenderComponent < ShareBlogPost > ( ) ;
37
37
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" ) ;
41
40
}
42
41
}
Original file line number Diff line number Diff line change 3
3
@inject IToastService toastService
4
4
5
5
<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 >
8
8
</div >
9
9
@code {
10
10
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