File tree Expand file tree Collapse file tree 2 files changed +21
-1
lines changed
javascripts/discourse/components Expand file tree Collapse file tree 2 files changed +21
-1
lines changed Original file line number Diff line number Diff line change @@ -180,7 +180,7 @@ export default class FeaturedHomepageTopics extends Component {
180180 get showRightArrow () {
181181 return (
182182 this .currentFeaturedTopic <
183- this .featuredTopicsAvailable - this .actualTopicsDisplayed - 1
183+ this .featuredTopicsAvailable - this .actualTopicsDisplayed
184184 );
185185 }
186186
Original file line number Diff line number Diff line change 8787 expect ( page ) . to have_css ( ".featured-topics-controls .right-page-button" )
8888 expect ( page ) . to have_css ( ".featured-topics-controls .left-page-button" )
8989 end
90+
91+ it "should allow pagination even if last page only has 1 topic" do
92+ theme . update_setting ( :number_of_topics , 3 )
93+ theme . update_setting ( :max_number_of_topics , 4 )
94+ theme . save!
95+
96+ # First page should have a right arrow when there's only 1 topic on the next page
97+ visit ( "/" )
98+ expect ( page ) . to have_css ( ".featured-topics .featured-topic" , count : 3 )
99+ expect ( page ) . to have_css ( ".featured-topics-controls .page-button-container" )
100+ expect ( page ) . to have_css ( ".featured-topics-controls .right-page-button" )
101+ expect ( page ) . not_to have_css ( ".featured-topics-controls .left-page-button" )
102+
103+ # Last page should only have left arrow
104+ find ( ".featured-topics-controls .right-page-button" ) . click
105+ expect ( page ) . to have_css ( ".featured-topics .featured-topic" , count : 1 )
106+ expect ( page ) . to have_css ( ".featured-topics-controls .page-button-container" )
107+ expect ( page ) . not_to have_css ( ".featured-topics-controls .right-page-button" )
108+ expect ( page ) . to have_css ( ".featured-topics-controls .left-page-button" )
109+ end
90110 end
91111end
You can’t perform that action at this time.
0 commit comments