From d00bd8ac674dd8dffac501fa1f2f21f7e2253baf Mon Sep 17 00:00:00 2001 From: Tobias Davis Date: Tue, 18 Apr 2017 15:35:06 -0500 Subject: [PATCH] add failing test for bound select elements --- .../samples/select-bind-array/_config.js | 22 +++++++++++++++++++ .../samples/select-bind-array/main.html | 5 +++++ 2 files changed, 27 insertions(+) create mode 100644 test/runtime/samples/select-bind-array/_config.js create mode 100644 test/runtime/samples/select-bind-array/main.html diff --git a/test/runtime/samples/select-bind-array/_config.js b/test/runtime/samples/select-bind-array/_config.js new file mode 100644 index 0000000000..320dbc1187 --- /dev/null +++ b/test/runtime/samples/select-bind-array/_config.js @@ -0,0 +1,22 @@ +const items = [ { id: 'a' }, { id: 'b' } ]; + +export default { + 'skip-ssr': true, + + data: { + foo: 'b', + items + }, + + test ( assert, component, target ) { + const options = target.querySelectorAll( 'option' ); + + assert.equal( options[0].selected, false ); + assert.equal( options[1].selected, true ); + + component.set( { foo: items[0].id } ); + + assert.equal( options[0].selected, true ); + assert.equal( options[1].selected, false ); + } +}; diff --git a/test/runtime/samples/select-bind-array/main.html b/test/runtime/samples/select-bind-array/main.html new file mode 100644 index 0000000000..b277295c5f --- /dev/null +++ b/test/runtime/samples/select-bind-array/main.html @@ -0,0 +1,5 @@ +