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 #211 from Police-Data-Accessibility-Project/refact…
…or/miscellaneous-updates-to-signin refactor: miscellaneous updates to signin
- Loading branch information
Showing
13 changed files
with
141 additions
and
61 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<template> | ||
<component | ||
:is="component" | ||
v-if="error" | ||
class="pdap-flex-container-center h-[full]" | ||
> | ||
<h1>Oops, something went wrong!</h1> | ||
<p class="max-w-full" data-test="error-boundary-message"> | ||
If you keep seeing this message, please email | ||
<a href="mailto:contact@pdap.io">contact@pdap.io</a> for assistance. | ||
</p> | ||
</component> | ||
<slot v-else /> | ||
</template> | ||
<script> | ||
export default { | ||
props: { | ||
component: { | ||
type: String, | ||
default: 'div', | ||
}, | ||
}, | ||
data() { | ||
return { | ||
error: false, | ||
}; | ||
}, | ||
errorCaptured(error) { | ||
this.interceptError(error); | ||
}, | ||
methods: { | ||
interceptError(error) { | ||
this.error = error; | ||
}, | ||
}, | ||
}; | ||
</script> |
10 changes: 10 additions & 0 deletions
10
client/src/components/__tests__/__snapshots__/errorBoundary.test.js.snap
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,10 @@ | ||
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html | ||
|
||
exports[`ErrorBoundary > renders error content with error 1`] = ` | ||
<div class="pdap-flex-container-center h-[full]"> | ||
<h1>Oops, something went wrong!</h1> | ||
<p class="max-w-full"> If you keep seeing this message, please email <a href="mailto:contact@pdap.io">contact@pdap.io</a> for assistance. </p> | ||
</div> | ||
`; | ||
|
||
exports[`ErrorBoundary > renders slot content with no error 1`] = `<div></div>`; |
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,31 @@ | ||
import { mount } from '@vue/test-utils'; | ||
import { beforeEach, describe, expect, it } from 'vitest'; | ||
import ErrorBoundary from '../ErrorBoundary.vue'; | ||
import { nextTick } from 'vue'; | ||
|
||
let wrapper; | ||
|
||
describe('ErrorBoundary', () => { | ||
beforeEach(() => { | ||
wrapper = mount(ErrorBoundary, { | ||
slots: { | ||
default: '<div data-test="default-slot" />', | ||
}, | ||
}); | ||
}); | ||
|
||
it('renders slot content with no error', () => { | ||
expect(wrapper.find('[data-test="default-slot"]').exists()).toBe(true); | ||
expect(wrapper.html()).toMatchSnapshot(); | ||
}); | ||
|
||
it('renders error content with error', async () => { | ||
wrapper.vm.interceptError(new Error('Generic error')); | ||
await nextTick(); | ||
|
||
expect(wrapper.find('[data-test="error-boundary-message"]').exists()).toBe( | ||
true, | ||
); | ||
expect(wrapper.html()).toMatchSnapshot(); | ||
}); | ||
}); |
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,15 @@ | ||
<template> | ||
<main class="p-4"> | ||
<h1>Something went wrong on our end</h1> | ||
<p> | ||
If you keep seeing this message, please email | ||
<a href="mailto:contact@pdap.io">contact@pdap.io</a> for assistance. | ||
</p> | ||
</main> | ||
</template> | ||
|
||
<script> | ||
export default { | ||
name: 'NotFound', | ||
}; | ||
</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