Removes all style block tags
This commit is contained in:
commit
dfef74cd27
@ -15,7 +15,8 @@ export default {
|
|||||||
'nanoid/non-secure': 'nanoid',
|
'nanoid/non-secure': 'nanoid',
|
||||||
'is-url': 'isUrl',
|
'is-url': 'isUrl',
|
||||||
'@braid/vue-formulate-i18n': 'VueFormulateI18n'
|
'@braid/vue-formulate-i18n': 'VueFormulateI18n'
|
||||||
}
|
},
|
||||||
|
sourcemap: false
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
external: ['nanoid/non-secure'],
|
external: ['nanoid/non-secure'],
|
||||||
|
2
dist/formulate.esm.js
vendored
2
dist/formulate.esm.js
vendored
File diff suppressed because one or more lines are too long
4
dist/formulate.min.js
vendored
4
dist/formulate.min.js
vendored
File diff suppressed because one or more lines are too long
2
dist/formulate.umd.js
vendored
2
dist/formulate.umd.js
vendored
File diff suppressed because one or more lines are too long
7997
package-lock.json
generated
7997
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
39
package.json
39
package.json
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@braid/vue-formulate",
|
"name": "@braid/vue-formulate",
|
||||||
"version": "2.2.5",
|
"version": "2.2.8",
|
||||||
"description": "The easiest way to build forms in Vue.",
|
"description": "The easiest way to build forms in Vue.",
|
||||||
"main": "dist/formulate.umd.js",
|
"main": "dist/formulate.umd.js",
|
||||||
"module": "dist/formulate.esm.js",
|
"module": "dist/formulate.esm.js",
|
||||||
@ -45,23 +45,22 @@
|
|||||||
},
|
},
|
||||||
"homepage": "https://www.vueformulate.com",
|
"homepage": "https://www.vueformulate.com",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@babel/core": "^7.8.4",
|
"@babel/core": "^7.9.0",
|
||||||
"@babel/plugin-transform-modules-commonjs": "^7.8.3",
|
"@babel/plugin-transform-modules-commonjs": "^7.9.0",
|
||||||
"@babel/preset-env": "^7.8.4",
|
"@babel/preset-env": "^7.9.5",
|
||||||
"@rollup/plugin-buble": "^0.21.1",
|
"@rollup/plugin-buble": "^0.21.3",
|
||||||
"@rollup/plugin-commonjs": "^11.0.2",
|
"@rollup/plugin-commonjs": "^11.1.0",
|
||||||
"@rollup/plugin-node-resolve": "^7.1.1",
|
"@rollup/plugin-node-resolve": "^7.1.3",
|
||||||
"@vue/cli-plugin-babel": "^4.2.3",
|
"@vue/cli-plugin-babel": "^4.3.1",
|
||||||
"@vue/cli-plugin-eslint": "^4.2.3",
|
"@vue/cli-plugin-eslint": "^4.3.1",
|
||||||
"@vue/cli-service": "^4.2.3",
|
"@vue/cli-service": "^4.3.1",
|
||||||
"@vue/component-compiler-utils": "^3.1.1",
|
"@vue/component-compiler-utils": "^3.1.2",
|
||||||
"@vue/test-utils": "^1.0.0-beta.31",
|
"@vue/test-utils": "^1.0.0-beta.33",
|
||||||
"autoprefixer": "^9.7.4",
|
"autoprefixer": "^9.7.6",
|
||||||
"babel-core": "^7.0.0-bridge.0",
|
"babel-core": "^7.0.0-bridge.0",
|
||||||
"babel-eslint": "^10.0.1",
|
"babel-eslint": "^10.1.0",
|
||||||
"babel-jest": "^25.1.0",
|
"babel-jest": "^25.3.0",
|
||||||
"cssnano": "^4.1.10",
|
"cssnano": "^4.1.10",
|
||||||
"cypress": "^4.1.0",
|
|
||||||
"eslint": "^5.16.0",
|
"eslint": "^5.16.0",
|
||||||
"eslint-config-standard": "^12.0.0",
|
"eslint-config-standard": "^12.0.0",
|
||||||
"eslint-plugin-import": "^2.20.1",
|
"eslint-plugin-import": "^2.20.1",
|
||||||
@ -70,16 +69,16 @@
|
|||||||
"eslint-plugin-standard": "^4.0.0",
|
"eslint-plugin-standard": "^4.0.0",
|
||||||
"eslint-plugin-vue": "^5.2.3",
|
"eslint-plugin-vue": "^5.2.3",
|
||||||
"flush-promises": "^1.0.2",
|
"flush-promises": "^1.0.2",
|
||||||
"jest": "^25.1.0",
|
"jest": "^25.3.0",
|
||||||
"jest-vue-preprocessor": "^1.7.1",
|
"jest-vue-preprocessor": "^1.7.1",
|
||||||
"node-sass": "^4.13.1",
|
"node-sass": "^4.13.1",
|
||||||
"postcss": "^7.0.27",
|
"postcss": "^7.0.27",
|
||||||
"postcss-cli": "^7.1.0",
|
"postcss-cli": "^7.1.0",
|
||||||
"rollup": "^1.31.1",
|
"rollup": "^1.32.1",
|
||||||
"rollup-plugin-auto-external": "^2.0.0",
|
"rollup-plugin-auto-external": "^2.0.0",
|
||||||
"rollup-plugin-internal": "^1.0.4",
|
"rollup-plugin-internal": "^1.0.4",
|
||||||
"rollup-plugin-multi-input": "^1.1.1",
|
"rollup-plugin-multi-input": "^1.1.1",
|
||||||
"rollup-plugin-terser": "^5.2.0",
|
"rollup-plugin-terser": "^5.3.0",
|
||||||
"rollup-plugin-vue": "^5.1.6",
|
"rollup-plugin-vue": "^5.1.6",
|
||||||
"sass-loader": "^8.0.2",
|
"sass-loader": "^8.0.2",
|
||||||
"typescript": "^3.8.3",
|
"typescript": "^3.8.3",
|
||||||
@ -91,7 +90,7 @@
|
|||||||
"watch": "^1.0.2"
|
"watch": "^1.0.2"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@braid/vue-formulate-i18n": "^1.3.2",
|
"@braid/vue-formulate-i18n": "^1.4.0",
|
||||||
"is-plain-object": "^3.0.0",
|
"is-plain-object": "^3.0.0",
|
||||||
"is-url": "^1.2.4",
|
"is-url": "^1.2.4",
|
||||||
"nanoid": "^2.1.11"
|
"nanoid": "^2.1.11"
|
||||||
|
@ -264,7 +264,7 @@ class Formulate {
|
|||||||
* @param {error}
|
* @param {error}
|
||||||
*/
|
*/
|
||||||
handle (err, formName, skip = false) {
|
handle (err, formName, skip = false) {
|
||||||
const e = skip ? err : this.options.errorHandler(err)
|
const e = skip ? err : this.options.errorHandler(err, formName)
|
||||||
if (formName && this.registry.has(formName)) {
|
if (formName && this.registry.has(formName)) {
|
||||||
this.registry.get(formName).applyErrors({
|
this.registry.get(formName).applyErrors({
|
||||||
formErrors: arrayify(e.formErrors),
|
formErrors: arrayify(e.formErrors),
|
||||||
|
@ -26,7 +26,3 @@ export default {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style>
|
|
||||||
|
|
||||||
</style>
|
|
||||||
|
@ -196,8 +196,6 @@ function createOptionList (options) {
|
|||||||
optionList.push({ value, label: options[value], id: `${that.elementAttributes.id}_${value}` })
|
optionList.push({ value, label: options[value], id: `${that.elementAttributes.id}_${value}` })
|
||||||
}
|
}
|
||||||
return optionList
|
return optionList
|
||||||
} else if (Array.isArray(options) && !options.length) {
|
|
||||||
return [{ value: this.value, label: (this.label || this.name), id: this.context.id || nanoid(9) }]
|
|
||||||
}
|
}
|
||||||
return options
|
return options
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,3 @@ export default {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style>
|
|
||||||
|
|
||||||
</style>
|
|
||||||
|
@ -16,7 +16,3 @@ export default {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style>
|
|
||||||
|
|
||||||
</style>
|
|
||||||
|
@ -13,7 +13,3 @@ export default {
|
|||||||
|
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style>
|
|
||||||
|
|
||||||
</style>
|
|
||||||
|
@ -229,6 +229,47 @@ describe('FormulateForm', () => {
|
|||||||
expect(wrapper.vm.$formulate.registry.get('login')).toBe(wrapper.vm)
|
expect(wrapper.vm.$formulate.registry.get('login')).toBe(wrapper.vm)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it('calls custom error handler with error and name', async () => {
|
||||||
|
const mockHandler = jest.fn((err, name) => err);
|
||||||
|
const wrapper = mount({
|
||||||
|
template: `
|
||||||
|
<div>
|
||||||
|
<FormulateForm
|
||||||
|
name="login"
|
||||||
|
/>
|
||||||
|
<FormulateForm
|
||||||
|
name="register"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
`
|
||||||
|
})
|
||||||
|
wrapper.vm.$formulate.extend({ errorHandler: mockHandler })
|
||||||
|
wrapper.vm.$formulate.handle({ formErrors: ['This is an error message'] }, 'login')
|
||||||
|
expect(mockHandler.mock.calls.length).toBe(1);
|
||||||
|
expect(mockHandler.mock.calls[0]).toEqual([{ formErrors: ['This is an error message'] }, 'login']);
|
||||||
|
})
|
||||||
|
|
||||||
|
it('errors are displayed on correctly named components', async () => {
|
||||||
|
const wrapper = mount({
|
||||||
|
template: `
|
||||||
|
<div>
|
||||||
|
<FormulateForm
|
||||||
|
name="login"
|
||||||
|
/>
|
||||||
|
<FormulateForm
|
||||||
|
name="register"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
`
|
||||||
|
})
|
||||||
|
expect(wrapper.vm.$formulate.registry.has('login') && wrapper.vm.$formulate.registry.has('register')).toBe(true)
|
||||||
|
wrapper.vm.$formulate.handle({ formErrors: ['This is an error message'] }, 'login')
|
||||||
|
await flushPromises()
|
||||||
|
expect(wrapper.findAll('.formulate-form').length).toBe(2)
|
||||||
|
expect(wrapper.find('.formulate-form--login .formulate-form-errors').exists()).toBe(true)
|
||||||
|
expect(wrapper.find('.formulate-form--register .formulate-form-errors').exists()).toBe(false)
|
||||||
|
})
|
||||||
|
|
||||||
it('errors are displayed on correctly named components', async () => {
|
it('errors are displayed on correctly named components', async () => {
|
||||||
const wrapper = mount({
|
const wrapper = mount({
|
||||||
template: `
|
template: `
|
||||||
|
@ -201,4 +201,10 @@ describe('FormulateInputBox', () => {
|
|||||||
await flushPromises()
|
await flushPromises()
|
||||||
expect(wrapper.find('.formulate-input-error').exists()).toBe(true)
|
expect(wrapper.find('.formulate-input-error').exists()).toBe(true)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it('renders no boxes when options array is empty', async () => {
|
||||||
|
const wrapper = mount(FormulateInput, { propsData: { type: 'checkbox', options: [] } })
|
||||||
|
expect(wrapper.contains(FormulateInputGroup)).toBe(true)
|
||||||
|
expect(wrapper.find('input[type="checkbox"]').exists()).toBe(false)
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import Vue from 'vue'
|
import Vue from 'vue'
|
||||||
import { mount } from '@vue/test-utils'
|
import { mount } from '@vue/test-utils'
|
||||||
import Formulate from '../../src/Formulate.js'
|
import Formulate from '@/Formulate.js'
|
||||||
import FormulateInput from '@/FormulateInput.vue'
|
import FormulateInput from '@/FormulateInput.vue'
|
||||||
import FormulateInputButton from '@/inputs/FormulateInputButton.vue'
|
import FormulateInputButton from '@/inputs/FormulateInputButton.vue'
|
||||||
|
|
||||||
|
45
test/unit/FormulateInputSelect.test.js
Normal file
45
test/unit/FormulateInputSelect.test.js
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
import Vue from 'vue'
|
||||||
|
import { mount } from '@vue/test-utils'
|
||||||
|
import flushPromises from 'flush-promises'
|
||||||
|
import Formulate from '@/Formulate.js'
|
||||||
|
import FormulateInput from '@/FormulateInput.vue'
|
||||||
|
import FormulateInputSelect from '@/inputs/FormulateInputSelect.vue'
|
||||||
|
|
||||||
|
Vue.use(Formulate)
|
||||||
|
|
||||||
|
describe('FormulateInputSelect', () => {
|
||||||
|
it('renders select input when type is "select"', () => {
|
||||||
|
const wrapper = mount(FormulateInput, { propsData: { type: 'select' } })
|
||||||
|
expect(wrapper.contains(FormulateInputSelect)).toBe(true)
|
||||||
|
})
|
||||||
|
|
||||||
|
it('renders select options when options object is passed', () => {
|
||||||
|
const wrapper = mount(FormulateInput, { propsData: { type: 'select', options: { first: 'First', second: 'Second' } } })
|
||||||
|
const option = wrapper.find('option[value="second"]')
|
||||||
|
expect(option.exists()).toBe(true)
|
||||||
|
expect(option.text()).toBe('Second')
|
||||||
|
})
|
||||||
|
|
||||||
|
it('renders select options when options array is passed', () => {
|
||||||
|
const wrapper = mount(FormulateInput, { propsData: { type: 'select', options: [
|
||||||
|
{ value: 13, label: 'Jane' },
|
||||||
|
{ value: 22, label: 'Jon' }
|
||||||
|
]} })
|
||||||
|
const option = wrapper.find('option[value="22"]')
|
||||||
|
expect(option.exists()).toBe(true)
|
||||||
|
expect(option.text()).toBe('Jon')
|
||||||
|
})
|
||||||
|
|
||||||
|
it('renders select list with no options when empty array is passed.', () => {
|
||||||
|
const wrapper = mount(FormulateInput, { propsData: { type: 'select', options: []} })
|
||||||
|
const option = wrapper.find('option')
|
||||||
|
expect(option.exists()).toBe(false)
|
||||||
|
})
|
||||||
|
|
||||||
|
it('renders select list placeholder option.', () => {
|
||||||
|
const wrapper = mount(FormulateInput, { propsData: { type: 'select', placeholder: 'Select this', options: []} })
|
||||||
|
const options = wrapper.findAll('option')
|
||||||
|
expect(options.length).toBe(1)
|
||||||
|
expect(options.at(0).attributes('disabled')).toBeTruthy()
|
||||||
|
})
|
||||||
|
})
|
Loading…
Reference in New Issue
Block a user