mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
first tests for login form. to do: get rules of vee validate running
This commit is contained in:
parent
eeb674d01f
commit
1431d13d36
@ -44,6 +44,7 @@
|
||||
"eslint-plugin-vue": "^7.8.0",
|
||||
"express": "^4.17.1",
|
||||
"flatpickr": "^4.5.7",
|
||||
"flush-promises": "^1.0.2",
|
||||
"fuse.js": "^3.2.0",
|
||||
"google-maps": "^3.2.1",
|
||||
"identity-obj-proxy": "^3.0.0",
|
||||
@ -54,6 +55,7 @@
|
||||
"prettier": "^2.2.1",
|
||||
"qrcode": "^1.4.4",
|
||||
"quill": "^1.3.6",
|
||||
"regenerator-runtime": "^0.13.7",
|
||||
"sweetalert2": "^9.5.4",
|
||||
"vee-validate": "^3.4.5",
|
||||
"vue": "^2.6.11",
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
import { mount, RouterLinkStub } from '@vue/test-utils'
|
||||
import Vuex from 'vuex'
|
||||
import flushPromises from 'flush-promises'
|
||||
|
||||
import Login from './Login'
|
||||
|
||||
@ -40,5 +41,59 @@ describe('Login', () => {
|
||||
it('renders the Login form', () => {
|
||||
expect(wrapper.find('div.login-form').exists()).toBeTruthy()
|
||||
})
|
||||
|
||||
describe('Login header', () => {
|
||||
it('has a welcome message', () => {
|
||||
expect(wrapper.find('div.header').text()).toBe('Gradido site.login.community')
|
||||
})
|
||||
})
|
||||
|
||||
describe('links', () => {
|
||||
it('has a link "Forgot Password?"', () => {
|
||||
expect(wrapper.findAllComponents(RouterLinkStub).at(0).text())
|
||||
.toEqual('site.login.forgot_pwd')
|
||||
})
|
||||
|
||||
it('links to /password when clicking "Forgot Password?"', () => {
|
||||
expect(wrapper.findAllComponents(RouterLinkStub).at(0).props().to)
|
||||
.toBe('/password')
|
||||
})
|
||||
|
||||
it('has a link "Create new account"', () => {
|
||||
expect(wrapper.findAllComponents(RouterLinkStub).at(1).text())
|
||||
.toEqual('site.login.new_wallet')
|
||||
})
|
||||
|
||||
it('links to /register when clicking "Create new account"', () => {
|
||||
expect(wrapper.findAllComponents(RouterLinkStub).at(1).props().to)
|
||||
.toBe('/register')
|
||||
})
|
||||
})
|
||||
|
||||
describe('Login form', () => {
|
||||
it('has a login form', () => {
|
||||
expect(wrapper.find('form').exists()).toBeTruthy()
|
||||
})
|
||||
|
||||
it('has an Email input field', () => {
|
||||
expect(wrapper.find('input[placeholder="Email"]').exists()).toBeTruthy()
|
||||
})
|
||||
|
||||
it('has an Password input field', () => {
|
||||
expect(wrapper.find('input[placeholder="form.password"]').exists()).toBeTruthy()
|
||||
})
|
||||
|
||||
it('has a Submit button', () => {
|
||||
expect(wrapper.find('button[type="submit"]').exists()).toBeTruthy()
|
||||
})
|
||||
|
||||
it('shows a warining when no valid Email is entered', async () => {
|
||||
wrapper.find('input[placeholder="Email"]').setValue('no_valid@Email')
|
||||
//await wrapper.vm.$nextTick()
|
||||
await flushPromises()
|
||||
console.log(wrapper.find('fieldset').html())
|
||||
await expect(false).toBetruthy()
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
@ -3,8 +3,22 @@ import ElementUI from 'element-ui'
|
||||
import { BootstrapVue, IconsPlugin } from 'bootstrap-vue'
|
||||
import Vuex from 'vuex'
|
||||
import { ValidationProvider, ValidationObserver } from 'vee-validate'
|
||||
//import * as rules from 'vee-validate/dist/rules'
|
||||
//import { extend } from 'vee-validate'
|
||||
import BaseInput from '@/components/Inputs/BaseInput.vue'
|
||||
import BaseButton from '@/components/BaseButton.vue'
|
||||
import RegeneratorRuntime from 'regenerator-runtime'
|
||||
|
||||
/*
|
||||
|
||||
Object.keys(rules).forEach((rule) => {
|
||||
extend(rule, {
|
||||
...rules[rule], // copies rule configuration
|
||||
message: messages[rule], // assign message
|
||||
})
|
||||
})
|
||||
|
||||
*/
|
||||
|
||||
global.localVue = createLocalVue()
|
||||
|
||||
@ -12,6 +26,8 @@ global.localVue.use(ElementUI)
|
||||
global.localVue.use(BootstrapVue)
|
||||
global.localVue.use(Vuex)
|
||||
global.localVue.use(IconsPlugin)
|
||||
global.localVue.use(RegeneratorRuntime)
|
||||
//global.localVue.use()
|
||||
global.localVue.component(BaseInput.name, BaseInput)
|
||||
global.localVue.component('validation-provider', ValidationProvider)
|
||||
global.localVue.component('validation-observer', ValidationObserver)
|
||||
|
||||
@ -6404,6 +6404,11 @@ flatted@^2.0.0:
|
||||
resolved "https://registry.yarnpkg.com/flatted/-/flatted-2.0.2.tgz#4575b21e2bcee7434aa9be662f4b7b5f9c2b5138"
|
||||
integrity sha512-r5wGx7YeOwNWNlCA0wQ86zKyDLMQr+/RB8xy74M4hTphfmjlijTSSXGuH8rnvKZnfT9i+75zmd8jcKdMR4O6jA==
|
||||
|
||||
flush-promises@^1.0.2:
|
||||
version "1.0.2"
|
||||
resolved "https://registry.yarnpkg.com/flush-promises/-/flush-promises-1.0.2.tgz#4948fd58f15281fed79cbafc86293d5bb09b2ced"
|
||||
integrity sha512-G0sYfLQERwKz4+4iOZYQEZVpOt9zQrlItIxQAAYAWpfby3gbHrx0osCHz5RLl/XoXevXk0xoN4hDFky/VV9TrA==
|
||||
|
||||
flush-write-stream@^1.0.0:
|
||||
version "1.1.1"
|
||||
resolved "https://registry.yarnpkg.com/flush-write-stream/-/flush-write-stream-1.1.1.tgz#8dd7d873a1babc207d94ead0c2e0e44276ebf2e8"
|
||||
@ -11206,7 +11211,7 @@ regenerator-runtime@^0.11.0:
|
||||
resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.11.1.tgz#be05ad7f9bf7d22e056f9726cee5017fbf19e2e9"
|
||||
integrity sha512-MguG95oij0fC3QV3URf4V2SDYGJhJnJGqvIIgdECeODCT98wSWDAJ94SSuVpYQUoTcGUIL6L4yNB7j1DFFHSBg==
|
||||
|
||||
regenerator-runtime@^0.13.4:
|
||||
regenerator-runtime@^0.13.4, regenerator-runtime@^0.13.7:
|
||||
version "0.13.7"
|
||||
resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.13.7.tgz#cac2dacc8a1ea675feaabaeb8ae833898ae46f55"
|
||||
integrity sha512-a54FxoJDIr27pgf7IgeQGxmqUNYrcV338lf/6gH456HZ/PhX+5BcwHXG9ajESmwe6WRO0tAzRUrRmNONWgkrew==
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user