-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add loading indicator and static header to welcome message comp…
…onent Enhances the welcome message component by adding a static header and a loading state indicator for dynamic content.
- Loading branch information
Showing
7 changed files
with
97 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
packages/components/src/stories/chat-search/WelcomeMessage.stories.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import VWelcomeMessage from '@/components/chat/WelcomeMessage.vue'; | ||
|
||
export default { | ||
title: 'Components/WelcomeMessage', | ||
component: VWelcomeMessage, | ||
}; | ||
|
||
const Template = (args) => ({ | ||
components: { VWelcomeMessage }, | ||
setup() { | ||
return { args }; | ||
}, | ||
template: '<v-welcome-message v-bind="args" />', | ||
}); | ||
|
||
export const Default = Template.bind({}); | ||
Default.args = { | ||
dynamicMessage: '', | ||
}; | ||
|
||
export const WithDynamicMessage = Template.bind({}); | ||
WithDynamicMessage.args = { | ||
dynamicMessage: '**Welcome!** This dynamic message is loaded and sanitized.', | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import { mount } from '@vue/test-utils'; | ||
import VWelcomeMessage from '@/components/chat/WelcomeMessage.vue'; | ||
|
||
describe('VWelcomeMessage', () => { | ||
let wrapper; | ||
|
||
beforeEach(() => { | ||
wrapper = mount(VWelcomeMessage, { | ||
props: { | ||
dynamicMessage: '', | ||
}, | ||
}); | ||
}); | ||
|
||
it('renders static message by default', () => { | ||
expect(wrapper.text()).toContain("Hi, I'm Navie"); | ||
// Check that the dynamic placeholder is shown | ||
expect(wrapper.find('.welcome-message-dynamic-placeholder').exists()).toBe(true); | ||
}); | ||
|
||
it('renders dynamic message when provided', async () => { | ||
await wrapper.setProps({ | ||
dynamicMessage: '**Welcome!** This dynamic message is loaded and sanitized.', | ||
}); | ||
|
||
// Verify that the dynamic message is rendered | ||
expect(wrapper.find('.welcome-message-dynamic').html()).toContain( | ||
'<strong>Welcome!</strong> This dynamic message is loaded and sanitized.' | ||
); | ||
|
||
// Check that the placeholder is not visible anymore | ||
expect(wrapper.find('.welcome-message-dynamic-placeholder').exists()).toBe(false); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters