From c5f8534bd896781f64beb6d558b8d7ffd25fd91a Mon Sep 17 00:00:00 2001 From: ogerly Date: Mon, 30 May 2022 15:37:22 +0200 Subject: [PATCH 01/51] add list, json, show, edit, delete and add form --- admin/src/ContributionLinks.json | 8 +++ admin/src/pages/Overview.vue | 107 +++++++++++++++++++++++++++++++ 2 files changed, 115 insertions(+) create mode 100644 admin/src/ContributionLinks.json diff --git a/admin/src/ContributionLinks.json b/admin/src/ContributionLinks.json new file mode 100644 index 000000000..55cac89bf --- /dev/null +++ b/admin/src/ContributionLinks.json @@ -0,0 +1,8 @@ +{ + "fields": ["Name", "Text", "GDD", "startDate", "endDate", "delete", "edit", "show"], + "ContributionLinks":[ + {"Name":"John1", "Text":"Doe1 ", "GDD":"200", "startDate":"", "endDate":""}, + {"Name":"John2", "Text":"Doe2", "GDD":"300", "startDate":"", "endDate":""}, + {"Name":"John3", "Text":"Doe3", "GDD":"400", "startDate":"", "endDate":""} + ] +} \ No newline at end of file diff --git a/admin/src/pages/Overview.vue b/admin/src/pages/Overview.vue index ed7ac8ad7..590089e54 100644 --- a/admin/src/pages/Overview.vue +++ b/admin/src/pages/Overview.vue @@ -28,14 +28,121 @@ +
{{ ContributionLinks }}
+ + + + New Contribution + + + +

New Contribution

+ + + + + + + + + + + + +
+ + + + + + +
+
+ Anlegen + Reset +
+
+
+
+ + + + + + + + +
diff --git a/admin/src/components/AutomaticCreationForm.vue b/admin/src/components/AutomaticCreationForm.vue new file mode 100644 index 000000000..543995ea9 --- /dev/null +++ b/admin/src/components/AutomaticCreationForm.vue @@ -0,0 +1,70 @@ + + diff --git a/admin/src/components/AutomaticCreationList.vue b/admin/src/components/AutomaticCreationList.vue new file mode 100644 index 000000000..7094f1b68 --- /dev/null +++ b/admin/src/components/AutomaticCreationList.vue @@ -0,0 +1,34 @@ + + diff --git a/admin/src/components/ContributionsForm.vue b/admin/src/components/ContributionsForm.vue new file mode 100644 index 000000000..ec59f8a78 --- /dev/null +++ b/admin/src/components/ContributionsForm.vue @@ -0,0 +1,53 @@ + + diff --git a/admin/src/pages/Overview.vue b/admin/src/pages/Overview.vue index 590089e54..edfd12686 100644 --- a/admin/src/pages/Overview.vue +++ b/admin/src/pages/Overview.vue @@ -28,121 +28,28 @@ -
{{ ContributionLinks }}
- - - + New Contribution - - - -

New Contribution

- - - - - - - - - - - - -
- - - - - - -
-
- Anlegen - Reset -
-
-
-
- - - - - - - - -
+ From edcdaa9bd49c34892383510096935842127517b5 Mon Sep 17 00:00:00 2001 From: ogerly Date: Tue, 31 May 2022 09:38:33 +0200 Subject: [PATCH 04/51] formular structur, add props and apollo methods example --- admin/src/components/AutomaticCreation.vue | 18 ++- .../src/components/AutomaticCreationForm.vue | 117 +++++++++++++++--- admin/src/pages/Overview.vue | 23 +++- 3 files changed, 127 insertions(+), 31 deletions(-) diff --git a/admin/src/components/AutomaticCreation.vue b/admin/src/components/AutomaticCreation.vue index 0d087c233..77af1aeb8 100644 --- a/admin/src/components/AutomaticCreation.vue +++ b/admin/src/components/AutomaticCreation.vue @@ -1,24 +1,27 @@ @@ -24,11 +24,11 @@
xxx
- daten + qrCode + link {{ modalData }} + @@ -36,9 +36,13 @@ diff --git a/admin/src/components/AutomaticCreation.vue b/admin/src/components/ContributionLink.vue similarity index 59% rename from admin/src/components/AutomaticCreation.vue rename to admin/src/components/ContributionLink.vue index 04ec752c6..935f7d44c 100644 --- a/admin/src/components/AutomaticCreation.vue +++ b/admin/src/components/ContributionLink.vue @@ -2,28 +2,28 @@
- + New Automatic Creations + + New Contribution Link -

