@@ -13,7 +13,7 @@ public class FireEventTests
13
13
public async Task InvokeFunctionOnLoadEventShouldFireDelayed ( )
14
14
{
15
15
var service = new JsScriptingService ( ) ;
16
- var cfg = Configuration . Default . With ( service ) ;
16
+ var cfg = Configuration . Default . With ( service ) . WithEventLoop ( ) ;
17
17
var html = "<!doctype html><div id=result></div><script>document.addEventListener('load', function () { document.querySelector('#result').textContent = 'done'; }, false);</script>" ;
18
18
var document = await BrowsingContext . New ( cfg ) . OpenAsync ( m => m . Content ( html ) )
19
19
. WhenStable ( ) ;
@@ -25,7 +25,7 @@ public async Task InvokeFunctionOnLoadEventShouldFireDelayed()
25
25
public async Task InvokeFunctionOnCustomEvent ( )
26
26
{
27
27
var service = new JsScriptingService ( ) ;
28
- var cfg = Configuration . Default . With ( service ) ;
28
+ var cfg = Configuration . Default . With ( service ) . WithEventLoop ( ) ;
29
29
var html = "<!doctype html><div id=result>0</div><script>var i = 0; document.addEventListener('hello', function () { i++; document.querySelector('#result').textContent = i.toString(); }, false);</script>" ;
30
30
var document = await BrowsingContext . New ( cfg ) . OpenAsync ( m => m . Content ( html ) ) ;
31
31
var div = document . QuerySelector ( "#result" ) ;
@@ -39,7 +39,7 @@ public async Task InvokeFunctionOnCustomEvent()
39
39
public async Task InvokeLoadEventFromJsAndCustomEventFromJsAndCs ( )
40
40
{
41
41
var service = new JsScriptingService ( ) ;
42
- var cfg = Configuration . Default . With ( service ) ;
42
+ var cfg = Configuration . Default . With ( service ) . WithEventLoop ( ) ;
43
43
var html = @"<!doctype html>
44
44
<html>
45
45
<body>
@@ -73,7 +73,7 @@ public async Task InvokeLoadEventFromJsAndCustomEventFromJsAndCs()
73
73
public async Task AddClickHandlerClassicallyWillExecute ( )
74
74
{
75
75
var service = new JsScriptingService ( ) ;
76
- var cfg = Configuration . Default . With ( service ) ;
76
+ var cfg = Configuration . Default . With ( service ) . WithEventLoop ( ) ;
77
77
var html = @"<!doctype html>
78
78
<html>
79
79
<body>
@@ -94,7 +94,7 @@ public async Task AddClickHandlerClassicallyWillExecute()
94
94
public async Task AddAndRemoveClickHandlerWontExecute ( )
95
95
{
96
96
var service = new JsScriptingService ( ) ;
97
- var cfg = Configuration . Default . With ( service ) ;
97
+ var cfg = Configuration . Default . With ( service ) . WithEventLoop ( ) ;
98
98
var html = @"<!doctype html>
99
99
<html>
100
100
<body>
@@ -116,7 +116,7 @@ public async Task AddAndRemoveClickHandlerWontExecute()
116
116
public async Task AddAndInvokeClickHandlerWillChangeCapturedValue ( )
117
117
{
118
118
var service = new JsScriptingService ( ) ;
119
- var cfg = Configuration . Default . With ( service ) ;
119
+ var cfg = Configuration . Default . With ( service ) . WithEventLoop ( ) ;
120
120
var html = @"<!doctype html>
121
121
<html>
122
122
<body>
@@ -137,7 +137,7 @@ public async Task AddAndInvokeClickHandlerWillChangeCapturedValue()
137
137
public async Task AddAndInvokeClickHandlerWithStringFunctionWontWork ( )
138
138
{
139
139
var service = new JsScriptingService ( ) ;
140
- var cfg = Configuration . Default . With ( service ) ;
140
+ var cfg = Configuration . Default . With ( service ) . WithEventLoop ( ) ;
141
141
var html = @"<!doctype html>
142
142
<html>
143
143
<body>
@@ -155,7 +155,7 @@ public async Task AddAndInvokeClickHandlerWithStringFunctionWontWork()
155
155
[ Test ]
156
156
public async Task BodyOnloadWorksWhenSetAsAttributeInitially ( )
157
157
{
158
- var cfg = Configuration . Default . WithJs ( ) ;
158
+ var cfg = Configuration . Default . WithJs ( ) . WithEventLoop ( ) ;
159
159
var html = @"<!doctype html>
160
160
<html>
161
161
<body onload='window.foo = 2+3'>
@@ -173,7 +173,7 @@ public async Task BodyOnloadWorksWhenSetAsAttributeInitially()
173
173
[ Test ]
174
174
public async Task BodyOnloadWorksWhenSetAsAttributeLater ( )
175
175
{
176
- var cfg = Configuration . Default . WithJs ( ) ;
176
+ var cfg = Configuration . Default . WithJs ( ) . WithEventLoop ( ) ;
177
177
var html = @"<!doctype html>
178
178
<html>
179
179
<body>
@@ -192,7 +192,7 @@ public async Task BodyOnloadWorksWhenSetAsAttributeLater()
192
192
public async Task SetTimeoutWithNormalFunction ( )
193
193
{
194
194
var service = new JsScriptingService ( ) ;
195
- var cfg = Configuration . Default . With ( service ) ;
195
+ var cfg = Configuration . Default . With ( service ) . WithEventLoop ( ) ;
196
196
var html = @"<!doctype html>
197
197
<html>
198
198
<body>
@@ -214,7 +214,7 @@ public async Task DomContentLoadedEventIsFired_Issue50()
214
214
{
215
215
//TODO Check this as well on the window level - currently works
216
216
//only against document (se AngleSharp#789)
217
- var cfg = Configuration . Default . WithJs ( ) ;
217
+ var cfg = Configuration . Default . WithJs ( ) . WithEventLoop ( ) ;
218
218
var html = @"<!doctype html>
219
219
<html>
220
220
<body>
@@ -236,7 +236,7 @@ public async Task DomContentLoadedEventIsFired_Issue50()
236
236
[ Test ]
237
237
public async Task DocumentLoadEventIsFired_Issue42 ( )
238
238
{
239
- var cfg = Configuration . Default . WithJs ( ) ;
239
+ var cfg = Configuration . Default . WithJs ( ) . WithEventLoop ( ) ;
240
240
var html = @"<!doctype html>
241
241
<html>
242
242
<body>
@@ -260,7 +260,7 @@ public async Task DocumentLoadEventIsFired_Issue42()
260
260
public async Task SetTimeoutWithStringAsFunction ( )
261
261
{
262
262
var service = new JsScriptingService ( ) ;
263
- var cfg = Configuration . Default . With ( service ) ;
263
+ var cfg = Configuration . Default . With ( service ) . WithEventLoop ( ) ;
264
264
var html = @"<!doctype html>
265
265
<html>
266
266
<body>
0 commit comments