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()
106106 blogPosts . Count . Should ( ) . Be ( 10 ) ;
107107 }
108108
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+
109133 private static AppConfiguration CreateSampleAppConfiguration ( )
110134 {
111135 return new ( )
Original file line number Diff line number Diff line change 3434
3535 protected override async Task OnInitializedAsync ()
3636 {
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 );
3842 }
3943
4044 private string GetAbsolutePreviewImageUrl ()
You can’t perform that action at this time.
0 commit comments