-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #228 from OnroerendErfgoed/develop
release 1.4.0
- Loading branch information
Showing
55 changed files
with
769 additions
and
77 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,26 +5,19 @@ repos: | |
- id: check-yaml | ||
- id: end-of-file-fixer | ||
- id: trailing-whitespace | ||
- repo: https://github.com/pre-commit/mirrors-prettier | ||
rev: v3.0.0-alpha.9-for-vscode | ||
- repo: local | ||
hooks: | ||
- id: prettier | ||
additional_dependencies: | ||
- [email protected] | ||
name: run format | ||
language: system | ||
entry: bash -c 'yarn format' | ||
pass_filenames: false | ||
types_or: [ts, javascript, scss, css, yaml, json, vue] | ||
- repo: https://github.com/pre-commit/mirrors-eslint | ||
rev: v8.56.0 | ||
- repo: local | ||
hooks: | ||
- id: eslint | ||
additional_dependencies: | ||
- [email protected] | ||
- [email protected] | ||
- [email protected] | ||
- [email protected] | ||
- [email protected] | ||
- [email protected] | ||
- [email protected] | ||
- '@vue/[email protected]' | ||
- '@vue/[email protected]' | ||
files: \.[jt]sx|\.vue?$ # *.js, *.jsx, *.ts, *.tsx and *.vue | ||
types: [file] | ||
- id: lint | ||
name: run lint | ||
language: system | ||
entry: bash -c 'yarn lint' | ||
pass_filenames: false | ||
types_or: [ts, javascript, scss, css, yaml, json, vue] |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
import axios from 'axios'; | ||
import MockAdapter from 'axios-mock-adapter'; | ||
import { mount } from 'cypress/vue'; | ||
import { defineComponent, useAttrs } from 'vue'; | ||
import OeInventarisLink from '@components/smart/OeInventarisLink.vue'; | ||
import type { IInventarisLinkGebeurtenis, IInventarisLinkWaarneming, ILinks } from '@models/links'; | ||
|
||
const WAARNEMING_API = | ||
'https://dev-inventaris.onroerenderfgoed.be/gebeurtenissen?bron_referentie_uri=https://dev-id.erfgoed.net/dossiers/158226'; | ||
const GEBEURTENIS_API = | ||
'https://dev-inventaris.onroerenderfgoed.be/waarnemingsobjecten?bron_referentie_uri=https://dev-id.erfgoed.net/dossiers/158226'; | ||
|
||
const mock = new MockAdapter(axios); | ||
|
||
const TestComponent = defineComponent({ | ||
components: { OeInventarisLink }, | ||
setup() { | ||
const attrs = useAttrs(); | ||
return { attrs }; | ||
}, | ||
template: '<OeInventarisLink v-bind="attrs"></OeInventarisLink>', | ||
}); | ||
|
||
describe('OeInventarisLink - no data', () => { | ||
const getSsoToken = async () => 1; | ||
it('renders', () => { | ||
mount(TestComponent, { props: { links: undefined, getSsoToken: getSsoToken } }); | ||
}); | ||
|
||
it('shows the links when urls are available', () => { | ||
mock.onGet(WAARNEMING_API).reply(200, [ | ||
{ id: 1, naam: 'Kardinaal Mercierlaan 66, Leuven', uri: 'https://dev-id.erfgoed.net/waarnemingen/1' }, | ||
{ id: 2, naam: 'Kardinaal Mercierlaan 67, Leuven', uri: 'https://dev-id.erfgoed.net/waarnemingen/2' }, | ||
] as IInventarisLinkWaarneming[]); | ||
mock.onGet(GEBEURTENIS_API).reply(200, [ | ||
{ | ||
id: 1, | ||
titel: 'Toevalsvondst Kardinaal Mercierlaan 66, Leuven', | ||
uri: 'https://dev-id.erfgoed.net/gebeurtenissen/1', | ||
}, | ||
{ | ||
id: 2, | ||
titel: 'Toevalsvondst Kardinaal Mercierlaan 67, Leuven', | ||
uri: 'https://dev-id.erfgoed.net/gebeurtenissen/2', | ||
}, | ||
] as IInventarisLinkGebeurtenis[]); | ||
const links = { | ||
relaties: { | ||
waarnemingen: { | ||
href: WAARNEMING_API, | ||
}, | ||
gebeurtenissen: { | ||
href: GEBEURTENIS_API, | ||
}, | ||
}, | ||
} as ILinks; | ||
mount(TestComponent, { props: { links: links, getSsoToken: getSsoToken } }); | ||
|
||
cy.dataCy('gekoppelde-waarnemingen-title').should('have.text', 'Gekoppelde waarnemingen'); | ||
cy.dataCy('gekoppelde-gebeurtenissen-title').should('have.text', 'Gekoppelde gebeurtenissen'); | ||
}); | ||
}); |
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,51 @@ | ||
import { mount } from 'cypress/vue'; | ||
import { defineComponent, useAttrs } from 'vue'; | ||
import OeInventarisLoadedLink from '@components/dumb/OeInventarisLoadedLink.vue'; | ||
|
||
const TestComponent = defineComponent({ | ||
components: { OeInventarisLoadedLink }, | ||
setup() { | ||
const attrs = useAttrs(); | ||
return { attrs }; | ||
}, | ||
template: '<OeInventarisLoadedLink v-bind="attrs"></OeInventarisLoadedLink>', | ||
}); | ||
|
||
describe('OeInventarisLoadedLink - no data', () => { | ||
it('renders', () => { | ||
mount(TestComponent, { props: { gebeurtenissen: undefined, waarnemingen: undefined } }); | ||
}); | ||
|
||
it('shows the correct no data shown text', () => { | ||
mount(TestComponent, { props: { gebeurtenissen: undefined, waarnemingen: undefined } }); | ||
cy.dataCy('geen-gekoppelde-waarnemingen').should('have.text', 'Geen gekoppelde waarnemingen beschikbaar.'); | ||
cy.dataCy('geen-gekoppelde-gebeurtenissen').should('have.text', 'Geen gekoppelde gebeurtenissen beschikbaar.'); | ||
}); | ||
|
||
it('shows the gebeurtenissen and waarnemingen', () => { | ||
const gebeurtenissen = [ | ||
{ | ||
id: 1, | ||
titel: 'Toevalsvondst Kardinaal Mercierlaan 66, Leuven', | ||
uri: 'https://dev-id.erfgoed.net/gebeurtenissen/1', | ||
}, | ||
{ | ||
id: 2, | ||
titel: 'Toevalsvondst Kardinaal Mercierlaan 67, Leuven', | ||
uri: 'https://dev-id.erfgoed.net/gebeurtenissen/2', | ||
}, | ||
]; | ||
const waarnemingen = [ | ||
{ id: 1, naam: 'Kardinaal Mercierlaan 66, Leuven', uri: 'https://dev-id.erfgoed.net/waarnemingen/1' }, | ||
{ id: 2, naam: 'Kardinaal Mercierlaan 67, Leuven', uri: 'https://dev-id.erfgoed.net/waarnemingen/2' }, | ||
]; | ||
mount(TestComponent, { props: { gebeurtenissen: gebeurtenissen, waarnemingen: waarnemingen } }); | ||
|
||
cy.dataCy('gekoppelde-waarnemingen-title').should('have.text', 'Gekoppelde waarnemingen'); | ||
cy.dataCy('gekoppelde-gebeurtenissen-title').should('have.text', 'Gekoppelde gebeurtenissen'); | ||
cy.dataCy('waarneming-link-1').should('have.text', 'Kardinaal Mercierlaan 66, Leuven (1)'); | ||
cy.dataCy('gebeurtenis-link-1').should('have.text', 'Toevalsvondst Kardinaal Mercierlaan 66, Leuven (1)'); | ||
cy.dataCy('waarneming-link-2').should('have.text', 'Kardinaal Mercierlaan 67, Leuven (2)'); | ||
cy.dataCy('gebeurtenis-link-2').should('have.text', 'Toevalsvondst Kardinaal Mercierlaan 67, Leuven (2)'); | ||
}); | ||
}); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
<template> | ||
<div class="vl-u-spacer-bottom"> | ||
<template v-if="props.waarnemingen?.length > 0"> | ||
<h5 class="vl-title vl-title--h5" data-cy="gekoppelde-waarnemingen-title">Gekoppelde waarnemingen</h5> | ||
<a | ||
v-for="waarneming of props.waarnemingen" | ||
:key="waarneming.id" | ||
class="vl-u-display-block" | ||
target="_blank" | ||
:data-cy="'waarneming-link-' + waarneming.id" | ||
:href="waarneming.uri" | ||
>{{ waarneming.naam }} ({{ waarneming.id }})</a | ||
> | ||
</template> | ||
<template v-else> | ||
<span data-cy="geen-gekoppelde-waarnemingen">Geen gekoppelde waarnemingen beschikbaar.</span> | ||
</template> | ||
</div> | ||
<div class="vl-u-spacer-bottom"> | ||
<template v-if="props.gebeurtenissen?.length > 0"> | ||
<h5 class="vl-title vl-title--h5" data-cy="gekoppelde-gebeurtenissen-title">Gekoppelde gebeurtenissen</h5> | ||
<a | ||
v-for="gebeurtenis of props.gebeurtenissen" | ||
:key="gebeurtenis.id" | ||
class="vl-u-display-block" | ||
target="_blank" | ||
:href="gebeurtenis.uri" | ||
:data-cy="'gebeurtenis-link-' + gebeurtenis.id" | ||
>{{ gebeurtenis.titel }} ({{ gebeurtenis.id }})</a | ||
> | ||
</template> | ||
<template v-else> | ||
<span data-cy="geen-gekoppelde-gebeurtenissen">Geen gekoppelde gebeurtenissen beschikbaar.</span> | ||
</template> | ||
</div> | ||
</template> | ||
<script setup lang="ts"> | ||
import type { IInventarisLinkGebeurtenis, IInventarisLinkWaarneming } from '@models/links'; | ||
interface IOeInventarisLoadedLink { | ||
gebeurtenissen: IInventarisLinkGebeurtenis[]; | ||
waarnemingen: IInventarisLinkWaarneming[]; | ||
} | ||
const props = withDefaults(defineProps<IOeInventarisLoadedLink>(), { | ||
waarnemingen: undefined, | ||
gebeurtenissen: undefined, | ||
}); | ||
</script> |
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,36 @@ | ||
<template> | ||
<vl-toaster mod-top-right> | ||
<vl-alert | ||
v-for="toast in store.toasts" | ||
:key="toast.id" | ||
mod-small | ||
:icon="toast.type === 'success' ? 'check' : 'warning'" | ||
:mod-error="toast.type === 'error'" | ||
:mod-success="toast.type === 'success'" | ||
:mod-warning="toast.type === 'warning'" | ||
mod-fade-out | ||
closable | ||
close-text="Toast sluiten" | ||
:title="toast.title" | ||
@close="store.removeToast(toast?.id as string)" | ||
> | ||
<template v-if="typeof toast.content === 'string'"> | ||
{{ toast.content }} | ||
</template> | ||
<template v-else> | ||
<ul> | ||
<li v-for="message in toast.content" :key="message"> | ||
{{ message }} | ||
</li> | ||
</ul> | ||
</template> | ||
</vl-alert> | ||
</vl-toaster> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
import { VlAlert, VlToaster } from '@govflanders/vl-ui-design-system-vue3'; | ||
import { useUtilStore } from '@/composables'; | ||
const store = useUtilStore(); | ||
</script> |
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
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
Oops, something went wrong.