mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
remove all validation rule extends that are not needed
This commit is contained in:
parent
2d3d2579b5
commit
ce68dc8528
@ -1,24 +1,7 @@
|
|||||||
import { mount } from '@vue/test-utils'
|
import { mount } from '@vue/test-utils'
|
||||||
import { extend } from 'vee-validate'
|
|
||||||
|
|
||||||
import InputPasswordConfirmation from './InputPasswordConfirmation'
|
import InputPasswordConfirmation from './InputPasswordConfirmation'
|
||||||
|
|
||||||
const rules = [
|
|
||||||
'containsLowercaseCharacter',
|
|
||||||
'containsUppercaseCharacter',
|
|
||||||
'containsNumericCharacter',
|
|
||||||
'atLeastEightCharactera',
|
|
||||||
'samePassword',
|
|
||||||
]
|
|
||||||
|
|
||||||
rules.forEach((rule) => {
|
|
||||||
extend(rule, {
|
|
||||||
validate(value) {
|
|
||||||
return true
|
|
||||||
},
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
const localVue = global.localVue
|
const localVue = global.localVue
|
||||||
|
|
||||||
describe('InputPasswordConfirmation', () => {
|
describe('InputPasswordConfirmation', () => {
|
||||||
|
|||||||
@ -1,5 +1,4 @@
|
|||||||
import '@/polyfills'
|
import '@/polyfills'
|
||||||
import { configure, extend } from 'vee-validate'
|
|
||||||
import GlobalComponents from './globalComponents'
|
import GlobalComponents from './globalComponents'
|
||||||
import GlobalDirectives from './globalDirectives'
|
import GlobalDirectives from './globalDirectives'
|
||||||
import SideBar from '@/components/SidebarPlugin'
|
import SideBar from '@/components/SidebarPlugin'
|
||||||
@ -14,8 +13,6 @@ import { BootstrapVue, IconsPlugin } from 'bootstrap-vue'
|
|||||||
// asset imports
|
// asset imports
|
||||||
import '@/assets/scss/argon.scss'
|
import '@/assets/scss/argon.scss'
|
||||||
import '@/assets/vendor/nucleo/css/nucleo.css'
|
import '@/assets/vendor/nucleo/css/nucleo.css'
|
||||||
import * as rules from 'vee-validate/dist/rules'
|
|
||||||
import { messages } from 'vee-validate/dist/locale/en.json'
|
|
||||||
|
|
||||||
import VueQrcodeReader from 'vue-qrcode-reader'
|
import VueQrcodeReader from 'vue-qrcode-reader'
|
||||||
import VueQrcode from 'vue-qrcode'
|
import VueQrcode from 'vue-qrcode'
|
||||||
@ -28,13 +25,6 @@ import VueMoment from 'vue-moment'
|
|||||||
import Loading from 'vue-loading-overlay'
|
import Loading from 'vue-loading-overlay'
|
||||||
import 'vue-loading-overlay/dist/vue-loading.css'
|
import 'vue-loading-overlay/dist/vue-loading.css'
|
||||||
|
|
||||||
Object.keys(rules).forEach((rule) => {
|
|
||||||
extend(rule, {
|
|
||||||
...rules[rule], // copies rule configuration
|
|
||||||
message: messages[rule], // assign message
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
install(Vue) {
|
install(Vue) {
|
||||||
Vue.use(GlobalComponents)
|
Vue.use(GlobalComponents)
|
||||||
@ -49,12 +39,5 @@ export default {
|
|||||||
Vue.use(VueQrcode)
|
Vue.use(VueQrcode)
|
||||||
Vue.use(FlatPickr)
|
Vue.use(FlatPickr)
|
||||||
Vue.use(Loading)
|
Vue.use(Loading)
|
||||||
configure({
|
|
||||||
classes: {
|
|
||||||
valid: 'is-valid',
|
|
||||||
invalid: 'is-invalid',
|
|
||||||
dirty: ['is-dirty', 'is-dirty'], // multiple classes per flag!
|
|
||||||
},
|
|
||||||
})
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
@ -9,6 +9,11 @@ export const loadAllRules = (i18nCallback) => {
|
|||||||
values._field_ = i18nCallback.t(`fields.${field}`)
|
values._field_ = i18nCallback.t(`fields.${field}`)
|
||||||
return i18nCallback.t(`validations.messages.${values._rule_}`, values)
|
return i18nCallback.t(`validations.messages.${values._rule_}`, values)
|
||||||
},
|
},
|
||||||
|
classes: {
|
||||||
|
valid: 'is-valid',
|
||||||
|
invalid: 'is-invalid',
|
||||||
|
dirty: ['is-dirty', 'is-dirty'], // multiple classes per flag!
|
||||||
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
extend('email', {
|
extend('email', {
|
||||||
|
|||||||
@ -2,23 +2,6 @@ import { mount, RouterLinkStub } from '@vue/test-utils'
|
|||||||
import loginAPI from '../../apis/loginAPI'
|
import loginAPI from '../../apis/loginAPI'
|
||||||
import ResetPassword from './ResetPassword'
|
import ResetPassword from './ResetPassword'
|
||||||
import flushPromises from 'flush-promises'
|
import flushPromises from 'flush-promises'
|
||||||
import { extend } from 'vee-validate'
|
|
||||||
|
|
||||||
const rules = [
|
|
||||||
'containsLowercaseCharacter',
|
|
||||||
'containsUppercaseCharacter',
|
|
||||||
'containsNumericCharacter',
|
|
||||||
'atLeastEightCharactera',
|
|
||||||
'samePassword',
|
|
||||||
]
|
|
||||||
|
|
||||||
rules.forEach((rule) => {
|
|
||||||
extend(rule, {
|
|
||||||
validate(value) {
|
|
||||||
return true
|
|
||||||
},
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
jest.mock('../../apis/loginAPI')
|
jest.mock('../../apis/loginAPI')
|
||||||
|
|
||||||
|
|||||||
@ -2,23 +2,6 @@ import { mount } from '@vue/test-utils'
|
|||||||
import UserCardFormPasswort from './UserCard_FormUserPasswort'
|
import UserCardFormPasswort from './UserCard_FormUserPasswort'
|
||||||
import loginAPI from '../../../apis/loginAPI'
|
import loginAPI from '../../../apis/loginAPI'
|
||||||
import flushPromises from 'flush-promises'
|
import flushPromises from 'flush-promises'
|
||||||
import { extend } from 'vee-validate'
|
|
||||||
|
|
||||||
const rules = [
|
|
||||||
'containsLowercaseCharacter',
|
|
||||||
'containsUppercaseCharacter',
|
|
||||||
'containsNumericCharacter',
|
|
||||||
'atLeastEightCharactera',
|
|
||||||
'samePassword',
|
|
||||||
]
|
|
||||||
|
|
||||||
rules.forEach((rule) => {
|
|
||||||
extend(rule, {
|
|
||||||
validate(value) {
|
|
||||||
return true
|
|
||||||
},
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
jest.mock('../../../apis/loginAPI')
|
jest.mock('../../../apis/loginAPI')
|
||||||
|
|
||||||
|
|||||||
@ -1,29 +1,24 @@
|
|||||||
import { mount } from '@vue/test-utils'
|
import { mount } from '@vue/test-utils'
|
||||||
import { extend } from 'vee-validate'
|
|
||||||
import UserCardFormUsername from './UserCard_FormUsername'
|
import UserCardFormUsername from './UserCard_FormUsername'
|
||||||
import loginAPI from '../../../apis/loginAPI'
|
import loginAPI from '../../../apis/loginAPI'
|
||||||
import flushPromises from 'flush-promises'
|
import flushPromises from 'flush-promises'
|
||||||
|
import { extend } from 'vee-validate'
|
||||||
|
|
||||||
jest.mock('../../../apis/loginAPI')
|
jest.mock('../../../apis/loginAPI')
|
||||||
|
|
||||||
extend('gddUsernameRgex', {
|
|
||||||
validate(value) {
|
|
||||||
return true
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
extend('gddUsernameUnique', {
|
|
||||||
validate(value) {
|
|
||||||
return true
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
const localVue = global.localVue
|
const localVue = global.localVue
|
||||||
|
|
||||||
const mockAPIcall = jest.fn((args) => {
|
const mockAPIcall = jest.fn((args) => {
|
||||||
return { success: true }
|
return { success: true }
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// override this rule to avoid API call
|
||||||
|
extend('gddUsernameUnique', {
|
||||||
|
validate(value) {
|
||||||
|
return true
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
const toastErrorMock = jest.fn()
|
const toastErrorMock = jest.fn()
|
||||||
const toastSuccessMock = jest.fn()
|
const toastSuccessMock = jest.fn()
|
||||||
const storeCommitMock = jest.fn()
|
const storeCommitMock = jest.fn()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user