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
40
41
42
43
44
45
46
47
48
|
'use strict';
// Copyright (C) 2018 Shilpi Jain and Michael Ficarra. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-array.prototype.flatMap
description: >
Behavior when thisArg is provided
Array.prototype.flatMap ( mapperFunction [ , thisArg ] )
flags: [onlyStrict]
includes: [compareArray.js]
features: [Array.prototype.flatMap]
---*/
var a = {};
var actual;
actual = [1].flatMap(function() {
return [this];
}, "TestString");
assert.compareArray(actual, ["TestString"], 'The value of actual is expected to be ["TestString"]');
actual = [1].flatMap(function() {
return [this];
}, 1);
assert.compareArray(actual, [1], 'The value of actual is expected to be [1]');
actual = [1].flatMap(function() {
return [this];
}, null);
assert.compareArray(actual, [null], 'The value of actual is expected to be [null]');
actual = [1].flatMap(function() {
return [this];
}, true);
assert.compareArray(actual, [true], 'The value of actual is expected to be [true]');
actual = [1].flatMap(function() {
return [this];
}, a);
assert.compareArray(actual, [a], 'The value of actual is expected to be [a]');
actual = [1].flatMap(function() {
return [this];
}, void 0);
assert.compareArray(actual, [undefined], 'The value of actual is expected to be [undefined]');
reportCompare(0, 0);
|