-
- {{ $t('form.close') }}
+
+
+
+
+
+
+
+ {{ $t('form.close') }}
+
@@ -42,9 +50,6 @@ export default {
},
},
methods: {
- getListContributionMessages() {
- this.$emit('get-list-contribution-messages', this.contributionId)
- },
updateState(id) {
this.$emit('update-state', id)
},
@@ -55,4 +60,7 @@ export default {
.temp-message {
margin-top: 50px;
}
+.clearboth {
+ clear: both;
+}
diff --git a/frontend/src/components/ContributionMessages/ContributionMessagesListItem.spec.js b/frontend/src/components/ContributionMessages/ContributionMessagesListItem.spec.js
index 2dc9fb3ce..1a918747f 100644
--- a/frontend/src/components/ContributionMessages/ContributionMessagesListItem.spec.js
+++ b/frontend/src/components/ContributionMessages/ContributionMessagesListItem.spec.js
@@ -5,9 +5,11 @@ import ContributionMessagesListItem from './ContributionMessagesListItem.vue'
const localVue = global.localVue
let wrapper
+const dateMock = jest.fn((d) => d)
+
const mocks = {
$t: jest.fn((t) => t),
- $d: jest.fn((d) => d),
+ $d: dateMock,
$store: {
state: {
firstName: 'Peter',
@@ -239,4 +241,63 @@ and here is the link to the repository: https://github.com/gradido/gradido`)
})
})
})
+
+ describe('contribution message type HISTORY', () => {
+ const propsData = {
+ message: {
+ id: 111,
+ message: `Sun Nov 13 2022 13:05:48 GMT+0100 (Central European Standard Time)
+---
+This message also contains a link: https://gradido.net/de/
+---
+350.00`,
+ createdAt: '2022-08-29T12:23:27.000Z',
+ updatedAt: null,
+ type: 'HISTORY',
+ userFirstName: 'Peter',
+ userLastName: 'Lustig',
+ userId: 107,
+ __typename: 'ContributionMessage',
+ },
+ }
+
+ const itemWrapper = () => {
+ return mount(ContributionMessagesListItem, {
+ localVue,
+ mocks,
+ propsData,
+ })
+ }
+
+ let messageField
+
+ describe('render HISTORY message', () => {
+ beforeEach(() => {
+ jest.clearAllMocks()
+ wrapper = itemWrapper()
+ messageField = wrapper.find('div.is-not-moderator.text-right > div:nth-child(4)')
+ })
+
+ it('renders the date', () => {
+ expect(dateMock).toBeCalledWith(
+ new Date('Sun Nov 13 2022 13:05:48 GMT+0100 (Central European Standard Time'),
+ 'short',
+ )
+ })
+
+ it('renders the amount', () => {
+ expect(messageField.text()).toContain('350.00 GDD')
+ })
+
+ it('contains the link as text', () => {
+ expect(messageField.text()).toContain(
+ 'This message also contains a link: https://gradido.net/de/',
+ )
+ })
+
+ it('contains a link to the given address', () => {
+ expect(messageField.find('a').attributes('href')).toBe('https://gradido.net/de/')
+ })
+ })
+ })
})
diff --git a/frontend/src/components/ContributionMessages/ContributionMessagesListItem.vue b/frontend/src/components/ContributionMessages/ContributionMessagesListItem.vue
index 9c7a3a0f2..5862f97f5 100644
--- a/frontend/src/components/ContributionMessages/ContributionMessagesListItem.vue
+++ b/frontend/src/components/ContributionMessages/ContributionMessagesListItem.vue
@@ -4,25 +4,25 @@