@@ -22,6 +22,18 @@ describe(`integration`, () => {
22
22
} ) ;
23
23
} ) ;
24
24
25
+ describe ( `hydrateWhenIdle()` , ( ) => {
26
+ test ( `It should hydrate the component when the browser is idle.` , async ( ) => {
27
+ await open ( `/integration.html` , { } ) ;
28
+
29
+ let moreText = await page . $ ( `.DummyIdle.wrapper .more` ) ;
30
+ expect ( moreText ) . toBe ( null ) ;
31
+
32
+ moreText = await find ( `.DummyIdle.wrapper .more` ) ;
33
+ expect ( moreText ) . not . toBe ( null ) ;
34
+ } ) ;
35
+ } ) ;
36
+
25
37
describe ( `<LazyHydrate when-visible>` , ( ) => {
26
38
test ( `It should hydrate the component when it becomes visible.` , async ( ) => {
27
39
await open ( `/integration.html` ) ;
@@ -38,6 +50,22 @@ describe(`integration`, () => {
38
50
} ) ;
39
51
} ) ;
40
52
53
+ describe ( `hydrateWhenVisible()` , ( ) => {
54
+ test ( `It should hydrate the component when it becomes visible.` , async ( ) => {
55
+ await open ( `/integration.html` ) ;
56
+
57
+ let moreText = await page . $ ( `.DummyVisible.wrapper .more` ) ;
58
+ expect ( moreText ) . toBe ( null ) ;
59
+
60
+ await page . evaluate ( ( ) => {
61
+ document . querySelector ( `.DummyVisible.wrapper` ) . scrollIntoView ( ) ;
62
+ } ) ;
63
+
64
+ moreText = await find ( `.DummyVisible.wrapper .more` ) ;
65
+ expect ( moreText ) . not . toBe ( null ) ;
66
+ } ) ;
67
+ } ) ;
68
+
41
69
describe ( `<LazyHydrate on-interaction>` , ( ) => {
42
70
test ( `It should hydrate the component when an interaction happens.` , async ( ) => {
43
71
await open ( `/integration.html` ) ;
@@ -55,6 +83,23 @@ describe(`integration`, () => {
55
83
} ) ;
56
84
} ) ;
57
85
86
+ describe ( `hydrateOnInteraction()` , ( ) => {
87
+ test ( `It should hydrate the component when an interaction happens.` , async ( ) => {
88
+ await open ( `/integration.html` ) ;
89
+
90
+ let moreText = await page . $ ( `.DummyInteraction.wrapper .more` ) ;
91
+ expect ( moreText ) . toBe ( null ) ;
92
+
93
+ let button = await find ( `.DummyInteraction.wrapper button` ) ;
94
+ await button . click ( ) ;
95
+ button = await find ( `.DummyInteraction.wrapper button` ) ;
96
+ await button . click ( ) ;
97
+
98
+ moreText = await find ( `.DummyInteraction.wrapper .more` ) ;
99
+ expect ( moreText ) . not . toBe ( null ) ;
100
+ } ) ;
101
+ } ) ;
102
+
58
103
describe ( `<LazyHydrate never>` , ( ) => {
59
104
test ( `It should not hydrate the component.` , async ( ) => {
60
105
await open ( `/integration.html` ) ;
@@ -66,4 +111,16 @@ describe(`integration`, () => {
66
111
expect ( moreText ) . toBe ( null ) ;
67
112
} ) ;
68
113
} ) ;
114
+
115
+ describe ( `hydrateNever()` , ( ) => {
116
+ test ( `It should not hydrate the component.` , async ( ) => {
117
+ await open ( `/integration.html` ) ;
118
+
119
+ const component = await find ( `.DummySsr.wrapper` ) ;
120
+ expect ( component ) . not . toBe ( null ) ;
121
+
122
+ const moreText = await page . $ ( `.DummySsr.wrapper .more` ) ;
123
+ expect ( moreText ) . toBe ( null ) ;
124
+ } ) ;
125
+ } ) ;
69
126
} ) ;
0 commit comments