Skip to content

Commit 9c45ee8

Browse files
committed
fix: make async event trigger methods public
fixes #553
1 parent 315b1da commit 9c45ee8

15 files changed

Lines changed: 160 additions & 104 deletions

src/bunit.web/EventDispatchExtensions/ClipboardEventDispatchExtensions.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public static class ClipboardEventDispatchExtensions
2323
/// </summary>
2424
/// <param name="element">The element to raise the event on.</param>
2525
/// <returns>A task that completes when the event handler is done.</returns>
26-
private static Task BeforeCopyAsync(this IElement element) => element.TriggerEventAsync("onbeforecopy", EventArgs.Empty);
26+
public static Task BeforeCopyAsync(this IElement element) => element.TriggerEventAsync("onbeforecopy", EventArgs.Empty);
2727

2828
/// <summary>
2929
/// Raises the <c>@onbeforecut</c> event on <paramref name="element"/>, passing an empty (<see cref="EventArgs.Empty"/>)
@@ -38,7 +38,7 @@ public static class ClipboardEventDispatchExtensions
3838
/// </summary>
3939
/// <param name="element">The element to raise the event on.</param>
4040
/// <returns>A task that completes when the event handler is done.</returns>
41-
private static Task BeforeCutAsync(this IElement element) => element.TriggerEventAsync("onbeforecut", EventArgs.Empty);
41+
public static Task BeforeCutAsync(this IElement element) => element.TriggerEventAsync("onbeforecut", EventArgs.Empty);
4242

4343
/// <summary>
4444
/// Raises the <c>@onbeforepaste</c> event on <paramref name="element"/>, passing an empty (<see cref="EventArgs.Empty"/>)
@@ -53,7 +53,7 @@ public static class ClipboardEventDispatchExtensions
5353
/// </summary>
5454
/// <param name="element">The element to raise the event on.</param>
5555
/// <returns>A task that completes when the event handler is done.</returns>
56-
private static Task BeforePasteAsync(this IElement element) => element.TriggerEventAsync("onbeforepaste", EventArgs.Empty);
56+
public static Task BeforePasteAsync(this IElement element) => element.TriggerEventAsync("onbeforepaste", EventArgs.Empty);
5757

5858
/// <summary>
5959
/// Raises the <c>@oncopy</c> event on <paramref name="element"/>, passing the provided
@@ -78,7 +78,7 @@ public static class ClipboardEventDispatchExtensions
7878
/// <param name="element">The element to raise the event on.</param>
7979
/// <param name="eventArgs">The event arguments to pass to the event handler.</param>
8080
/// <returns>A task that completes when the event handler is done.</returns>
81-
private static Task CopyAsync(this IElement element, ClipboardEventArgs eventArgs) => element.TriggerEventAsync("oncopy", eventArgs);
81+
public static Task CopyAsync(this IElement element, ClipboardEventArgs eventArgs) => element.TriggerEventAsync("oncopy", eventArgs);
8282

8383
/// <summary>
8484
/// Raises the <c>@oncut</c> event on <paramref name="element"/>, passing the provided
@@ -103,7 +103,7 @@ public static class ClipboardEventDispatchExtensions
103103
/// <param name="element">The element to raise the event on.</param>
104104
/// <param name="eventArgs">The event arguments to pass to the event handler.</param>
105105
/// <returns>A task that completes when the event handler is done.</returns>
106-
private static Task CutAsync(this IElement element, ClipboardEventArgs eventArgs) => element.TriggerEventAsync("oncut", eventArgs);
106+
public static Task CutAsync(this IElement element, ClipboardEventArgs eventArgs) => element.TriggerEventAsync("oncut", eventArgs);
107107

108108
/// <summary>
109109
/// Raises the <c>@onpaste</c> event on <paramref name="element"/>, passing the provided
@@ -128,6 +128,6 @@ public static class ClipboardEventDispatchExtensions
128128
/// <param name="element">The element to raise the event on.</param>
129129
/// <param name="eventArgs">The event arguments to pass to the event handler.</param>
130130
/// <returns>A task that completes when the event handler is done.</returns>
131-
private static Task PasteAsync(this IElement element, ClipboardEventArgs eventArgs) => element.TriggerEventAsync("onpaste", eventArgs);
131+
public static Task PasteAsync(this IElement element, ClipboardEventArgs eventArgs) => element.TriggerEventAsync("onpaste", eventArgs);
132132
}
133133
}