Automatic Creations

- +

Contribution Links

+
-
Es sind keine automatischen Schöpfungen angelegt.
@@ -31,14 +31,14 @@
diff --git a/admin/src/components/AutomaticCreationList.vue b/admin/src/components/ContributionLinkList.vue similarity index 80% rename from admin/src/components/AutomaticCreationList.vue rename to admin/src/components/ContributionLinkList.vue index 1d83beb17..200968e4e 100644 --- a/admin/src/components/AutomaticCreationList.vue +++ b/admin/src/components/ContributionLinkList.vue @@ -2,22 +2,17 @@
@@ -40,11 +35,11 @@
From 98bb217f6e3147f3cc01b8676086c42a5f7a7ef6 Mon Sep 17 00:00:00 2001 From: ogerly Date: Tue, 7 Jun 2022 11:31:55 +0200 Subject: [PATCH 16/51] fixed lint and locales --- admin/.eslintrc.js | 2 +- admin/src/components/ContributionLinkForm.vue | 14 ++++---- admin/src/locales/de.json | 33 +++++++++---------- admin/src/locales/en.json | 28 ++++++++-------- 4 files changed, 38 insertions(+), 39 deletions(-) diff --git a/admin/.eslintrc.js b/admin/.eslintrc.js index 73dce291f..33ab3c0c5 100644 --- a/admin/.eslintrc.js +++ b/admin/.eslintrc.js @@ -39,7 +39,7 @@ module.exports = { { src: './src', extensions: ['.js', '.vue'], - ignores: [], + ignores: ['contributionLink.options.repetition.null'], enableFix: false, }, ], diff --git a/admin/src/components/ContributionLinkForm.vue b/admin/src/components/ContributionLinkForm.vue index a388ab0d7..6e958f125 100644 --- a/admin/src/components/ContributionLinkForm.vue +++ b/admin/src/components/ContributionLinkForm.vue @@ -7,7 +7,7 @@ - + - + - + - + - +
{{ $t('contributionLink.create') }} - {{ $t('contributionLink.clear') }} + + {{ $t('contributionLink.clear') }} +
diff --git a/admin/src/locales/de.json b/admin/src/locales/de.json index 4e871f4a4..d56c9ee3d 100644 --- a/admin/src/locales/de.json +++ b/admin/src/locales/de.json @@ -1,17 +1,17 @@ { "all_emails": "Alle Nutzer", "contributionLink": { - "repetition":"Wiederholung", - "cycle":"Zyclus", - "maximumAmount":"maximaler Betrag", - "create":"Anlegen", - "clear":"Löschen", - "startDate":"Start-Datum", - "endDate":"End-Datum", - "name":"Name", - "memo":"Nachricht", + "repetition": "Wiederholung", + "cycle": "Zyclus", + "maximumAmount": "maximaler Betrag", + "create": "Anlegen", + "clear": "Löschen", + "startDate": "Start-Datum", + "endDate": "End-Datum", + "name": "Name", + "memo": "Nachricht", "amount": "Betrag", - "options" :{ + "options": { "cycle": { "null": "Bitter wähle einen Zyclus", "none": "kein Zyclus", @@ -23,11 +23,10 @@ }, "repetition": { "null": "Bitte wähle eine Wiederholung" - }, - "noStartDate":"Kein Start-Datum gewählt.", - "noEndDate":"Kein End-Datum gewählt." - - } + } + }, + "noStartDate": "Kein Start-Datum gewählt.", + "noEndDate": "Kein End-Datum gewählt." }, "back": "zurück", "creation": "Schöpfung", @@ -103,9 +102,7 @@ "removeNotSelf": "Als Admin / Moderator kannst du dich nicht selber löschen.", "remove_all": "alle Nutzer entfernen", "save": "Speichern", - "selectOptions": { - - }, + "selectOptions": {}, "status": "Status", "success": "Erfolg", "text": "Text", diff --git a/admin/src/locales/en.json b/admin/src/locales/en.json index db86e277d..81ac6a99c 100644 --- a/admin/src/locales/en.json +++ b/admin/src/locales/en.json @@ -1,17 +1,17 @@ { "all_emails": "All users", "contributionLink": { - "repetition":"Repetition", - "cycle":"Cycle", - "maximumAmount":"Maximum amount", - "create":"Create", - "clear":"Clear", - "startDate":"Start-Date", - "endDate":"End-Date", - "name":"Name", - "memo":"Memo", + "repetition": "Repetition", + "cycle": "Cycle", + "maximumAmount": "Maximum amount", + "create": "Create", + "clear": "Clear", + "startDate": "Start-Date", + "endDate": "End-Date", + "name": "Name", + "memo": "Memo", "amount": "Amount", - "options" :{ + "options": { "cycle": { "null": "Please select an cycle", "none": "no cycle", @@ -23,10 +23,10 @@ }, "repetition": { "null": "Please select an repetition" - }, - "noStartDate":"No start Date", - "noEndDate":"No end Date" - } + } + }, + "noStartDate": "No start Date", + "noEndDate": "No end Date" }, "back": "back", "creation": "Creation", From 6a5c72a48db080347c984ebb46f5076189395ce4 Mon Sep 17 00:00:00 2001 From: ogerly Date: Wed, 8 Jun 2022 06:25:30 +0200 Subject: [PATCH 17/51] fixed locales --- admin/src/locales/de.json | 32 ++++++++++++++++---------------- admin/src/locales/en.json | 32 ++++++++++++++++---------------- 2 files changed, 32 insertions(+), 32 deletions(-) diff --git a/admin/src/locales/de.json b/admin/src/locales/de.json index d56c9ee3d..16f38ce60 100644 --- a/admin/src/locales/de.json +++ b/admin/src/locales/de.json @@ -1,34 +1,34 @@ { "all_emails": "Alle Nutzer", + "back": "zurück", "contributionLink": { - "repetition": "Wiederholung", - "cycle": "Zyclus", - "maximumAmount": "maximaler Betrag", - "create": "Anlegen", - "clear": "Löschen", - "startDate": "Start-Datum", - "endDate": "End-Datum", - "name": "Name", - "memo": "Nachricht", "amount": "Betrag", + "clear": "Löschen", + "create": "Anlegen", + "cycle": "Zyclus", + "endDate": "End-Datum", + "maximumAmount": "maximaler Betrag", + "memo": "Nachricht", + "name": "Name", + "noEndDate": "Kein End-Datum gewählt.", + "noStartDate": "Kein Start-Datum gewählt.", "options": { "cycle": { - "null": "Bitter wähle einen Zyclus", - "none": "kein Zyclus", - "hourly": "stündlich", "daily": "täglich", - "weekly": "wöchentlich", + "hourly": "stündlich", "monthly": "monatlich", + "none": "kein Zyclus", + "null": "Bitter wähle einen Zyclus", + "weekly": "wöchentlich", "yearly": "jährlich" }, "repetition": { "null": "Bitte wähle eine Wiederholung" } }, - "noStartDate": "Kein Start-Datum gewählt.", - "noEndDate": "Kein End-Datum gewählt." + "repetition": "Wiederholung", + "startDate": "Start-Datum" }, - "back": "zurück", "creation": "Schöpfung", "creationList": "Schöpfungsliste", "creation_form": { diff --git a/admin/src/locales/en.json b/admin/src/locales/en.json index 81ac6a99c..836f18d02 100644 --- a/admin/src/locales/en.json +++ b/admin/src/locales/en.json @@ -1,34 +1,34 @@ { "all_emails": "All users", + "back": "back", "contributionLink": { - "repetition": "Repetition", - "cycle": "Cycle", - "maximumAmount": "Maximum amount", - "create": "Create", - "clear": "Clear", - "startDate": "Start-Date", - "endDate": "End-Date", - "name": "Name", - "memo": "Memo", "amount": "Amount", + "clear": "Clear", + "create": "Create", + "cycle": "Cycle", + "endDate": "End-Date", + "maximumAmount": "Maximum amount", + "memo": "Memo", + "name": "Name", + "noEndDate": "No end Date", + "noStartDate": "No start Date", "options": { "cycle": { - "null": "Please select an cycle", - "none": "no cycle", - "hourly": "hourly", "daily": "daily", - "weekly": "weekly", + "hourly": "hourly", "monthly": "monthly", + "none": "no cycle", + "null": "Please select an cycle", + "weekly": "weekly", "yearly": "yearly" }, "repetition": { "null": "Please select an repetition" } }, - "noStartDate": "No start Date", - "noEndDate": "No end Date" + "repetition": "Repetition", + "startDate": "Start-Date" }, - "back": "back", "creation": "Creation", "creationList": "Creation list", "creation_form": { From ad61069feea273b16f6ce44a7595d6bf5f90e105 Mon Sep 17 00:00:00 2001 From: ogerly Date: Wed, 8 Jun 2022 06:39:20 +0200 Subject: [PATCH 18/51] fixed locales, stylelint, lint --- admin/src/components/ContributionLink.vue | 8 ++++---- admin/src/components/ContributionLinkList.vue | 2 +- admin/src/locales/de.json | 6 +++++- admin/src/locales/en.json | 6 +++++- 4 files changed, 15 insertions(+), 7 deletions(-) diff --git a/admin/src/components/ContributionLink.vue b/admin/src/components/ContributionLink.vue index 935f7d44c..cdba4ec02 100644 --- a/admin/src/components/ContributionLink.vue +++ b/admin/src/components/ContributionLink.vue @@ -2,19 +2,19 @@
- + New Contribution Link + {{ $t('math.plus') }} {{ $t('contributionLink.newContributionLink') }} -

Contribution Links

+

{{ $t('contributionLink.contributionLinks') }}

@@ -25,7 +25,7 @@ :items="items" @editContributionLinkData="editContributionLinkData" /> -
Es sind keine automatischen Schöpfungen angelegt.
+
{{ $t('contributionLink.noContributionLinks') }}
diff --git a/admin/src/components/ContributionLinkList.vue b/admin/src/components/ContributionLinkList.vue index 200968e4e..027245ac3 100644 --- a/admin/src/components/ContributionLinkList.vue +++ b/admin/src/components/ContributionLinkList.vue @@ -21,7 +21,7 @@ {{ modalData }} diff --git a/admin/src/locales/de.json b/admin/src/locales/de.json index 16f38ce60..90f1654e9 100644 --- a/admin/src/locales/de.json +++ b/admin/src/locales/de.json @@ -4,12 +4,15 @@ "contributionLink": { "amount": "Betrag", "clear": "Löschen", + "contributionLinks": "Contribution Links", "create": "Anlegen", "cycle": "Zyclus", "endDate": "End-Datum", "maximumAmount": "maximaler Betrag", "memo": "Nachricht", "name": "Name", + "newContributionLink": "Neuer Contribution Link", + "noContributionLinks": "Es sind keine Contribution Links angelegt.", "noEndDate": "Kein End-Datum gewählt.", "noStartDate": "Kein Start-Datum gewählt.", "options": { @@ -72,7 +75,8 @@ "lastname": "Nachname", "math": { "exclaim": "!", - "pipe": "|" + "pipe": "|", + "plus": "+" }, "moderator": "Moderator", "multiple_creation_text": "Bitte wähle ein oder mehrere Mitglieder aus für die du Schöpfen möchtest.", diff --git a/admin/src/locales/en.json b/admin/src/locales/en.json index 836f18d02..67929afaa 100644 --- a/admin/src/locales/en.json +++ b/admin/src/locales/en.json @@ -4,12 +4,15 @@ "contributionLink": { "amount": "Amount", "clear": "Clear", + "contributionLinks": "Contribution Links", "create": "Create", "cycle": "Cycle", "endDate": "End-Date", "maximumAmount": "Maximum amount", "memo": "Memo", "name": "Name", + "newContributionLink": "New Contribution Link", + "noContributionLinks": "No contribution links have been created.", "noEndDate": "No end Date", "noStartDate": "No start Date", "options": { @@ -72,7 +75,8 @@ "lastname": "Lastname", "math": { "exclaim": "!", - "pipe": "|" + "pipe": "|", + "plus": "+" }, "moderator": "Moderator", "multiple_creation_text": "Please select one or more members for which you would like to perform creations.", From 737d2397feefcc7a50a5ec37dc554400f8065622 Mon Sep 17 00:00:00 2001 From: ogerly Date: Wed, 8 Jun 2022 06:53:08 +0200 Subject: [PATCH 19/51] add FigureQrCode.spec.js --- admin/src/components/FigureQrCode.spec.js | 30 +++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 admin/src/components/FigureQrCode.spec.js diff --git a/admin/src/components/FigureQrCode.spec.js b/admin/src/components/FigureQrCode.spec.js new file mode 100644 index 000000000..715a5d5d5 --- /dev/null +++ b/admin/src/components/FigureQrCode.spec.js @@ -0,0 +1,30 @@ +import { mount } from '@vue/test-utils' +import FigureQrCode from './FigureQrCode' + +const localVue = global.localVue + +const propsData = { + link: '', +} + +describe('FigureQrCode', () => { + let wrapper + + const Wrapper = () => { + return mount(FigureQrCode, { localVue, propsData }) + } + + describe('mount', () => { + beforeEach(() => { + wrapper = Wrapper() + }) + + it('renders the Div Element ".figure-qr-code"', () => { + expect(wrapper.find('div.figure-qr-code').exists()).toBeTruthy() + }) + + it('renders the Div Element "q-r-canvas"', () => { + expect(wrapper.find('q-r-canvas')) + }) + }) +}) From bbd0fd64789bee7ed2909fb14723eb8832b630ad Mon Sep 17 00:00:00 2001 From: ogerly Date: Wed, 8 Jun 2022 07:53:43 +0200 Subject: [PATCH 20/51] test for FigureQrCode --- admin/jest.config.js | 2 +- admin/package.json | 1 + admin/src/components/FigureQrCode.spec.js | 2 +- admin/yarn.lock | 22 +++++++++++++++++++++- 4 files changed, 24 insertions(+), 3 deletions(-) diff --git a/admin/jest.config.js b/admin/jest.config.js index b7226bd8f..9b9842bad 100644 --- a/admin/jest.config.js +++ b/admin/jest.config.js @@ -22,7 +22,7 @@ module.exports = { '^.+\\.(js|jsx)?$': 'babel-jest', '/node_modules/vee-validate/dist/rules': 'babel-jest', }, - setupFiles: ['/test/testSetup.js'], + setupFiles: ['/test/testSetup.js', 'jest-canvas-mock'], testMatch: ['**/?(*.)+(spec|test).js?(x)'], // snapshotSerializers: ['jest-serializer-vue'], transformIgnorePatterns: ['/node_modules/(?!vee-validate/dist/rules)'], diff --git a/admin/package.json b/admin/package.json index 4c896e6a9..cbbce5a2a 100644 --- a/admin/package.json +++ b/admin/package.json @@ -38,6 +38,7 @@ "graphql": "^15.6.1", "identity-obj-proxy": "^3.0.0", "jest": "26.6.3", + "jest-canvas-mock": "^2.3.1", "portal-vue": "^2.1.7", "qrcanvas-vue": "2.1.1", "regenerator-runtime": "^0.13.9", diff --git a/admin/src/components/FigureQrCode.spec.js b/admin/src/components/FigureQrCode.spec.js index 715a5d5d5..40320aad5 100644 --- a/admin/src/components/FigureQrCode.spec.js +++ b/admin/src/components/FigureQrCode.spec.js @@ -1,5 +1,5 @@ import { mount } from '@vue/test-utils' -import FigureQrCode from './FigureQrCode' +import FigureQrCode from './FigureQrCode.vue' const localVue = global.localVue diff --git a/admin/yarn.lock b/admin/yarn.lock index 232fd06bd..28f577a12 100644 --- a/admin/yarn.lock +++ b/admin/yarn.lock @@ -4404,7 +4404,7 @@ color-name@1.1.3: resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.3.tgz#a7d0558bd89c42f795dd42328f740831ca53bc25" integrity sha1-p9BVi9icQveV3UIyj3QIMcpTvCU= -color-name@^1.0.0, color-name@~1.1.4: +color-name@^1.0.0, color-name@^1.1.4, color-name@~1.1.4: version "1.1.4" resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.4.tgz#c2a09a87acbde69543de6f63fa3995c826c536a2" integrity sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA== @@ -4852,6 +4852,11 @@ cssesc@^3.0.0: resolved "https://registry.yarnpkg.com/cssesc/-/cssesc-3.0.0.tgz#37741919903b868565e1c09ea747445cd18983ee" integrity sha512-/Tb/JcjK111nNScGob5MNtsntNM1aCNUDipB/TkwZFhyDrrE47SOx/18wF2bbjgc3ZzCSKW1T5nt5EbFoAz/Vg== +cssfontparser@^1.2.1: + version "1.2.1" + resolved "https://registry.yarnpkg.com/cssfontparser/-/cssfontparser-1.2.1.tgz#f4022fc8f9700c68029d542084afbaf425a3f3e3" + integrity sha512-6tun4LoZnj7VN6YeegOVb67KBX/7JJsqvj+pv3ZA7F878/eN33AbGa5b/S/wXxS/tcp8nc40xRUrsPlxIyNUPg== + cssnano-preset-default@^4.0.0, cssnano-preset-default@^4.0.8: version "4.0.8" resolved "https://registry.yarnpkg.com/cssnano-preset-default/-/cssnano-preset-default-4.0.8.tgz#920622b1fc1e95a34e8838203f1397a504f2d3ff" @@ -7828,6 +7833,14 @@ javascript-stringify@^2.0.1: resolved "https://registry.yarnpkg.com/javascript-stringify/-/javascript-stringify-2.1.0.tgz#27c76539be14d8bd128219a2d731b09337904e79" integrity sha512-JVAfqNPTvNq3sB/VHQJAFxN/sPgKnsKrCwyRt15zwNCdrMMJDdcEOdubuy+DuJYYdm0ox1J4uzEuYKkN+9yhVg== +jest-canvas-mock@^2.3.1: + version "2.4.0" + resolved "https://registry.yarnpkg.com/jest-canvas-mock/-/jest-canvas-mock-2.4.0.tgz#947b71442d7719f8e055decaecdb334809465341" + integrity sha512-mmMpZzpmLzn5vepIaHk5HoH3Ka4WykbSoLuG/EKoJd0x0ID/t+INo1l8ByfcUJuDM+RIsL4QDg/gDnBbrj2/IQ== + dependencies: + cssfontparser "^1.2.1" + moo-color "^1.0.2" + jest-changed-files@^24.9.0: version "24.9.0" resolved "https://registry.yarnpkg.com/jest-changed-files/-/jest-changed-files-24.9.0.tgz#08d8c15eb79a7fa3fc98269bc14b451ee82f8039" @@ -9485,6 +9498,13 @@ mkdirp@0.x, mkdirp@^0.5.1, mkdirp@^0.5.3, mkdirp@^0.5.5, mkdirp@~0.5.1: dependencies: minimist "^1.2.5" +moo-color@^1.0.2: + version "1.0.3" + resolved "https://registry.yarnpkg.com/moo-color/-/moo-color-1.0.3.tgz#d56435f8359c8284d83ac58016df7427febece74" + integrity sha512-i/+ZKXMDf6aqYtBhuOcej71YSlbjT3wCO/4H1j8rPvxDJEifdwgg5MaFyu6iYAT8GBZJg2z0dkgK4YMzvURALQ== + dependencies: + color-name "^1.1.4" + move-concurrently@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/move-concurrently/-/move-concurrently-1.0.1.tgz#be2c005fda32e0b29af1f05d7c4b33214c701f92" From 6a91de68084f11424a5e8c5e83476001f306a29f Mon Sep 17 00:00:00 2001 From: ogerly Date: Wed, 8 Jun 2022 08:33:07 +0200 Subject: [PATCH 21/51] test for ContributionLink --- admin/src/components/ContributionLink.spec.js | 32 +++++++++++++++++++ admin/src/components/ContributionLink.vue | 2 +- admin/src/components/ContributionLinkForm.vue | 2 +- 3 files changed, 34 insertions(+), 2 deletions(-) create mode 100644 admin/src/components/ContributionLink.spec.js diff --git a/admin/src/components/ContributionLink.spec.js b/admin/src/components/ContributionLink.spec.js new file mode 100644 index 000000000..ae5ea4f58 --- /dev/null +++ b/admin/src/components/ContributionLink.spec.js @@ -0,0 +1,32 @@ +import { mount } from '@vue/test-utils' +import ContributionLink from './ContributionLink.vue' + +const localVue = global.localVue + +const mocks = { + $t: jest.fn((t) => t), +} + +describe('ContributionLink', () => { + let wrapper + + const Wrapper = () => { + return mount(ContributionLink, { localVue, mocks }) + } + + describe('mount', () => { + beforeEach(() => { + wrapper = Wrapper() + }) + + it('renders the Div Element ".contribution-link"', () => { + expect(wrapper.find('div.contribution-link').exists()).toBeTruthy() + }) + + it('emits toggle::collapse new Contribution', async () => { + wrapper.vm.editContributionLinkData() + // expect(wrapper.emitted('bv::toggle::collapse', 'newContribution')).toBeTruthy() + expect(wrapper.vm.$root.$emit('bv::toggle::collapse', 'newContribution')).toBeTruthy() + }) + }) +}) diff --git a/admin/src/components/ContributionLink.vue b/admin/src/components/ContributionLink.vue index cdba4ec02..02b525b44 100644 --- a/admin/src/components/ContributionLink.vue +++ b/admin/src/components/ContributionLink.vue @@ -1,5 +1,5 @@