mirror of
				https://github.com/lingble/chatwoot.git
				synced 2025-11-03 20:48:07 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			24 lines
		
	
	
		
			697 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			24 lines
		
	
	
		
			697 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
import { InitializationHelpers } 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 } });
 | 
						|
      });
 | 
						|
 | 
						|
    InitializationHelpers.navigateToLocalePage();
 | 
						|
    expect(allLocaleSwitcher.addEventListener).toBeCalledWith(
 | 
						|
      'change',
 | 
						|
      expect.any(Function)
 | 
						|
    );
 | 
						|
  });
 | 
						|
});
 |