Allow to specify id for modal

This commit is contained in:
Pig Fang 2019-11-28 16:31:39 +08:00
parent e5b8a130a0
commit a0a950089e
2 changed files with 13 additions and 0 deletions

View File

@ -1,5 +1,6 @@
<template>
<div
:id="id"
class="modal fade"
tabindex="-1"
role="dialog"
@ -72,6 +73,9 @@ export default {
default: 'confirm',
validator: value => ['alert', 'confirm', 'prompt'].includes(value),
},
id: {
type: String,
},
title: {
type: String,
default: trans('general.tip'),

View File

@ -2,6 +2,15 @@ import 'bootstrap'
import { mount } from '@vue/test-utils'
import Modal from '@/components/Modal.vue'
test('id', () => {
const wrapper = mount(Modal, {
propsData: {
id: 'id',
},
})
expect(wrapper.find('#id').exists()).toBeTrue()
})
test('title', () => {
const wrapper = mount(Modal, {
propsData: {