From 66af40e3a9e136ce35d35994a65f7ae9abd13b2f Mon Sep 17 00:00:00 2001 From: Saurav Sahu Date: Fri, 29 Jan 2021 23:15:57 +0530 Subject: [PATCH] add a test which should pass without code change --- src/compiler/compile/nodes/Element.ts | 2 +- test/validator/index.ts | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/compiler/compile/nodes/Element.ts b/src/compiler/compile/nodes/Element.ts index 5a1e2ecfae..7fb4f4aeef 100644 --- a/src/compiler/compile/nodes/Element.ts +++ b/src/compiler/compile/nodes/Element.ts @@ -600,7 +600,7 @@ export default class Element extends Node { validate_bindings_foreign() { this.bindings - .filter(binding => binding.name !== 'this') + // .filter(binding => binding.name !== 'this') .forEach(binding => { this.component.error(binding, { code: 'invalid-binding', diff --git a/test/validator/index.ts b/test/validator/index.ts index 72364ea89a..030ec59c75 100644 --- a/test/validator/index.ts +++ b/test/validator/index.ts @@ -119,4 +119,17 @@ describe('validate', () => { }); }, /Invalid namespace 'foriegn' \(did you mean 'foreign'\?\)/); }); + + it('throws an error if \'this\' is bound for foreign element', () => { + assert.throws(() => { + svelte.compile(` + +
`, { + name: 'test', + namespace: 'foreign' + }); + }, /'this' is not a valid binding/) + }) });