mirror of
https://github.com/lingble/chatwoot.git
synced 2025-11-02 12:08:01 +00:00
[Enhancement] Group widget messages by date (#363)
* [Enhancement] Group widget messages by date * Update DateSeparator snapshot
This commit is contained in:
48
app/javascript/shared/components/DateSeparator.vue
Normal file
48
app/javascript/shared/components/DateSeparator.vue
Normal file
@@ -0,0 +1,48 @@
|
||||
<template>
|
||||
<div class="date--separator">
|
||||
{{ date }}
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
props: {
|
||||
date: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
@import '~widget/assets/scss/variables';
|
||||
|
||||
.date--separator {
|
||||
font-size: $font-size-default;
|
||||
color: $color-body;
|
||||
height: 50px;
|
||||
line-height: 50px;
|
||||
position: relative;
|
||||
text-align: center;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.date--separator::before,
|
||||
.date--separator::after {
|
||||
background-color: $color-border;
|
||||
content: '';
|
||||
height: 1px;
|
||||
position: absolute;
|
||||
top: 24px;
|
||||
width: calc((100% - 120px) / 2);
|
||||
}
|
||||
|
||||
.date--separator::before {
|
||||
left: 0;
|
||||
}
|
||||
|
||||
.date--separator::after {
|
||||
right: 0;
|
||||
}
|
||||
</style>
|
||||
14
app/javascript/shared/components/specs/DateSeparator.spec.js
Normal file
14
app/javascript/shared/components/specs/DateSeparator.spec.js
Normal file
@@ -0,0 +1,14 @@
|
||||
import { mount } from '@vue/test-utils';
|
||||
import DateSeparator from '../DateSeparator';
|
||||
|
||||
describe('Spinner', () => {
|
||||
test('matches snapshot', () => {
|
||||
const wrapper = mount(DateSeparator, {
|
||||
propsData: {
|
||||
date: 'Nov 18, 2019',
|
||||
},
|
||||
});
|
||||
expect(wrapper.isVueInstance()).toBeTruthy();
|
||||
expect(wrapper.element).toMatchSnapshot();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,11 @@
|
||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`Spinner matches snapshot 1`] = `
|
||||
<div
|
||||
class="date--separator"
|
||||
>
|
||||
|
||||
Nov 18, 2019
|
||||
|
||||
</div>
|
||||
`;
|
||||
Reference in New Issue
Block a user