File tree Expand file tree Collapse file tree 3 files changed +16
-9
lines changed
LinkDotNet.Blog.UnitTests/Web/Shared
LinkDotNet.Blog.Web/Shared Expand file tree Collapse file tree 3 files changed +16
-9
lines changed Original file line number Diff line number Diff line change @@ -56,6 +56,17 @@ public void ShouldNotFireNextWhenOnFirstPage()
56
56
cut . Find ( "li:first-child" ) . ClassList . Should ( ) . Contain ( "disabled" ) ;
57
57
}
58
58
59
+ [ Fact ]
60
+ public void ShouldNotFireNextWhenNoPage ( )
61
+ {
62
+ var page = CreatePagedList ( 0 , 0 ) ;
63
+ var cut = RenderComponent < BlogPostNavigation > ( p =>
64
+ p . Add ( param => param . CurrentPage , page . Object ) ) ;
65
+
66
+ cut . Find ( "li:first-child" ) . ClassList . Should ( ) . Contain ( "disabled" ) ;
67
+ cut . Find ( "li:last-child" ) . ClassList . Should ( ) . Contain ( "disabled" ) ;
68
+ }
69
+
59
70
private static Mock < IPagedList < BlogPost > > CreatePagedList ( int currentPage , int pageCount )
60
71
{
61
72
var page = new Mock < IPagedList < BlogPost > > ( ) ;
Original file line number Diff line number Diff line change 2
2
@using X .PagedList
3
3
<nav aria-label =" Page navigation example" >
4
4
<ul class =" pagination justify-content-center" >
5
- <li class =" page-item @(!CurrentPage.IsFirstPage ? string.Empty : " disabled " )" >
5
+ <li class =" page-item @(!CurrentPage.IsFirstPage && CurrentPage.Count > 0 ? string.Empty : " disabled " )" >
6
6
<a class =" page-link" href =" #" tabindex =" -1" @onclick =" PreviousPage" >Previous</a >
7
7
</li >
8
- <li class =" page-item @(!CurrentPage.IsLastPage ? string.Empty : " disabled " )" >
8
+ <li class =" page-item @(!CurrentPage.IsLastPage && CurrentPage.Count > 0 ? string.Empty : " disabled " )" >
9
9
<a class =" page-link"
10
10
@onclick =" NextPage"
11
11
href =" #" >Next</a >
Original file line number Diff line number Diff line change @@ -47,7 +47,7 @@ OnYesPressed="DeleteItem"></ConfirmDialog>
47
47
48
48
protected override async Task OnInitializedAsync ()
49
49
{
50
- profileInformationEntries = await repository .GetAllAsync ();
50
+ profileInformationEntries = ( await repository .GetAllAsync ()). OrderBy ( d => d . CreatedDate ). ToList ();
51
51
}
52
52
53
53
private void ShowDeleteDialog (string key )
@@ -65,12 +65,8 @@ OnYesPressed="DeleteItem"></ConfirmDialog>
65
65
66
66
private async Task AddValue (KeyValuePair < string , string > toAdd )
67
67
{
68
- var newEntry = new ProfileInformationEntry
69
- {
70
- Key = toAdd .Key ,
71
- Value = toAdd .Value ,
72
- };
73
-
68
+ var newEntry = ProfileInformationEntry .Create (toAdd .Key , toAdd .Value );
69
+
74
70
profileInformationEntries .Add (newEntry );
75
71
await repository .AddAsync (newEntry );
76
72
}
You can’t perform that action at this time.
0 commit comments