From 2120a819583bb12e39660745e60c1e0eec025cd4 Mon Sep 17 00:00:00 2001 From: Rich Harris Date: Sun, 24 Dec 2017 12:09:23 -0500 Subject: [PATCH] boy do i feel stupid. fixes #1022 --- src/generators/nodes/Element.ts | 2 +- .../samples/option-without-select/_config.js | 16 ++++++++++++++++ .../samples/option-without-select/main.html | 1 + 3 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 test/runtime/samples/option-without-select/_config.js create mode 100644 test/runtime/samples/option-without-select/main.html diff --git a/src/generators/nodes/Element.ts b/src/generators/nodes/Element.ts index e4c47cb52f..f3d87ab2b1 100644 --- a/src/generators/nodes/Element.ts +++ b/src/generators/nodes/Element.ts @@ -55,7 +55,7 @@ export default class Element extends Node { attribute.name === 'value' ) { let select = this.parent; - while (select && select.type !== 'Element' || select.name !== 'select') select = select.parent; + while (select && (select.type !== 'Element' || select.name !== 'select')) select = select.parent; if (select && select.selectBindingDependencies) { select.selectBindingDependencies.forEach(prop => { diff --git a/test/runtime/samples/option-without-select/_config.js b/test/runtime/samples/option-without-select/_config.js new file mode 100644 index 0000000000..dbb156fad1 --- /dev/null +++ b/test/runtime/samples/option-without-select/_config.js @@ -0,0 +1,16 @@ +export default { + solo: true, + + data: { + foo: 'hello' + }, + + html: ``, + + test(assert, component, target) { + component.set({ foo: 'goodbye' }); + assert.htmlEqual(target.innerHTML, ` + + `); + } +}; \ No newline at end of file diff --git a/test/runtime/samples/option-without-select/main.html b/test/runtime/samples/option-without-select/main.html new file mode 100644 index 0000000000..36c101d13d --- /dev/null +++ b/test/runtime/samples/option-without-select/main.html @@ -0,0 +1 @@ + \ No newline at end of file