mirror of https://github.com/vuejs/core.git
Merge 5e0e684366
into ba391f5fdf
This commit is contained in:
commit
471a3d1e19
|
@ -59,11 +59,11 @@ export function compatCoerceAttr(
|
||||||
): boolean {
|
): boolean {
|
||||||
if (isEnumeratedAttr(key)) {
|
if (isEnumeratedAttr(key)) {
|
||||||
const v2CoercedValue =
|
const v2CoercedValue =
|
||||||
value === null
|
value === undefined
|
||||||
|
? null
|
||||||
|
: value === null || value === false || value === 'false'
|
||||||
? 'false'
|
? 'false'
|
||||||
: typeof value !== 'boolean' && value !== undefined
|
: 'true'
|
||||||
? 'true'
|
|
||||||
: null
|
|
||||||
if (
|
if (
|
||||||
v2CoercedValue &&
|
v2CoercedValue &&
|
||||||
compatUtils.softAssertCompatEnabled(
|
compatUtils.softAssertCompatEnabled(
|
||||||
|
|
|
@ -275,3 +275,17 @@ test('ATTR_ENUMERATED_COERCION', () => {
|
||||||
)('contenteditable', 'foo', 'true'),
|
)('contenteditable', 'foo', 'true'),
|
||||||
).toHaveBeenWarned()
|
).toHaveBeenWarned()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
test('ATTR_ENUMERATED_COERCION: true', () => {
|
||||||
|
const vm = new Vue({
|
||||||
|
compatConfig: { ATTR_ENUMERATED_COERCION: true },
|
||||||
|
template: `<div><div draggable="false">hello</div></div>`,
|
||||||
|
}).$mount()
|
||||||
|
expect(vm.$el.innerHTML).toBe(`<div draggable="false">hello</div>`)
|
||||||
|
expect(
|
||||||
|
(
|
||||||
|
deprecationData[DeprecationTypes.ATTR_ENUMERATED_COERCION]
|
||||||
|
.message as Function
|
||||||
|
)('draggable', 'false', 'false'),
|
||||||
|
).toHaveBeenWarned()
|
||||||
|
})
|
||||||
|
|
Loading…
Reference in New Issue