From 35adcb2a7dc29b58e6b46219b8e4c521645a476c Mon Sep 17 00:00:00 2001 From: Caio Lima <ticaiolima@gmail.com> Date: Sat, 20 May 2017 19:43:20 -0300 Subject: [PATCH] Adding case to computed property --- .../obj-rest-computed-property.case | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 src/dstr-assignment/obj-rest-computed-property.case diff --git a/src/dstr-assignment/obj-rest-computed-property.case b/src/dstr-assignment/obj-rest-computed-property.case new file mode 100644 index 0000000000..75fff7e676 --- /dev/null +++ b/src/dstr-assignment/obj-rest-computed-property.case @@ -0,0 +1,38 @@ +// Copyright (C) 2017 Caio Lima. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +desc: > + Destructuring field can be a computed property, i.e it can be defined + only at runtime. Rest operantion needs to skip these properties as well. +template: default +esid: pending +includes: [propertyHelper.js] +features: [object-rest] +---*/ + +//- setup +var a = "foo"; +//- elems +{[a]:b, ...rest} +//- vals +{ foo: 1, bar: 2, baz: 3 } +//- body +assert.sameValue(b, 1); +assert.sameValue(rest.bar, 2); +assert.sameValue(rest.baz, 3); + +assert.sameValue(Object.getOwnPropertyDescriptor(rest, "foo"), undefined); + +verifyProperty(rest, "bar", { + enumerable: true, + writable: true, + configurable: true +}); + +verifyProperty(rest, "baz", { + enumerable: true, + writable: true, + configurable: true +}); + -- GitLab