From 2120a819583bb12e39660745e60c1e0eec025cd4 Mon Sep 17 00:00:00 2001 From: Rich Harris Date: Sun, 24 Dec 2017 12:09:23 -0500 Subject: [PATCH 1/2] 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 e4c47cb52fe9..f3d87ab2b137 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 000000000000..dbb156fad176 --- /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 000000000000..36c101d13dd3 --- /dev/null +++ b/test/runtime/samples/option-without-select/main.html @@ -0,0 +1 @@ + \ No newline at end of file From 6d9abe22196c3921ffb5dae6d2bd5378bf4bd2e5 Mon Sep 17 00:00:00 2001 From: Rich Harris Date: Sun, 24 Dec 2017 12:10:55 -0500 Subject: [PATCH 2/2] reenable tests --- test/runtime/samples/option-without-select/_config.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/test/runtime/samples/option-without-select/_config.js b/test/runtime/samples/option-without-select/_config.js index dbb156fad176..95c250458276 100644 --- a/test/runtime/samples/option-without-select/_config.js +++ b/test/runtime/samples/option-without-select/_config.js @@ -1,6 +1,4 @@ export default { - solo: true, - data: { foo: 'hello' },