-
Notifications
You must be signed in to change notification settings - Fork 49
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
19874 Changed some snackbar messages to dialogs #660
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. See ticket for example. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, this affects every usage of this component, but this is the new UI design. |
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. See ticket for examples. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
<template> | ||
<v-dialog | ||
v-model="dialog" | ||
width="45rem" | ||
persistent | ||
:attach="attach" | ||
content-class="generic-error-dialog" | ||
@keydown.esc="close()" | ||
> | ||
<v-card> | ||
<v-card-title>{{ title }}</v-card-title> | ||
|
||
<v-card-text class="pre-wrap"> | ||
<div | ||
v-show="!!text" | ||
class="font-15" | ||
v-html="text" | ||
/> | ||
|
||
<RegistriesContactInfo class="mt-6" /> | ||
</v-card-text> | ||
|
||
<v-card-actions class="justify-center pt-0 pb-9"> | ||
<v-btn | ||
color="primary" | ||
large | ||
@click="close()" | ||
> | ||
Close | ||
</v-btn> | ||
</v-card-actions> | ||
</v-card> | ||
</v-dialog> | ||
</template> | ||
|
||
<script lang="ts"> | ||
import { Component, Emit, Prop, Vue } from 'vue-property-decorator' | ||
import RegistriesContactInfo from '@/components/common/RegistriesContactInfo.vue' | ||
|
||
@Component({ | ||
components: { | ||
RegistriesContactInfo | ||
} | ||
}) | ||
export default class GenericErrorDialog extends Vue { | ||
@Prop({ default: '' }) readonly attach!: string | ||
@Prop({ default: false }) readonly dialog!: boolean | ||
@Prop({ default: 'Please contact us:' }) readonly text!: string | ||
@Prop({ default: 'An error occurred' }) readonly title!: string | ||
|
||
@Emit() close (): void {} | ||
} | ||
</script> | ||
|
||
<style lang="scss" scoped> | ||
@import '@/assets/styles/theme.scss'; | ||
|
||
.v-card__text { | ||
color: $gray7 !important; | ||
} | ||
</style> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
import { mount } from '@vue/test-utils' | ||
import Vuetify from 'vuetify' | ||
import GenericErrorDialog from '@/dialogs/GenericErrorDialog.vue' | ||
import RegistriesContactInfo from '@/components/common/RegistriesContactInfo.vue' | ||
|
||
const vuetify = new Vuetify({}) | ||
|
||
describe('GenericErrorDialog.vue', () => { | ||
it('does not render the dialog when disabled', () => { | ||
const wrapper = mount(GenericErrorDialog, { | ||
vuetify | ||
}) | ||
|
||
expect(wrapper.find('div[role="dialog"]').exists()).toBe(false) | ||
|
||
wrapper.destroy() | ||
}) | ||
|
||
it('renders the dialog with default text and title', () => { | ||
const wrapper = mount(GenericErrorDialog, { | ||
vuetify, | ||
propsData: { dialog: true } | ||
}) | ||
|
||
expect(wrapper.find('div[role="dialog"]').exists()).toBe(true) | ||
expect(wrapper.find('.v-card__title').text()).toBe('An error occurred') | ||
expect(wrapper.find('.v-card__text > div').text()).toBe('Please contact us:') | ||
expect(wrapper.find('.v-card__text').findComponent(RegistriesContactInfo).exists()).toBe(true) | ||
expect(wrapper.find('.v-card__actions').text()).toBe('Close') | ||
|
||
wrapper.destroy() | ||
}) | ||
|
||
it('renders the dialog with custom text and title', () => { | ||
const wrapper = mount(GenericErrorDialog, { | ||
vuetify, | ||
propsData: { dialog: true, text: 'Custom text', title: 'Custom title' } | ||
}) | ||
|
||
expect(wrapper.find('div[role="dialog"]').exists()).toBe(true) | ||
expect(wrapper.find('.v-card__title').text()).toBe('Custom title') | ||
expect(wrapper.find('.v-card__text > div').text()).toBe('Custom text') | ||
expect(wrapper.find('.v-card__text').findComponent(RegistriesContactInfo).exists()).toBe(true) | ||
expect(wrapper.find('.v-card__actions').text()).toBe('Close') | ||
|
||
wrapper.destroy() | ||
}) | ||
|
||
it('emits close event when the Close button is clicked', async () => { | ||
const wrapper = mount(GenericErrorDialog, { | ||
vuetify, | ||
propsData: { dialog: true } | ||
}) | ||
|
||
expect(wrapper.emitted('close')).toBeUndefined() | ||
await wrapper.find('.v-btn').trigger('click') | ||
expect(wrapper.emitted('close')).toEqual([[]]) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is what gets emitted if you don't emit a value. |
||
|
||
wrapper.destroy() | ||
}) | ||
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I used "null" here, the dialog didn't use its default prop values. This works.