src/bunit.web/EventDispatchExtensions/DetailsElementEventDispatchExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public static void Toggle(this IElement element)
2525
/// <param name="element">The element to raise the event on.</param>
2626
/// <param name="eventArgs">The event arguments to pass to the event handler.</param>
2727
/// <returns>A task that completes when the event handler is done.</returns>
28-
private static Task ToggleAsync(this IElement element, EventArgs eventArgs) => element.TriggerEventAsync("ontoggle", eventArgs);
28+
public static Task ToggleAsync(this IElement element, EventArgs eventArgs) => element.TriggerEventAsync("ontoggle", eventArgs);
2929
}
3030
}
3131
#endif

src/bunit.web/EventDispatchExtensions/DragEventDispatchExtensions.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public static void Drag(this IElement element, long detail = default, double scr
5656
/// <param name="element">The element to raise the event on.</param>
5757
/// <param name="eventArgs">The event arguments to pass to the event handler.</param>
5858
/// <returns>A task that completes when the event handler is done.</returns>
59-
private static Task DragAsync(this IElement element, DragEventArgs eventArgs) => element.TriggerEventAsync("ondrag", eventArgs);
59+
public static Task DragAsync(this IElement element, DragEventArgs eventArgs) => element.TriggerEventAsync("ondrag", eventArgs);
6060

6161
/// <summary>
6262
/// Raises the <c>@ondragend</c> event on <paramref name="element"/>, passing the provided
@@ -105,7 +105,7 @@ public static void DragEnd(this IElement element, long detail = default, double
105105
/// <param name="element">The element to raise the event on.</param>
106106
/// <param name="eventArgs">The event arguments to pass to the event handler.</param>
107107
/// <returns>A task that completes when the event handler is done.</returns>
108-
private static Task DragEndAsync(this IElement element, DragEventArgs eventArgs) => element.TriggerEventAsync("ondragend", eventArgs);
108+
public static Task DragEndAsync(this IElement element, DragEventArgs eventArgs) => element.TriggerEventAsync("ondragend", eventArgs);
109109

110110
/// <summary>
111111
/// Raises the <c>@ondragenter</c> event on <paramref name="element"/>, passing the provided
@@ -154,7 +154,7 @@ public static void DragEnter(this IElement element, long detail = default, doubl
154154
/// <param name="element">The element to raise the event on.</param>
155155
/// <param name="eventArgs">The event arguments to pass to the event handler.</param>
156156
/// <returns>A task that completes when the event handler is done.</returns>
157-
private static Task DragEnterAsync(this IElement element, DragEventArgs eventArgs) => element.TriggerEventAsync("ondragenter", eventArgs);
157+
public static Task DragEnterAsync(this IElement element, DragEventArgs eventArgs) => element.TriggerEventAsync("ondragenter", eventArgs);
158158

159159
/// <summary>
160160
/// Raises the <c>@ondragleave</c> event on <paramref name="element"/>, passing the provided
@@ -203,7 +203,7 @@ public static void DragLeave(this IElement element, long detail = default, doubl
203203
/// <param name="element">The element to raise the event on.</param>
204204
/// <param name="eventArgs">The event arguments to pass to the event handler.</param>
205205
/// <returns>A task that completes when the event handler is done.</returns>
206-
private static Task DragLeaveAsync(this IElement element, DragEventArgs eventArgs) => element.TriggerEventAsync("ondragleave", eventArgs);
206+
public static Task DragLeaveAsync(this IElement element, DragEventArgs eventArgs) => element.TriggerEventAsync("ondragleave", eventArgs);
207207

208208
/// <summary>
209209
/// Raises the <c>@ondragover</c> event on <paramref name="element"/>, passing the provided
@@ -252,7 +252,7 @@ public static void DragOver(this IElement element, long detail = default, double
252252
/// <param name="element">The element to raise the event on.</param>
253253
/// <param name="eventArgs">The event arguments to pass to the event handler.</param>
254254
/// <returns>A task that completes when the event handler is done.</returns>
255-
private static Task DragOverAsync(this IElement element, DragEventArgs eventArgs) => element.TriggerEventAsync("ondragover", eventArgs);
255+
public static Task DragOverAsync(this IElement element, DragEventArgs eventArgs) => element.TriggerEventAsync("ondragover", eventArgs);
256256

257257
/// <summary>
258258
/// Raises the <c>@ondragstart</c> event on <paramref name="element"/>, passing the provided
@@ -301,7 +301,7 @@ public static void DragStart(this IElement element, long detail = default, doubl
301301
/// <param name="element">The element to raise the event on.</param>
302302
/// <param name="eventArgs">The event arguments to pass to the event handler.</param>
303303
/// <returns>A task that completes when the event handler is done.</returns>
304-
private static Task DragStartAsync(this IElement element, DragEventArgs eventArgs) => element.TriggerEventAsync("ondragstart", eventArgs);
304+
public static Task DragStartAsync(this IElement element, DragEventArgs eventArgs) => element.TriggerEventAsync("ondragstart", eventArgs);
305305

306306
/// <summary>
307307
/// Raises the <c>@ondrop</c> event on <paramref name="element"/>, passing the provided
@@ -350,6 +350,6 @@ public static void Drop(this IElement element, long detail = default, double scr
350350
/// <param name="element">The element to raise the event on.</param>
351351
/// <param name="eventArgs">The event arguments to pass to the event handler.</param>
352352
/// <returns>A task that completes when the event handler is done.</returns>
353-
private static Task DropAsync(this IElement element, DragEventArgs eventArgs) => element.TriggerEventAsync("ondrop", eventArgs);
353+
public static Task DropAsync(this IElement element, DragEventArgs eventArgs) => element.TriggerEventAsync("ondrop", eventArgs);
354354
}
355355
}

src/bunit.web/EventDispatchExtensions/FocusEventDispatchExtensions.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public static class FocusEventDispatchExtensions
3232
/// <param name="element">The element to raise the event on.</param>
3333
/// <param name="eventArgs">The event arguments to pass the event handler.</param>
3434
/// <returns>A task that completes when the event handler is done.</returns>
35-
private static Task FocusAsync(this IElement element, FocusEventArgs eventArgs) => element.TriggerEventAsync("onfocus", eventArgs);
35+
public static Task FocusAsync(this IElement element, FocusEventArgs eventArgs) => element.TriggerEventAsync("onfocus", eventArgs);
3636

3737
/// <summary>
3838
/// Raises the <c>@onblur</c> event on <paramref name="element"/>, passing the provided
@@ -57,7 +57,7 @@ public static class FocusEventDispatchExtensions
5757
/// <param name="element">The element to raise the event on.</param>
5858
/// <param name="eventArgs">The event arguments to pass the event handler.</param>
5959
/// <returns>A task that completes when the event handler is done.</returns>
60-
private static Task BlurAsync(this IElement element, FocusEventArgs eventArgs) => element.TriggerEventAsync("onblur", eventArgs);
60+
public static Task BlurAsync(this IElement element, FocusEventArgs eventArgs) => element.TriggerEventAsync("onblur", eventArgs);
6161

6262
/// <summary>
6363
/// Raises the <c>@onfocusin</c> event on <paramref name="element"/>, passing the provided
@@ -82,7 +82,7 @@ public static class FocusEventDispatchExtensions
8282
/// <param name="element">The element to raise the event on.</param>
8383
/// <param name="eventArgs">The event arguments to pass the event handler.</param>
8484
/// <returns>A task that completes when the event handler is done.</returns>
85-
private static Task FocusInAsync(this IElement element, FocusEventArgs eventArgs) => element.TriggerEventAsync("onfocusin", eventArgs);
85+
public static Task FocusInAsync(this IElement element, FocusEventArgs eventArgs) => element.TriggerEventAsync("onfocusin", eventArgs);
8686

8787
/// <summary>
8888
/// Raises the <c>@onfocusout</c> event on <paramref name="element"/>, passing the provided
@@ -107,6 +107,6 @@ public static class FocusEventDispatchExtensions
107107
/// <param name="element">The element to raise the event on.</param>
108108
/// <param name="eventArgs">The event arguments to pass the event handler.</param>
109109
/// <returns>A task that completes when the event handler is done.</returns>
110-
private static Task FocusOutAsync(this IElement element, FocusEventArgs eventArgs) => element.TriggerEventAsync("onfocusout", eventArgs);
110+
public static Task FocusOutAsync(this IElement element, FocusEventArgs eventArgs) => element.TriggerEventAsync("onfocusout", eventArgs);
111111
}
112112
}

src/bunit.web/EventDispatchExtensions/GeneralEventDispatchExtensions.cs

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public static class GeneralEventDispatchExtensions
2222
/// </summary>
2323
/// <param name="element">The element to raise the event on.</param>
2424
/// <returns>A task that completes when the event handler is done.</returns>
25-
private static Task ActivateAsync(this IElement element) => element.TriggerEventAsync("onactivate", EventArgs.Empty);
25+
public static Task ActivateAsync(this IElement element) => element.TriggerEventAsync("onactivate", EventArgs.Empty);
2626

2727
/// <summary>
2828
/// Raises the <c>@onbeforeactivate</c> event on <paramref name="element"/>, passing an empty (<see cref="EventArgs.Empty"/>)
@@ -37,7 +37,7 @@ public static class GeneralEventDispatchExtensions
3737
/// </summary>
3838
/// <param name="element">The element to raise the event on.</param>
3939
/// <returns>A task that completes when the event handler is done.</returns>
40-
private static Task BeforeActivateAsync(this IElement element) => element.TriggerEventAsync("onbeforeactivate", EventArgs.Empty);
40+
public static Task BeforeActivateAsync(this IElement element) => element.TriggerEventAsync("onbeforeactivate", EventArgs.Empty);
4141

4242
/// <summary>
4343
/// Raises the <c>@onbeforedeactivate</c> event on <paramref name="element"/>, passing an empty (<see cref="EventArgs.Empty"/>)
@@ -52,7 +52,7 @@ public static class GeneralEventDispatchExtensions
5252
/// </summary>
5353
/// <param name="element">The element to raise the event on.</param>
5454
/// <returns>A task that completes when the event handler is done.</returns>
55-
private static Task BeforeDeactivateAsync(this IElement element) => element.TriggerEventAsync("onbeforedeactivate", EventArgs.Empty);
55+
public static Task BeforeDeactivateAsync(this IElement element) => element.TriggerEventAsync("onbeforedeactivate", EventArgs.Empty);
5656

5757
/// <summary>
5858
/// Raises the <c>@ondeactivate</c> event on <paramref name="element"/>, passing an empty (<see cref="EventArgs.Empty"/>)
@@ -67,7 +67,7 @@ public static class GeneralEventDispatchExtensions
6767
/// </summary>
6868
/// <param name="element">The element to raise the event on.</param>
6969
/// <returns>A task that completes when the event handler is done.</returns>
70-
private static Task DeactivateAsync(this IElement element) => element.TriggerEventAsync("ondeactivate", EventArgs.Empty);
70+
public static Task DeactivateAsync(this IElement element) => element.TriggerEventAsync("ondeactivate", EventArgs.Empty);
7171

7272
/// <summary>
7373
/// Raises the <c>@onended</c> event on <paramref name="element"/>, passing an empty (<see cref="EventArgs.Empty"/>)
@@ -82,7 +82,7 @@ public static class GeneralEventDispatchExtensions
8282
/// </summary>
8383
/// <param name="element">The element to raise the event on.</param>
8484
/// <returns>A task that completes when the event handler is done.</returns>
85-
private static Task EndedAsync(this IElement element) => element.TriggerEventAsync("onended", EventArgs.Empty);
85+
public static Task EndedAsync(this IElement element) => element.TriggerEventAsync("onended", EventArgs.Empty);
8686

8787
/// <summary>
8888
/// Raises the <c>@onfullscreenchange</c> event on <paramref name="element"/>, passing an empty (<see cref="EventArgs.Empty"/>)
@@ -97,7 +97,7 @@ public static class GeneralEventDispatchExtensions
9797
/// </summary>
9898
/// <param name="element">The element to raise the event on.</param>
9999
/// <returns>A task that completes when the event handler is done.</returns>
100-
private static Task FullscreenChangeAsync(this IElement element) => element.TriggerEventAsync("onfullscreenchange", EventArgs.Empty);
100+
public static Task FullscreenChangeAsync(this IElement element) => element.TriggerEventAsync("onfullscreenchange", EventArgs.Empty);
101101

102102
/// <summary>
103103
/// Raises the <c>@onfullscreenerror</c> event on <paramref name="element"/>, passing an empty (<see cref="EventArgs.Empty"/>)
@@ -112,7 +112,7 @@ public static class GeneralEventDispatchExtensions
112112
/// </summary>
113113
/// <param name="element">The element to raise the event on.</param>
114114
/// <returns>A task that completes when the event handler is done.</returns>
115-
private static Task FullscreenErrorAsync(this IElement element) => element.TriggerEventAsync("onfullscreenerror", EventArgs.Empty);
115+
public static Task FullscreenErrorAsync(this IElement element) => element.TriggerEventAsync("onfullscreenerror", EventArgs.Empty);
116116

117117
/// <summary>
118118
/// Raises the <c>@onloadeddata</c> event on <paramref name="element"/>, passing an empty (<see cref="EventArgs.Empty"/>)
@@ -127,7 +127,7 @@ public static class GeneralEventDispatchExtensions
127127
/// </summary>
128128
/// <param name="element">The element to raise the event on.</param>
129129
/// <returns>A task that completes when the event handler is done.</returns>
130-
private static Task LoadedDataAsync(this IElement element) => element.TriggerEventAsync("onloadeddata", EventArgs.Empty);
130+
public static Task LoadedDataAsync(this IElement element) => element.TriggerEventAsync("onloadeddata", EventArgs.Empty);
131131

132132
/// <summary>
133133
/// Raises the <c>@onloadedmetadata</c> event on <paramref name="element"/>, passing an empty (<see cref="EventArgs.Empty"/>)
@@ -142,7 +142,7 @@ public static class GeneralEventDispatchExtensions
142142
/// </summary>
143143
/// <param name="element">The element to raise the event on.</param>
144144
/// <returns>A task that completes when the event handler is done.</returns>
145-
private static Task LoadedMetadataAsync(this IElement element) => element.TriggerEventAsync("onloadedmetadata", EventArgs.Empty);
145+
public static Task LoadedMetadataAsync(this IElement element) => element.TriggerEventAsync("onloadedmetadata", EventArgs.Empty);
146146

147147
/// <summary>
148148
/// Raises the <c>@onpointerlockchange</c> event on <paramref name="element"/>, passing an empty (<see cref="EventArgs.Empty"/>)
@@ -157,7 +157,7 @@ public static class GeneralEventDispatchExtensions
157157
/// </summary>
158158
/// <param name="element">The element to raise the event on.</param>
159159
/// <returns>A task that completes when the event handler is done.</returns>
160-
private static Task PointerlockChangeAsync(this IElement element) => element.TriggerEventAsync("onpointerlockchange", EventArgs.Empty);
160+
public static Task PointerlockChangeAsync(this IElement element) => element.TriggerEventAsync("onpointerlockchange", EventArgs.Empty);
161161

162162
/// <summary>
163163
/// Raises the <c>@onpointerlockerror</c> event on <paramref name="element"/>, passing an empty (<see cref="EventArgs.Empty"/>)
@@ -172,7 +172,7 @@ public static class GeneralEventDispatchExtensions
172172
/// </summary>
173173
/// <param name="element">The element to raise the event on.</param>
174174
/// <returns>A task that completes when the event handler is done.</returns>
175-
private static Task PointerlockErrorAsync(this IElement element) => element.TriggerEventAsync("onpointerlockerror", EventArgs.Empty);
175+
public static Task PointerlockErrorAsync(this IElement element) => element.TriggerEventAsync("onpointerlockerror", EventArgs.Empty);
176176

177177
/// <summary>
178178
/// Raises the <c>@onreadystatechange</c> event on <paramref name="element"/>, passing an empty (<see cref="EventArgs.Empty"/>)
@@ -187,7 +187,7 @@ public static class GeneralEventDispatchExtensions
187187
/// </summary>
188188
/// <param name="element">The element to raise the event on.</param>
189189
/// <returns>A task that completes when the event handler is done.</returns>
190-
private static Task ReadystateChangeAsync(this IElement element) => element.TriggerEventAsync("onreadystatechange", EventArgs.Empty);
190+
public static Task ReadystateChangeAsync(this IElement element) => element.TriggerEventAsync("onreadystatechange", EventArgs.Empty);
191191

192192
/// <summary>
193193
/// Raises the <c>@onscroll</c> event on <paramref name="element"/>, passing an empty (<see cref="EventArgs.Empty"/>)
@@ -202,6 +202,6 @@ public static class GeneralEventDispatchExtensions
202202
/// </summary>
203203
/// <param name="element">The element to raise the event on.</param>
204204
/// <returns>A task that completes when the event handler is done.</returns>
205-
private static Task ScrollAsync(this IElement element) => element.TriggerEventAsync("onscroll", EventArgs.Empty);
205+
public static Task ScrollAsync(this IElement element) => element.TriggerEventAsync("onscroll", EventArgs.Empty);
206206
}
207207
}

0 commit comments

Comments
 (0)