forked from zloirock/core-js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathes.object.values.js
30 lines (29 loc) · 975 Bytes
/
es.object.values.js
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
import { values, create, assign } from 'core-js-pure/features/object';
QUnit.test('Object.values', assert => {
assert.isFunction(values);
assert.arity(values, 1);
assert.name(values, 'values');
assert.deepEqual(values({ q: 1, w: 2, e: 3 }), [1, 2, 3]);
assert.deepEqual(values(new String('qwe')), ['q', 'w', 'e']);
assert.deepEqual(values(assign(create({ q: 1, w: 2, e: 3 }), { a: 4, s: 5, d: 6 })), [4, 5, 6]);
assert.deepEqual(values({ valueOf: 42 }), [42], 'IE enum keys bug');
try {
assert.deepEqual(Function('values', `
return values({ a: 1, get b() {
delete this.c;
return 2;
}, c: 3 });
`)(values), [1, 2]);
} catch { /* empty */ }
try {
assert.deepEqual(Function('values', `
return values({ a: 1, get b() {
Object.defineProperty(this, "c", {
value: 4,
enumerable: false
});
return 2;
}, c: 3 });
`)(values), [1, 2]);
} catch { /* empty */ }
});