mirror of
				https://github.com/lingble/chatwoot.git
				synced 2025-11-04 04:57:51 +00:00 
			
		
		
		
	feat: Add a popout option on webwidget (#1174)
* feat: Add a popout option on webwidget
This commit is contained in:
		
							
								
								
									
										42
									
								
								app/javascript/widget/helpers/specs/utils.spec.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										42
									
								
								app/javascript/widget/helpers/specs/utils.spec.js
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,42 @@
 | 
			
		||||
import { IFrameHelper } from '../utils';
 | 
			
		||||
 | 
			
		||||
jest.mock('vue', () => ({
 | 
			
		||||
  config: {
 | 
			
		||||
    lang: 'el',
 | 
			
		||||
  },
 | 
			
		||||
}));
 | 
			
		||||
 | 
			
		||||
describe('#IFrameHelper', () => {
 | 
			
		||||
  describe('#isAValidEvent', () => {
 | 
			
		||||
    it('returns if the event is valid', () => {
 | 
			
		||||
      expect(
 | 
			
		||||
        IFrameHelper.isAValidEvent({
 | 
			
		||||
          data:
 | 
			
		||||
            'chatwoot-widget:{"event":"config-set","locale":"fr","position":"left","hideMessageBubble":false,"showPopoutButton":true}',
 | 
			
		||||
        })
 | 
			
		||||
      ).toEqual(true);
 | 
			
		||||
      expect(
 | 
			
		||||
        IFrameHelper.isAValidEvent({
 | 
			
		||||
          data:
 | 
			
		||||
            '{"event":"config-set","locale":"fr","position":"left","hideMessageBubble":false,"showPopoutButton":true}',
 | 
			
		||||
        })
 | 
			
		||||
      ).toEqual(false);
 | 
			
		||||
    });
 | 
			
		||||
  });
 | 
			
		||||
  describe('#getMessage', () => {
 | 
			
		||||
    it('returns parsed message', () => {
 | 
			
		||||
      expect(
 | 
			
		||||
        IFrameHelper.getMessage({
 | 
			
		||||
          data:
 | 
			
		||||
            'chatwoot-widget:{"event":"config-set","locale":"fr","position":"left","hideMessageBubble":false,"showPopoutButton":true}',
 | 
			
		||||
        })
 | 
			
		||||
      ).toEqual({
 | 
			
		||||
        event: 'config-set',
 | 
			
		||||
        locale: 'fr',
 | 
			
		||||
        position: 'left',
 | 
			
		||||
        hideMessageBubble: false,
 | 
			
		||||
        showPopoutButton: true,
 | 
			
		||||
      });
 | 
			
		||||
    });
 | 
			
		||||
  });
 | 
			
		||||
});
 | 
			
		||||
		Reference in New Issue
	
	Block a user