feat: Add a popout option on webwidget (#1174)
* feat: Add a popout option on webwidget
This commit is contained in:
parent
ce13efd273
commit
45cd949c40
17 changed files with 347 additions and 127 deletions
|
@ -1,4 +1,8 @@
|
|||
import { buildSearchParamsWithLocale } from '../urlParamsHelper';
|
||||
import {
|
||||
buildSearchParamsWithLocale,
|
||||
getLocale,
|
||||
buildPopoutURL,
|
||||
} from '../urlParamsHelper';
|
||||
|
||||
jest.mock('vue', () => ({
|
||||
config: {
|
||||
|
@ -14,3 +18,29 @@ describe('#buildSearchParamsWithLocale', () => {
|
|||
expect(buildSearchParamsWithLocale('')).toEqual('?locale=el');
|
||||
});
|
||||
});
|
||||
|
||||
describe('#getLocale', () => {
|
||||
it('returns correct locale', () => {
|
||||
expect(getLocale('?test=1&cw_conv=2&locale=fr')).toEqual('fr');
|
||||
expect(getLocale('?test=1&locale=fr')).toEqual('fr');
|
||||
expect(getLocale('?test=1&cw_conv=2&website_token=3&locale=fr')).toEqual(
|
||||
'fr'
|
||||
);
|
||||
expect(getLocale('')).toEqual(undefined);
|
||||
});
|
||||
});
|
||||
|
||||
describe('#buildPopoutURL', () => {
|
||||
it('returns popout URL', () => {
|
||||
expect(
|
||||
buildPopoutURL({
|
||||
origin: 'https://chatwoot.com',
|
||||
conversationCookie: 'random-jwt-token',
|
||||
websiteToken: 'random-website-token',
|
||||
locale: 'ar',
|
||||
})
|
||||
).toEqual(
|
||||
'https://chatwoot.com/widget?cw_conversation=random-jwt-token&website_token=random-website-token&locale=ar'
|
||||
);
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue