File tree Expand file tree Collapse file tree 2 files changed +29
-1
lines changed
LinkDotNet.Blog.IntegrationTests/Web/Pages
LinkDotNet.Blog.Web/Pages Expand file tree Collapse file tree 2 files changed +29
-1
lines changed Original file line number Diff line number Diff line change @@ -106,6 +106,30 @@ public async Task ShouldLoadPreviousBatchOnClick()
106
106
blogPosts . Count . Should ( ) . Be ( 10 ) ;
107
107
}
108
108
109
+ [ Fact ]
110
+ public async Task ShouldLoadTags ( )
111
+ {
112
+ var publishedPost = new BlogPostBuilder ( )
113
+ . WithTitle ( "Published" )
114
+ . IsPublished ( )
115
+ . WithTags ( "C Sharp" , "Tag2" )
116
+ . Build ( ) ;
117
+ await Repository . StoreAsync ( publishedPost ) ;
118
+ using var ctx = new TestContext ( ) ;
119
+ ctx . JSInterop . Mode = JSRuntimeMode . Loose ;
120
+ RegisterComponents ( ctx ) ;
121
+ var cut = ctx . RenderComponent < Index > ( ) ;
122
+ cut . WaitForState ( ( ) => cut . FindAll ( ".blog-card" ) . Any ( ) ) ;
123
+
124
+ var tags = cut . FindComponent < ShortBlogPost > ( ) . FindAll ( ".goto-tag" ) ;
125
+
126
+ tags . Should ( ) . HaveCount ( 2 ) ;
127
+ tags . Select ( t => t . TextContent ) . Should ( ) . Contain ( "C Sharp" ) ;
128
+ tags . Select ( t => t . TextContent ) . Should ( ) . Contain ( "Tag2" ) ;
129
+ tags . Select ( t => t . Attributes . Single ( a => a . Name == "href" ) . Value ) . Should ( ) . Contain ( "/searchByTag/C%20Sharp" ) ;
130
+ tags . Select ( t => t . Attributes . Single ( a => a . Name == "href" ) . Value ) . Should ( ) . Contain ( "/searchByTag/Tag2" ) ;
131
+ }
132
+
109
133
private static AppConfiguration CreateSampleAppConfiguration ( )
110
134
{
111
135
return new ( )
Original file line number Diff line number Diff line change 34
34
35
35
protected override async Task OnInitializedAsync ()
36
36
{
37
- currentPage = await blogPostRepository .GetAllAsync (p => p .IsPublished , b => b .UpdatedDate , pageSize : appConfiguration .BlogPostsPerPage );
37
+ currentPage = await blogPostRepository .GetAllAsync (
38
+ p => p .IsPublished ,
39
+ b => b .UpdatedDate ,
40
+ b => b .Tags ,
41
+ pageSize : appConfiguration .BlogPostsPerPage );
38
42
}
39
43
40
44
private string GetAbsolutePreviewImageUrl ()
You can’t perform that action at this time.
0 commit comments