This repository was archived by the owner on Apr 1, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 160
Expand file tree
/
Copy pathTestChildFlushing.hack
More file actions
76 lines (66 loc) · 2.19 KB
/
TestChildFlushing.hack
File metadata and controls
76 lines (66 loc) · 2.19 KB
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
/*
* Copyright (c) 2004-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*/
use namespace Facebook\XHP\Core as x;
use type Facebook\XHP\HTML\div;
use function Facebook\FBExpect\expect;
use type Facebook\HackTest\DataProvider;
final xhp class test:verbatim_root extends x\element {
attribute x\node root @required;
<<__Override>>
protected async function renderAsync(): Awaitable<x\node> {
return $this->:root;
}
}
final xhp class test:verbatim_root:async extends x\element {
attribute x\node root @required;
<<__Override>>
protected async function renderAsync(): Awaitable<x\node> {
return $this->:root;
}
}
final class XHPChildFlushTest extends Facebook\HackTest\HackTest {
public function xhpRootProvider(): vec<(x\node, string)> {
return vec[
tuple(<div />, '<div></div>'),
tuple(<div><div /><div /></div>, '<div><div></div><div></div></div>'),
tuple(<test:verbatim_root root={<div />} />, '<div></div>'),
tuple(<x:frag><div /></x:frag>, '<div></div>'),
tuple(<x:frag><div /><div /></x:frag>, '<div></div><div></div>'),
tuple(
<test:verbatim_root root={<x:frag><div /><div /></x:frag>} />,
'<div></div><div></div>',
),
tuple(
<test:verbatim_root root={<test:verbatim_root root={<div />} />} />,
'<div></div>',
),
tuple(<test:verbatim_root:async root={<div />} />, '<div></div>'),
];
}
<<DataProvider('xhpRootProvider')>>
public async function testSynchronous(
x\node $root,
string $expected,
): Awaitable<void> {
/*HH_FIXME[4314] Attribute :root is not provided*/
$elem = <test:verbatim_root />;
$elem->setContext('root', $root);
expect(await $elem->toStringAsync())->toEqual($expected);
}
<<DataProvider('xhpRootProvider')>>
public async function testAsynchronous(
x\node $root,
string $expected,
): Awaitable<void> {
/*HH_FIXME[4314] Attribute :root is not provided*/
$elem = <test:verbatim_root:async />;
$elem->setContext('root', $root);
expect(await $elem->toStringAsync())->toEqual($expected);
}
}