Skip to content
Snippets Groups Projects
Commit a612a59d authored by Mark Harding's avatar Mark Harding
Browse files

Merge branch 'fix/visibility-toggle-sidebar-2372' into 'master'

Fixed failing hashtag visibility toggle. #2372

Closes #2372

See merge request !700
parents 65da1be5 711bed79
No related branches found
No related tags found
1 merge request!700Fixed failing hashtag visibility toggle. #2372
......@@ -116,18 +116,47 @@ context('Discovery', () => {
cy.get("m-topbar--navigation--options ul > m-nsfw-selector ul > li:contains('Other')").click();
});
it('should allow the user to filter by a single hashtag', () => {
it('should allow the user to turn off single hashtag filter and view all posts', () => {
cy.visit('/newsfeed/global/top');
cy.get('m-hashtagssidebarselector__item')
.first()
.click();
});
it('should allow the user to turn off single hashtag filter and view all posts', () => {
it.skip('should allow the user to toggle a single hashtag and then toggle back to the initial feed', () => {
cy.visit('/newsfeed/global/top');
cy.get('m-hashtagssidebarselector__item')
.first()
.find('.m-hashtagsSidebarSelectorList__visibility > i')
.click();
})
// get first label value
cy.get('.m-hashtagsSidebarSelectorList__label').first().invoke('text').then((text) => {
// repeat twice to capture full cycle.
Cypress._.times(2, (i) => {
// split hashtag off of label text
let label = text.split('#')[1];
// click switch
toggleFirstVisibilitySwitch();
// check location name has updated
cy.location('pathname')
.should('eq', `/newsfeed/global/top;period=12h;hashtag=${label}`);
// click switch
toggleFirstVisibilitySwitch();
// check location name has updated
cy.location('pathname')
.should('eq', `/newsfeed/global/top;period=12h`);
});
});
});
// click first visibility switch
const toggleFirstVisibilitySwitch = () => {
cy.get('m-hashtagssidebarselector__item')
.first()
.find('.m-hashtagsSidebarSelectorList__visibility > i')
.click();
}
})
......@@ -122,16 +122,12 @@ export class SidebarSelectorComponent implements OnInit {
}
hashtagVisibilityChange(hashtag) {
if (this.currentHashtag !== hashtag.value) {
this.currentHashtag = hashtag.value;
this.filterChange.emit({
type: 'single',
value: this.currentHashtag,
});
} else {
this.currentHashtag = null;
}
this.currentHashtag =
this.currentHashtag !== hashtag.value ? hashtag.value : null;
this.filterChange.emit({
type: 'single',
value: this.currentHashtag,
});
}
preferredChange() {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment