Skip to content

Commit f0aed01

Browse files
committed
fix: Remove unused Task<IElement> overloads
1 parent 4ca67ad commit f0aed01

File tree

3 files changed

+0
-80
lines changed

3 files changed

+0
-80
lines changed

src/bunit.generators.internal/Blazor/EventDispatcherExtensionGenerator.cs

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -202,19 +202,5 @@ private static void GenerateAsyncEventMethodWithDefaultArgs(StringBuilder source
202202
sourceBuilder.AppendLine("\t/// <returns>A task that completes when the event handler is done.</returns>");
203203
sourceBuilder.AppendLine($"\tpublic static Task {methodName}Async(this IElement element, {eventArgsType}? eventArgs = null) => element.TriggerEventAsync(\"{eventName}\", eventArgs ?? {defaultArgs});");
204204
sourceBuilder.AppendLine();
205-
206-
sourceBuilder.AppendLine("\t/// <summary>");
207-
sourceBuilder.AppendLine($"\t/// Raises the <c>@{eventName}</c> event on the element returned by <paramref name=\"elementTask\"/>, passing the provided <paramref name=\"eventArgs\"/>");
208-
sourceBuilder.AppendLine($"\t/// to the event handler. If <paramref name=\"eventArgs\"/> is null, a new instance of {eventArgsType} will be created.");
209-
sourceBuilder.AppendLine("\t/// </summary>");
210-
sourceBuilder.AppendLine("\t/// <param name=\"elementTask\">A task that returns the element to raise the element on.</param>");
211-
sourceBuilder.AppendLine("\t/// <param name=\"eventArgs\">The event arguments to pass to the event handler.</param>");
212-
sourceBuilder.AppendLine("\t/// <returns>A task that completes when the event handler is done.</returns>");
213-
sourceBuilder.AppendLine($"\tpublic static async Task {methodName}Async(this Task<IElement> elementTask, {eventArgsType}? eventArgs = null)");
214-
sourceBuilder.AppendLine("\t{");
215-
sourceBuilder.AppendLine("\t\tvar element = await elementTask;");
216-
sourceBuilder.AppendLine($"\t\tawait {methodName}Async(element, eventArgs);");
217-
sourceBuilder.AppendLine("\t}");
218-
sourceBuilder.AppendLine();
219205
}
220206
}

src/bunit/EventDispatchExtensions/InputEventDispatchExtensions.cs

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,6 @@ public static partial class EventHandlerDispatchExtensions
1717
public static void Change<T>(this IElement element, T value)
1818
=> _ = ChangeAsync(element, CreateFrom(value));
1919

20-
/// <summary>
21-
/// Raises the <c>@onchange</c> event on the element returned by <paramref name="elementTask"/>, passing the provided
22-
/// properties to the event handler via a <see cref="ChangeEventArgs"/> object.
23-
/// </summary>
24-
/// <param name="elementTask">A task that returns the element to raise the event on.</param>
25-
/// <param name="value">The new value.</param>
26-
public static async Task ChangeAsync<T>(this Task<IElement> elementTask, T value)
27-
{
28-
var element = await elementTask;
29-
await ChangeAsync(element, CreateFrom(value));
30-
}
31-
3220
/// <summary>
3321
/// Raises the <c>@oninput</c> event on <paramref name="element"/>, passing the provided
3422
/// properties to the event handler via a <see cref="ChangeEventArgs"/> object.
@@ -38,18 +26,6 @@ public static async Task ChangeAsync<T>(this Task<IElement> elementTask, T value
3826
public static void Input<T>(this IElement element, T value)
3927
=> _ = InputAsync(element, CreateFrom(value));
4028

41-
/// <summary>
42-
/// Raises the <c>@oninput</c> event on the element returned by <paramref name="elementTask"/>, passing the provided
43-
/// properties to the event handler via a <see cref="ChangeEventArgs"/> object.
44-
/// </summary>
45-
/// <param name="elementTask">A task that returns the element to raise the event on.</param>
46-
/// <param name="value">The new value.</param>
47-
public static async Task InputAsync<T>(this Task<IElement> elementTask, T value)
48-
{
49-
var element = await elementTask;
50-
await InputAsync(element, CreateFrom(value));
51-
}
52-
5329
private static ChangeEventArgs CreateFrom<T>(T value) => new() { Value = FormatValue(value) };
5430

5531
private static object? FormatValue<T>(T value)

src/bunit/EventDispatchExtensions/KeyboardEventDispatchExtensions.cs

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -39,20 +39,6 @@ public static Task KeyDownAsync(this IElement element, Key key, bool repeat = de
3939
return KeyDownAsync(element, eventArgs);
4040
}
4141

42-
/// <summary>
43-
/// Raises the <c>@onkeydown</c> event on <paramref name="elementTask"/>, passing the provided <paramref name="key"/>
44-
/// to the event handler.
45-
/// </summary>
46-
/// <param name="elementTask">The element to raise the event on.</param>
47-
/// <param name="key">The keyboard key to pass to the event handler.</param>
48-
/// <param name="repeat"><c>true</c> if a key has been depressed long enough to trigger key repetition, otherwise <c>false</c>.</param>
49-
/// <param name="type">The type of the event.</param>
50-
public static async Task KeyDownAsync(this Task<IElement> elementTask, Key key, bool repeat = default, string? type = default)
51-
{
52-
var element = await elementTask;
53-
await KeyDownAsync(element, key, repeat, type);
54-
}
55-
5642
/// <summary>
5743
/// Raises the <c>@onkeyup</c> event on <paramref name="element"/>, passing the provided <paramref name="key"/>
5844
/// to the event handler.
@@ -85,20 +71,6 @@ public static Task KeyUpAsync(this IElement element, Key key, bool repeat = defa
8571
return KeyUpAsync(element, eventArgs);
8672
}
8773

88-
/// <summary>
89-
/// Raises the <c>@onkeyup</c> event on <paramref name="elementTask"/>, passing the provided <paramref name="key"/>
90-
/// to the event handler.
91-
/// </summary>
92-
/// <param name="elementTask">The element to raise the event on.</param>
93-
/// <param name="key">The keyboard key to pass to the event handler.</param>
94-
/// <param name="repeat"><c>true</c> if a key has been depressed long enough to trigger key repetition, otherwise <c>false</c>.</param>
95-
/// <param name="type">The type of the event.</param>
96-
public static async Task KeyUpAsync(this Task<IElement> elementTask, Key key, bool repeat = default, string? type = default)
97-
{
98-
var element = await elementTask;
99-
await KeyUpAsync(element, key, repeat, type);
100-
}
101-
10274
/// <summary>
10375
/// Raises the <c>@onkeypress</c> event on <paramref name="element"/>, passing the provided <paramref name="key"/>
10476
/// to the event handler.
@@ -130,18 +102,4 @@ public static Task KeyPressAsync(this IElement element, Key key, bool repeat = d
130102
eventArgs.Type = type!; // Type property missing annotation
131103
return KeyPressAsync(element, eventArgs);
132104
}
133-
134-
/// <summary>
135-
/// Raises the <c>@onkeypress</c> event on <paramref name="elementTask"/>, passing the provided <paramref name="key"/>
136-
/// to the event handler.
137-
/// </summary>
138-
/// <param name="elementTask">The element to raise the event on.</param>
139-
/// <param name="key">The keyboard key to pass to the event handler.</param>
140-
/// <param name="repeat"><c>true</c> if a key has been depressed long enough to trigger key repetition, otherwise <c>false</c>.</param>
141-
/// <param name="type">The type of the event.</param>
142-
public static async Task KeyPressAsync(this Task<IElement> elementTask, Key key, bool repeat = default, string? type = default)
143-
{
144-
var element = await elementTask;
145-
await KeyPressAsync(element, key, repeat, type);
146-
}
147105
}

0 commit comments

Comments
 (0)