From ba24de4e10319398442300dda0d4125a14320386 Mon Sep 17 00:00:00 2001 From: Denis Kurilenko Date: Wed, 31 Jan 2018 10:59:54 +0300 Subject: [PATCH] Support for fixed #1104 --- src/validate/html/validateElement.ts | 9 ++++++--- test/validator/samples/binding-input-checked/errors.json | 4 ++-- .../samples/binding-input-radio-group/errors.json | 8 ++++++++ .../samples/binding-input-radio-group/input.html | 1 + 4 files changed, 17 insertions(+), 5 deletions(-) create mode 100644 test/validator/samples/binding-input-radio-group/errors.json create mode 100644 test/validator/samples/binding-input-radio-group/input.html diff --git a/src/validate/html/validateElement.ts b/src/validate/html/validateElement.ts index 1156ebcea7..17ca5fc453 100644 --- a/src/validate/html/validateElement.ts +++ b/src/validate/html/validateElement.ts @@ -111,12 +111,15 @@ export default function validateElement( ); } - if (checkTypeAttribute(validator, node) !== 'checkbox') { + const type = checkTypeAttribute(validator, node); + + if (type !== 'checkbox' && type !== 'radio') { validator.error( - `'${name}' binding can only be used with `, + `'checked' binding can only be used with or `, attribute.start ); } + } else if (name === 'group') { if (node.name !== 'input') { validator.error( @@ -129,7 +132,7 @@ export default function validateElement( if (type !== 'checkbox' && type !== 'radio') { validator.error( - `'checked' binding can only be used with or `, + `'group' binding can only be used with or `, attribute.start ); } diff --git a/test/validator/samples/binding-input-checked/errors.json b/test/validator/samples/binding-input-checked/errors.json index 05747dc96c..cbff8fe8ad 100644 --- a/test/validator/samples/binding-input-checked/errors.json +++ b/test/validator/samples/binding-input-checked/errors.json @@ -1,8 +1,8 @@ [{ - "message": "'checked' binding can only be used with ", + "message": "'checked' binding can only be used with or ", "loc": { "line": 1, "column": 7 }, "pos": 7 -}] \ No newline at end of file +}] diff --git a/test/validator/samples/binding-input-radio-group/errors.json b/test/validator/samples/binding-input-radio-group/errors.json new file mode 100644 index 0000000000..b61e5796d8 --- /dev/null +++ b/test/validator/samples/binding-input-radio-group/errors.json @@ -0,0 +1,8 @@ +[{ + "message": "'group' binding can only be used with or ", + "loc": { + "line": 1, + "column": 7 + }, + "pos": 7 +}] diff --git a/test/validator/samples/binding-input-radio-group/input.html b/test/validator/samples/binding-input-radio-group/input.html new file mode 100644 index 0000000000..3821c165b3 --- /dev/null +++ b/test/validator/samples/binding-input-radio-group/input.html @@ -0,0 +1 @@ +