show the sidebar on all logged in feed views (#13877)
This commit is contained in:
parent
e2e923515f
commit
9b326e3638
3 changed files with 43 additions and 1 deletions
|
|
@ -47,12 +47,13 @@ function renderTagsFollowed(user = userData()) {
|
|||
|
||||
function renderSidebar() {
|
||||
const sidebarContainer = document.getElementById('sidebar-wrapper-right');
|
||||
const { pathname } = window.location;
|
||||
|
||||
// If the screen's width is less than 640 we don't need this extra data.
|
||||
if (
|
||||
sidebarContainer &&
|
||||
screen.width >= 640 &&
|
||||
window.location.pathname === '/'
|
||||
(pathname === '/' || pathname === '/latest' || pathname.includes('/top/'))
|
||||
) {
|
||||
window
|
||||
.fetch('/sidebars/home')
|
||||
|
|
|
|||
|
|
@ -5,6 +5,8 @@ describe('Home Feed Navigation', () => {
|
|||
|
||||
cy.get('@user').then((user) => {
|
||||
cy.loginUser(user).then(() => {
|
||||
// Explicitly set the viewport to make sure we're in the full desktop view for these tests
|
||||
cy.viewport('macbook-15');
|
||||
cy.visit('/');
|
||||
});
|
||||
});
|
||||
|
|
@ -102,4 +104,40 @@ describe('Home Feed Navigation', () => {
|
|||
);
|
||||
});
|
||||
});
|
||||
|
||||
it('shows the sidebar on all feed views', () => {
|
||||
// Default Feed view
|
||||
cy.findByRole('heading', { name: '#tag1' });
|
||||
cy.findByRole('heading', { name: 'Listings' });
|
||||
|
||||
// Week view
|
||||
cy.findByRole('link', { name: 'Week' }).click();
|
||||
cy.url().should('contain', '/top/week');
|
||||
cy.findByRole('heading', { name: '#tag1' });
|
||||
cy.findByRole('heading', { name: 'Listings' });
|
||||
|
||||
// Month view
|
||||
cy.findByRole('link', { name: 'Month' }).click();
|
||||
cy.url().should('contain', '/top/month');
|
||||
cy.findByRole('heading', { name: '#tag1' });
|
||||
cy.findByRole('heading', { name: 'Listings' });
|
||||
|
||||
// Year view
|
||||
cy.findByRole('link', { name: 'Year' }).click();
|
||||
cy.url().should('contain', '/top/year');
|
||||
cy.findByRole('heading', { name: '#tag1' });
|
||||
cy.findByRole('heading', { name: 'Listings' });
|
||||
|
||||
// Infinity view
|
||||
cy.findByRole('link', { name: 'Infinity' }).click();
|
||||
cy.url().should('contain', '/top/infinity');
|
||||
cy.findByRole('heading', { name: '#tag1' });
|
||||
cy.findByRole('heading', { name: 'Listings' });
|
||||
|
||||
// Latest view
|
||||
cy.findByRole('link', { name: 'Latest' }).click();
|
||||
cy.url().should('contain', '/latest');
|
||||
cy.findByRole('heading', { name: '#tag1' });
|
||||
cy.findByRole('heading', { name: 'Listings' });
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -214,4 +214,7 @@ seeder.create_if_none(Tag) do
|
|||
moderator.add_role(:tag_moderator, tag)
|
||||
end
|
||||
|
||||
# Show the tag in the sidebar
|
||||
Settings::General.sidebar_tags = %i[tag1]
|
||||
|
||||
##############################################################################
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue