Chatwoot/app/javascript/portal/specs/portal.spec.js

24 lines
674 B
JavaScript
Raw Normal View History

import { navigateToLocalePage } from '../portalHelpers';
describe('#navigateToLocalePage', () => {
it('returns correct cookie name', () => {
const elemDiv = document.createElement('div');
elemDiv.classList.add('locale-switcher');
document.body.appendChild(elemDiv);
const allLocaleSwitcher = document.querySelector('.locale-switcher');
allLocaleSwitcher.addEventListener = jest
.fn()
.mockImplementationOnce((event, callback) => {
callback({ target: { value: 1 } });
});
navigateToLocalePage();
expect(allLocaleSwitcher.addEventListener).toBeCalledWith(
'change',
expect.any(Function)
);
});
});