Initial support for public scoped slot api
This commit is contained in:
parent
72552cd84d
commit
2ad38933ee
6
package-lock.json
generated
6
package-lock.json
generated
@ -20304,6 +20304,12 @@
|
||||
"is-typedarray": "^1.0.0"
|
||||
}
|
||||
},
|
||||
"typescript": {
|
||||
"version": "3.8.3",
|
||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-3.8.3.tgz",
|
||||
"integrity": "sha512-MYlEfn5VrLNsgudQTVJeNaQFUAI7DkhnOjdpAp4T+ku1TfQClewlbSuTVHiA+8skNBgaf02TL/kLOvig4y3G8w==",
|
||||
"dev": true
|
||||
},
|
||||
"uglify-js": {
|
||||
"version": "3.4.10",
|
||||
"resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.4.10.tgz",
|
||||
|
@ -82,6 +82,7 @@
|
||||
"rollup-plugin-terser": "^5.2.0",
|
||||
"rollup-plugin-vue": "^5.1.6",
|
||||
"sass-loader": "^8.0.2",
|
||||
"typescript": "^3.8.3",
|
||||
"vue": "^2.6.11",
|
||||
"vue-jest": "^3.0.5",
|
||||
"vue-runtime-helpers": "^1.1.2",
|
||||
|
@ -32,7 +32,7 @@
|
||||
<slot
|
||||
v-if="context.hasLabel && context.labelPosition === 'after'"
|
||||
name="label"
|
||||
v-bind="context.label"
|
||||
v-bind="context"
|
||||
>
|
||||
<label
|
||||
class="formulate-input-label formulate-input-label--after"
|
||||
|
@ -26,7 +26,7 @@ export default {
|
||||
uploader: this.uploader || this.$formulate.getUploader(),
|
||||
uploadBehavior: this.uploadBehavior,
|
||||
preventWindowDrops: this.preventWindowDrops,
|
||||
hasValidationErrors: this.hasValidationErrors,
|
||||
hasValidationErrors: this.hasValidationErrors.bind(this),
|
||||
getValidationErrors: this.getValidationErrors.bind(this),
|
||||
validationErrors: this.validationErrors,
|
||||
errors: this.explicitErrors,
|
||||
|
@ -241,4 +241,25 @@ describe('FormulateInputText', () => {
|
||||
await flushPromises()
|
||||
expect(wrapper.find('[data-has-errors]').exists()).toBe(true)
|
||||
})
|
||||
|
||||
|
||||
it('allows label-before override with scoped slot', async () => {
|
||||
const wrapper = mount(FormulateInput, {
|
||||
propsData: { type: 'text', label: 'flavor' },
|
||||
scopedSlots: {
|
||||
label: '<label>{{ props.label }} town</label>'
|
||||
}
|
||||
})
|
||||
expect(wrapper.find('label').text()).toBe('flavor town')
|
||||
})
|
||||
|
||||
it('allows label-after override with scoped slot', async () => {
|
||||
const wrapper = mount(FormulateInput, {
|
||||
propsData: { type: 'text', label: 'flavor', labelPosition: 'after' },
|
||||
scopedSlots: {
|
||||
label: '<label>{{ props.label }} town</label>'
|
||||
}
|
||||
})
|
||||
expect(wrapper.find('label').text()).toBe('flavor town')
|
||||
})
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user