From a2fd36f86c90263c7b6984384482e956d81c4905 Mon Sep 17 00:00:00 2001 From: Rich Harris Date: Wed, 26 Apr 2017 11:41:31 -0400 Subject: [PATCH 1/2] Provide second argument to validator.error with bind:checked errors --- src/validate/html/validateElement.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/validate/html/validateElement.js b/src/validate/html/validateElement.js index beca2086ec..cda56ec730 100644 --- a/src/validate/html/validateElement.js +++ b/src/validate/html/validateElement.js @@ -25,7 +25,7 @@ export default function validateElement ( validator, node ) { } if ( getType( validator, node ) !== 'checkbox' ) { - validator.error( `'checked' binding can only be used with ` ); + validator.error( `'checked' binding can only be used with `, attribute.start ); } } @@ -99,4 +99,4 @@ function getType ( validator, node ) { function list ( items, conjunction = 'or' ) { if ( items.length === 1 ) return items[0]; return `${items.slice( 0, -1 ).join( ', ' )} ${conjunction} ${items[ items.length - 1 ]}`; -} \ No newline at end of file +} From 5e042c4c8e7f02de621607829a7a9a88fa0ab444 Mon Sep 17 00:00:00 2001 From: Rich-Harris Date: Sun, 30 Apr 2017 08:01:18 -0400 Subject: [PATCH 2/2] add test --- test/validator/samples/binding-input-checked/errors.json | 8 ++++++++ test/validator/samples/binding-input-checked/input.html | 1 + 2 files changed, 9 insertions(+) create mode 100644 test/validator/samples/binding-input-checked/errors.json create mode 100644 test/validator/samples/binding-input-checked/input.html diff --git a/test/validator/samples/binding-input-checked/errors.json b/test/validator/samples/binding-input-checked/errors.json new file mode 100644 index 0000000000..05747dc96c --- /dev/null +++ b/test/validator/samples/binding-input-checked/errors.json @@ -0,0 +1,8 @@ +[{ + "message": "'checked' binding can only be used with ", + "loc": { + "line": 1, + "column": 7 + }, + "pos": 7 +}] \ No newline at end of file diff --git a/test/validator/samples/binding-input-checked/input.html b/test/validator/samples/binding-input-checked/input.html new file mode 100644 index 0000000000..9990d3c596 --- /dev/null +++ b/test/validator/samples/binding-input-checked/input.html @@ -0,0 +1 @@ + \ No newline at end of file