BigW Consortium Gitlab

Commit abfb5910 by winh

Add failing test for #34141

parent ad3843ae
......@@ -66,4 +66,38 @@ describe('Dropdown User', () => {
window.gon = {};
});
});
describe('hideCurrentUser', () => {
const fixtureTemplate = 'issues/issue_list.html.raw';
preloadFixtures(fixtureTemplate);
let dropdown;
let authorFilterDropdownElement;
beforeEach(() => {
loadFixtures(fixtureTemplate);
authorFilterDropdownElement = document.querySelector('#js-dropdown-author');
const dummyInput = document.createElement('div');
dropdown = new gl.DropdownUser(null, authorFilterDropdownElement, dummyInput);
});
const findCurrentUserElement = () => authorFilterDropdownElement.querySelector('.js-current-user');
it('hides the current user from dropdown', () => {
const currentUserElement = findCurrentUserElement();
expect(currentUserElement).not.toBe(null);
dropdown.hideCurrentUser();
expect(currentUserElement.classList).toContain('hidden');
});
it('does nothing if no user is logged in', () => {
const currentUserElement = findCurrentUserElement();
currentUserElement.parentNode.removeChild(currentUserElement);
expect(findCurrentUserElement()).toBe(null);
dropdown.hideCurrentUser();
});
});
});
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment