2
0

feat(lib): 💄 Better chat widget icon

This commit is contained in:
Baptiste Arnaud
2022-04-30 06:48:26 -07:00
parent e339cc1672
commit a2cfecc16c
8 changed files with 29 additions and 25 deletions

View File

@ -23,9 +23,7 @@ describe('initBubble', () => {
Typebot.initBubble({ url: 'https://typebot.io/typebot-id2' })
const frames = document.getElementsByTagName('iframe')
expect(frames).toHaveLength(1)
expect(frames[0].dataset.src).toBe(
'https://typebot.io/typebot-id2?hn=localhost'
)
expect(frames[0].dataset.src).toBe('https://typebot.io/typebot-id2')
})
it('show open after the corresponding delay', async () => {
@ -36,7 +34,7 @@ describe('initBubble', () => {
})
const bubble = document.querySelector('#typebot-bubble') as HTMLDivElement
expect(bubble.classList.contains('iframe-opened')).toBe(false)
await new Promise((r) => setTimeout(r, 1050))
await new Promise((r) => setTimeout(r, 1100))
expect(bubble.classList.contains('iframe-opened')).toBe(true)
const rememberCloseDecisionFromStorage = localStorage.getItem(
Typebot.localStorageKeys.rememberClose

View File

@ -11,7 +11,7 @@ describe('createIframe', () => {
'https://typebot.io/typebot-id'
)
expect(iframeElement.getAttribute('src')).toBe(
'https://typebot.io/typebot-id?hn=localhost'
'https://typebot.io/typebot-id'
)
})
@ -24,7 +24,7 @@ describe('createIframe', () => {
}),
]
expect(iframes[0].getAttribute('src')).toBe(
'https://typebot.io/typebot-id?hn=localhost&var1=value1&var2=value2'
'https://typebot.io/typebot-id?var1=value1&var2=value2'
)
})
@ -44,7 +44,7 @@ describe('createIframe', () => {
loadWhenVisible: true,
})
expect(iframeElement.getAttribute('data-src')).toBe(
'https://typebot.io/typebot-id?hn=localhost'
'https://typebot.io/typebot-id'
)
expect(iframeElement.getAttribute('src')).toBeFalsy()
})

View File

@ -23,9 +23,7 @@ describe('initPopup', () => {
initPopup({ url: 'https://typebot.io/typebot-id2' })
const elements = document.getElementsByTagName('iframe')
expect(elements).toHaveLength(1)
expect(elements[0].dataset.src).toBe(
'https://typebot.io/typebot-id2?hn=localhost'
)
expect(elements[0].dataset.src).toBe('https://typebot.io/typebot-id2')
})
it("shouldn't have opened classname if no delay", () => {