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 { extend } from 'vee-validate'
|
||||
|
||||
import InputPasswordConfirmation from './InputPasswordConfirmation'
|
||||
|
||||
const rules = [
|
||||
'containsLowercaseCharacter',
|
||||
'containsUppercaseCharacter',
|
||||
'containsNumericCharacter',
|
||||
'atLeastEightCharactera',
|
||||
'samePassword',
|
||||
]
|
||||
|
||||
rules.forEach((rule) => {
|
||||
extend(rule, {
|
||||
validate(value) {
|
||||
return true
|
||||
},
|
||||
})
|
||||
})
|
||||
|
||||
const localVue = global.localVue
|
||||
|
||||
describe('InputPasswordConfirmation', () => {
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
import '@/polyfills'
|
||||
import { configure, extend } from 'vee-validate'
|
||||
import GlobalComponents from './globalComponents'
|
||||
import GlobalDirectives from './globalDirectives'
|
||||
import SideBar from '@/components/SidebarPlugin'
|
||||
@ -14,8 +13,6 @@ import { BootstrapVue, IconsPlugin } from 'bootstrap-vue'
|
||||
// asset imports
|
||||
import '@/assets/scss/argon.scss'
|
||||
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 VueQrcode from 'vue-qrcode'
|
||||
@ -28,13 +25,6 @@ import VueMoment from 'vue-moment'
|
||||
import Loading from 'vue-loading-overlay'
|
||||
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 {
|
||||
install(Vue) {
|
||||
Vue.use(GlobalComponents)
|
||||
@ -49,12 +39,5 @@ export default {
|
||||
Vue.use(VueQrcode)
|
||||
Vue.use(FlatPickr)
|
||||
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}`)
|
||||
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', {
|
||||
|
||||
@ -2,23 +2,6 @@ import { mount, RouterLinkStub } from '@vue/test-utils'
|
||||
import loginAPI from '../../apis/loginAPI'
|
||||
import ResetPassword from './ResetPassword'
|
||||
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')
|
||||
|
||||
|
||||
@ -2,23 +2,6 @@ import { mount } from '@vue/test-utils'
|
||||
import UserCardFormPasswort from './UserCard_FormUserPasswort'
|
||||
import loginAPI from '../../../apis/loginAPI'
|
||||
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')
|
||||
|
||||
|
||||
@ -1,29 +1,24 @@
|
||||
import { mount } from '@vue/test-utils'
|
||||
import { extend } from 'vee-validate'
|
||||
import UserCardFormUsername from './UserCard_FormUsername'
|
||||
import loginAPI from '../../../apis/loginAPI'
|
||||
import flushPromises from 'flush-promises'
|
||||
import { extend } from 'vee-validate'
|
||||
|
||||
jest.mock('../../../apis/loginAPI')
|
||||
|
||||
extend('gddUsernameRgex', {
|
||||
validate(value) {
|
||||
return true
|
||||
},
|
||||
})
|
||||
|
||||
extend('gddUsernameUnique', {
|
||||
validate(value) {
|
||||
return true
|
||||
},
|
||||
})
|
||||
|
||||
const localVue = global.localVue
|
||||
|
||||
const mockAPIcall = jest.fn((args) => {
|
||||
return { success: true }
|
||||
})
|
||||
|
||||
// override this rule to avoid API call
|
||||
extend('gddUsernameUnique', {
|
||||
validate(value) {
|
||||
return true
|
||||
},
|
||||
})
|
||||
|
||||
const toastErrorMock = jest.fn()
|
||||
const toastSuccessMock = jest.fn()
|
||||
const storeCommitMock = jest.fn()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user