aboutsummaryrefslogtreecommitdiffstats
path: root/src/dstr-assignment/obj-rest-computed-property.case
blob: e9f102cffe51a8dd702bdc0192cc2e4460495d39 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
// 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";
var b, rest;
//- 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
});