From ce991e7a648a5844822a685c8b219d58073afe7f Mon Sep 17 00:00:00 2001 From: Jonniek Date: Sun, 15 Mar 2020 19:13:35 +0200 Subject: [PATCH] add check for boolean attribute in ssr binding --- src/compiler/compile/render_ssr/handlers/Element.ts | 2 +- .../_config.js | 12 ------------ .../_config.js | 4 ++-- .../_config.js | 5 ----- .../_config.js | 4 ++-- .../globals-not-overwritten-by-bindings/_config.js | 2 +- 6 files changed, 6 insertions(+), 23 deletions(-) diff --git a/src/compiler/compile/render_ssr/handlers/Element.ts b/src/compiler/compile/render_ssr/handlers/Element.ts index e33ca9ea56..fb3b69fa02 100644 --- a/src/compiler/compile/render_ssr/handlers/Element.ts +++ b/src/compiler/compile/render_ssr/handlers/Element.ts @@ -124,7 +124,7 @@ export default function(node: Element, renderer: Renderer, options: RenderOption node_contents = x`${snippet} || ""`; } else { const snippet = expression.node; - renderer.add_expression(x`@add_attribute("${name}", ${snippet}, 0)`); + renderer.add_expression(x`@add_attribute("${name}", ${snippet}, ${boolean_attributes.has(name) ? 1 : 0})`); } }); diff --git a/test/runtime/samples/binding-input-checkbox-deep-contextual-b/_config.js b/test/runtime/samples/binding-input-checkbox-deep-contextual-b/_config.js index a4c9dacb6e..eeddaf9981 100644 --- a/test/runtime/samples/binding-input-checkbox-deep-contextual-b/_config.js +++ b/test/runtime/samples/binding-input-checkbox-deep-contextual-b/_config.js @@ -11,18 +11,6 @@ export default { `, - ssrHtml: ` -
-

one

-
-
-

two

-
-
-

three

-
- `, - async test({ assert, component, target, window }) { const inputs = [ ...target.querySelectorAll('input') ]; diff --git a/test/runtime/samples/binding-input-checkbox-deep-contextual/_config.js b/test/runtime/samples/binding-input-checkbox-deep-contextual/_config.js index ed75021b67..959b17777b 100644 --- a/test/runtime/samples/binding-input-checkbox-deep-contextual/_config.js +++ b/test/runtime/samples/binding-input-checkbox-deep-contextual/_config.js @@ -25,10 +25,10 @@ export default {

one

-

two

+

two

-

three

+

three

1 completed

`, diff --git a/test/runtime/samples/binding-input-checkbox-with-event-in-each/_config.js b/test/runtime/samples/binding-input-checkbox-with-event-in-each/_config.js index 1ce561647f..b502ed40af 100644 --- a/test/runtime/samples/binding-input-checkbox-with-event-in-each/_config.js +++ b/test/runtime/samples/binding-input-checkbox-with-event-in-each/_config.js @@ -17,11 +17,6 @@ export default { `, - ssrHtml: ` - - - `, - test({ assert, component, target, window }) { const { cats } = component; const newCats = cats.slice(); diff --git a/test/runtime/samples/binding-input-text-contextual-reactive/_config.js b/test/runtime/samples/binding-input-text-contextual-reactive/_config.js index 91f243a8b6..6fdfc4be52 100644 --- a/test/runtime/samples/binding-input-text-contextual-reactive/_config.js +++ b/test/runtime/samples/binding-input-text-contextual-reactive/_config.js @@ -26,7 +26,7 @@ export default { ssrHtml: `
- +

one

@@ -34,7 +34,7 @@ export default {

two

- +

three

diff --git a/test/runtime/samples/globals-not-overwritten-by-bindings/_config.js b/test/runtime/samples/globals-not-overwritten-by-bindings/_config.js index 5daeeb1792..d5f3def7f1 100644 --- a/test/runtime/samples/globals-not-overwritten-by-bindings/_config.js +++ b/test/runtime/samples/globals-not-overwritten-by-bindings/_config.js @@ -28,7 +28,7 @@ export default {
- +
`,