diff --git a/src/routes/_components/community/PageListItem.html b/src/routes/_components/community/PageListItem.html index a1b800a6..ada58682 100644 --- a/src/routes/_components/community/PageListItem.html +++ b/src/routes/_components/community/PageListItem.html @@ -5,12 +5,16 @@ {label} {#if pinnable} - + + + {/if} @@ -52,6 +56,42 @@ text-overflow: ellipsis; } + /* TODO: begin copypasta from IconButton.html */ + + :global(.pinnable-button) { + background: none; + border: none; + padding: 6px 10px; + } + + :global(.pinnable-button .pinnable-svg) { + fill: var(--action-button-fill-color); + width: 24px; + height: 24px; + } + + :global(.pinnable-button:hover .pinnable-svg) { + fill: var(--action-button-fill-color-hover); + } + + :global(.pinnable-button:active .pinnable-svg) { + fill: var(--action-button-fill-color-active); + } + + :global(.pinnable-button.checked .pinnable-svg) { + fill: var(--action-button-fill-color-pressed); + } + + :global(.pinnable-button.checked:hover .pinnable-svg) { + fill: var(--action-button-fill-color-pressed-hover); + } + + :global(.pinnable-button.checked:active .pinnable-svg) { + fill: var(--action-button-fill-color-pressed-active); + } + + /* TODO: end copypasta */ + @media (max-width: 767px) { .page-list-item a { padding: 20px 10px; @@ -77,8 +117,8 @@ diff --git a/tests/spec/037-pin-timelines.js b/tests/spec/037-pin-timelines.js new file mode 100644 index 00000000..5522b78c --- /dev/null +++ b/tests/spec/037-pin-timelines.js @@ -0,0 +1,38 @@ +import { + communityNavButton, getUrl, goBack, reload +} from '../utils' +import { loginAsFoobar } from '../roles' +import { Selector as $ } from 'testcafe' + +fixture`037-pin-timelines.js` + .page`http://localhost:4002` + +test('Can pin a timeline', async t => { + await loginAsFoobar(t) + + const pinLocal = $('button[aria-label="Pin Local Timeline"]') + const pinFederated = $('button[aria-label="Pin Federated Timeline"]') + const pinnedNav = $('.main-nav-li:nth-child(3)') + const pinnedNavLink = $('.main-nav-li:nth-child(3) a') + + await t + .click(communityNavButton) + .expect(getUrl()).contains('/community') + .expect(pinLocal.getAttribute('aria-checked')).eql('true') + .expect(pinFederated.getAttribute('aria-checked')).eql('false') + .expect(pinnedNavLink.getAttribute('aria-label')).eql('Local') + .click(pinFederated) + .expect(pinLocal.getAttribute('aria-checked')).eql('false') + .expect(pinFederated.getAttribute('aria-checked')).eql('true') + .expect(pinnedNavLink.getAttribute('aria-label')).eql('Federated') + .click(pinnedNav) + .expect(getUrl()).contains('/federated') + await goBack() + await t + .expect(getUrl()).contains('/community') + await reload() + await t + .expect(getUrl()).contains('/community') + .expect(pinLocal.getAttribute('aria-checked')).eql('false') + .expect(pinFederated.getAttribute('aria-checked')).eql('true') +})