Use the right data type for mouse event args (#11332)
* Use the right data type for mouse event args Fixes https://github.com/aspnet/AspNetCore/issues/11224
This commit is contained in:
parent
5f2760e9bc
commit
a093059fce
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -91,19 +91,9 @@ export class EventForDotNet<TData extends UIEventArgs> {
|
||||||
|
|
||||||
function parseDragEvent(event: any) {
|
function parseDragEvent(event: any) {
|
||||||
return {
|
return {
|
||||||
type: event.type,
|
...parseMouseEvent(event),
|
||||||
detail: event.detail,
|
|
||||||
dataTransfer: event.dataTransfer,
|
dataTransfer: event.dataTransfer,
|
||||||
screenX: event.screenX,
|
|
||||||
screenY: event.screenY,
|
|
||||||
clientX: event.clientX,
|
|
||||||
clientY: event.clientY,
|
|
||||||
button: event.button,
|
|
||||||
buttons: event.buttons,
|
|
||||||
ctrlKey: event.ctrlKey,
|
|
||||||
shiftKey: event.shiftKey,
|
|
||||||
altKey: event.altKey,
|
|
||||||
metaKey: event.metaKey,
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -444,21 +444,10 @@ namespace Microsoft.AspNetCore.Components
|
||||||
public string Kind { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
|
public string Kind { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
|
||||||
public string Type { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
|
public string Type { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
|
||||||
}
|
}
|
||||||
public partial class UIDragEventArgs : Microsoft.AspNetCore.Components.UIEventArgs
|
public partial class UIDragEventArgs : Microsoft.AspNetCore.Components.UIMouseEventArgs
|
||||||
{
|
{
|
||||||
public UIDragEventArgs() { }
|
public UIDragEventArgs() { }
|
||||||
public bool AltKey { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
|
|
||||||
public long Button { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
|
|
||||||
public long Buttons { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
|
|
||||||
public long ClientX { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
|
|
||||||
public long ClientY { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
|
|
||||||
public bool CtrlKey { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
|
|
||||||
public Microsoft.AspNetCore.Components.DataTransfer DataTransfer { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
|
public Microsoft.AspNetCore.Components.DataTransfer DataTransfer { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
|
||||||
public long Detail { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
|
|
||||||
public bool MetaKey { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
|
|
||||||
public long ScreenX { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
|
|
||||||
public long ScreenY { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
|
|
||||||
public bool ShiftKey { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
|
|
||||||
}
|
}
|
||||||
public partial class UIErrorEventArgs : Microsoft.AspNetCore.Components.UIEventArgs
|
public partial class UIErrorEventArgs : Microsoft.AspNetCore.Components.UIEventArgs
|
||||||
{
|
{
|
||||||
|
|
@ -521,13 +510,13 @@ namespace Microsoft.AspNetCore.Components
|
||||||
public bool AltKey { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
|
public bool AltKey { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
|
||||||
public long Button { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
|
public long Button { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
|
||||||
public long Buttons { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
|
public long Buttons { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
|
||||||
public long ClientX { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
|
public double ClientX { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
|
||||||
public long ClientY { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
|
public double ClientY { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
|
||||||
public bool CtrlKey { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
|
public bool CtrlKey { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
|
||||||
public long Detail { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
|
public long Detail { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
|
||||||
public bool MetaKey { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
|
public bool MetaKey { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
|
||||||
public long ScreenX { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
|
public double ScreenX { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
|
||||||
public long ScreenY { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
|
public double ScreenY { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
|
||||||
public bool ShiftKey { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
|
public bool ShiftKey { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
|
||||||
}
|
}
|
||||||
public partial class UIPointerEventArgs : Microsoft.AspNetCore.Components.UIMouseEventArgs
|
public partial class UIPointerEventArgs : Microsoft.AspNetCore.Components.UIMouseEventArgs
|
||||||
|
|
@ -564,13 +553,13 @@ namespace Microsoft.AspNetCore.Components
|
||||||
public partial class UITouchPoint
|
public partial class UITouchPoint
|
||||||
{
|
{
|
||||||
public UITouchPoint() { }
|
public UITouchPoint() { }
|
||||||
public long ClientX { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
|
public double ClientX { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
|
||||||
public long ClientY { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
|
public double ClientY { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
|
||||||
public long Identifier { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
|
public long Identifier { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
|
||||||
public long PageX { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
|
public double PageX { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
|
||||||
public long PageY { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
|
public double PageY { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
|
||||||
public long ScreenX { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
|
public double ScreenX { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
|
||||||
public long ScreenY { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
|
public double ScreenY { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
|
||||||
}
|
}
|
||||||
public partial class UIWheelEventArgs : Microsoft.AspNetCore.Components.UIMouseEventArgs
|
public partial class UIWheelEventArgs : Microsoft.AspNetCore.Components.UIMouseEventArgs
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -41,79 +41,13 @@ namespace Microsoft.AspNetCore.Components
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Supplies information about an drag event that is being raised.
|
/// Supplies information about an drag event that is being raised.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class UIDragEventArgs : UIEventArgs
|
public class UIDragEventArgs : UIMouseEventArgs
|
||||||
{
|
{
|
||||||
/// <summary>
|
|
||||||
/// A count of consecutive clicks that happened in a short amount of time, incremented by one.
|
|
||||||
/// </summary>
|
|
||||||
public long Detail { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The data that underlies a drag-and-drop operation, known as the drag data store.
|
/// The data that underlies a drag-and-drop operation, known as the drag data store.
|
||||||
/// See <see cref="DataTransfer"/>.
|
/// See <see cref="DataTransfer"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public DataTransfer DataTransfer { get; set; }
|
public DataTransfer DataTransfer { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The X coordinate of the mouse pointer in global (screen) coordinates.
|
|
||||||
/// </summary>
|
|
||||||
public long ScreenX { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The Y coordinate of the mouse pointer in global (screen) coordinates.
|
|
||||||
/// </summary>
|
|
||||||
public long ScreenY { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The X coordinate of the mouse pointer in local (DOM content) coordinates.
|
|
||||||
/// </summary>
|
|
||||||
public long ClientX { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The Y coordinate of the mouse pointer in local (DOM content) coordinates.
|
|
||||||
/// </summary>
|
|
||||||
public long ClientY { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The button number that was pressed when the mouse event was fired:
|
|
||||||
/// Left button=0,
|
|
||||||
/// middle button=1 (if present),
|
|
||||||
/// right button=2.
|
|
||||||
/// For mice configured for left handed use in which the button actions are reversed the values are instead read from right to left.
|
|
||||||
/// </summary>
|
|
||||||
public long Button { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The buttons being pressed when the mouse event was fired:
|
|
||||||
/// Left button=1,
|
|
||||||
/// Right button=2,
|
|
||||||
/// Middle (wheel) button=4,
|
|
||||||
/// 4th button (typically, "Browser Back" button)=8,
|
|
||||||
/// 5th button (typically, "Browser Forward" button)=16.
|
|
||||||
/// If two or more buttons are pressed, returns the logical sum of the values.
|
|
||||||
/// E.g., if Left button and Right button are pressed, returns 3 (=1 | 2).
|
|
||||||
/// </summary>
|
|
||||||
public long Buttons { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// true if the control key was down when the event was fired. false otherwise.
|
|
||||||
/// </summary>
|
|
||||||
public bool CtrlKey { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// true if the shift key was down when the event was fired. false otherwise.
|
|
||||||
/// </summary>
|
|
||||||
public bool ShiftKey { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// true if the alt key was down when the event was fired. false otherwise.
|
|
||||||
/// </summary>
|
|
||||||
public bool AltKey { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// true if the meta key was down when the event was fired. false otherwise.
|
|
||||||
/// </summary>
|
|
||||||
public bool MetaKey { get; set; }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -268,22 +202,22 @@ namespace Microsoft.AspNetCore.Components
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The X coordinate of the mouse pointer in global (screen) coordinates.
|
/// The X coordinate of the mouse pointer in global (screen) coordinates.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public long ScreenX { get; set; }
|
public double ScreenX { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The Y coordinate of the mouse pointer in global (screen) coordinates.
|
/// The Y coordinate of the mouse pointer in global (screen) coordinates.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public long ScreenY { get; set; }
|
public double ScreenY { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The X coordinate of the mouse pointer in local (DOM content) coordinates.
|
/// The X coordinate of the mouse pointer in local (DOM content) coordinates.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public long ClientX { get; set; }
|
public double ClientX { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The Y coordinate of the mouse pointer in local (DOM content) coordinates.
|
/// The Y coordinate of the mouse pointer in local (DOM content) coordinates.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public long ClientY { get; set; }
|
public double ClientY { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The button number that was pressed when the mouse event was fired:
|
/// The button number that was pressed when the mouse event was fired:
|
||||||
|
|
@ -465,34 +399,34 @@ namespace Microsoft.AspNetCore.Components
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The X coordinate of the touch point relative to the left edge of the screen.
|
/// The X coordinate of the touch point relative to the left edge of the screen.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public long ScreenX { get; set; }
|
public double ScreenX { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The Y coordinate of the touch point relative to the top edge of the screen.
|
/// The Y coordinate of the touch point relative to the top edge of the screen.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public long ScreenY { get; set; }
|
public double ScreenY { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The X coordinate of the touch point relative to the left edge of the browser viewport, not including any scroll offset.
|
/// The X coordinate of the touch point relative to the left edge of the browser viewport, not including any scroll offset.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public long ClientX { get; set; }
|
public double ClientX { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The Y coordinate of the touch point relative to the top edge of the browser viewport, not including any scroll offset.
|
/// The Y coordinate of the touch point relative to the top edge of the browser viewport, not including any scroll offset.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public long ClientY { get; set; }
|
public double ClientY { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The X coordinate of the touch point relative to the left edge of the document.
|
/// The X coordinate of the touch point relative to the left edge of the document.
|
||||||
/// Unlike <see cref="ClientX"/>, this value includes the horizontal scroll offset, if any.
|
/// Unlike <see cref="ClientX"/>, this value includes the horizontal scroll offset, if any.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public long PageX { get; set; }
|
public double PageX { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The Y coordinate of the touch point relative to the top of the document.
|
/// The Y coordinate of the touch point relative to the top of the document.
|
||||||
/// Unlike <see cref="ClientY"/>, this value includes the vertical scroll offset, if any.
|
/// Unlike <see cref="ClientY"/>, this value includes the vertical scroll offset, if any.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public long PageY { get; set; }
|
public double PageY { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
// Copyright (c) .NET Foundation. All rights reserved.
|
// Copyright (c) .NET Foundation. All rights reserved.
|
||||||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||||
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using BasicTestApp;
|
using BasicTestApp;
|
||||||
using Microsoft.AspNetCore.Components.E2ETest.Infrastructure;
|
using Microsoft.AspNetCore.Components.E2ETest.Infrastructure;
|
||||||
using Microsoft.AspNetCore.Components.E2ETest.Infrastructure.ServerFixtures;
|
using Microsoft.AspNetCore.Components.E2ETest.Infrastructure.ServerFixtures;
|
||||||
|
|
@ -117,6 +116,40 @@ namespace Microsoft.AspNetCore.Components.E2ETest.Tests
|
||||||
Browser.Equal("onmousedown,onmouseup,", () => output.Text);
|
Browser.Equal("onmousedown,onmouseup,", () => output.Text);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void PointerDown_CanTrigger()
|
||||||
|
{
|
||||||
|
MountTestComponent<MouseEventComponent>();
|
||||||
|
|
||||||
|
var input = Browser.FindElement(By.Id("pointerdown_input"));
|
||||||
|
|
||||||
|
var output = Browser.FindElement(By.Id("output"));
|
||||||
|
Assert.Equal(string.Empty, output.Text);
|
||||||
|
|
||||||
|
var actions = new Actions(Browser).ClickAndHold(input);
|
||||||
|
|
||||||
|
actions.Perform();
|
||||||
|
Browser.Equal("onpointerdown", () => output.Text);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void DragDrop_CanTrigger()
|
||||||
|
{
|
||||||
|
MountTestComponent<MouseEventComponent>();
|
||||||
|
|
||||||
|
var input = Browser.FindElement(By.Id("drag_input"));
|
||||||
|
var target = Browser.FindElement(By.Id("drop"));
|
||||||
|
|
||||||
|
var output = Browser.FindElement(By.Id("output"));
|
||||||
|
Assert.Equal(string.Empty, output.Text);
|
||||||
|
|
||||||
|
var actions = new Actions(Browser).DragAndDrop(input, target);
|
||||||
|
|
||||||
|
actions.Perform();
|
||||||
|
// drop doesn't seem to trigger in Selenium. But it's sufficient to determine "any" drag event works
|
||||||
|
Browser.Equal("ondragstart,", () => output.Text);
|
||||||
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
public void PreventDefault_AppliesToFormOnSubmitHandlers()
|
public void PreventDefault_AppliesToFormOnSubmitHandlers()
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,13 @@
|
||||||
<p>
|
<p>
|
||||||
Mousedown: <input id="mousedown_input" @onmousedown="@OnMouseDown" @onmouseup="@OnMouseUp" />
|
Mousedown: <input id="mousedown_input" @onmousedown="@OnMouseDown" @onmouseup="@OnMouseUp" />
|
||||||
</p>
|
</p>
|
||||||
|
<p>
|
||||||
|
Pointerdown: <input id="pointerdown_input" @onpointerdown="@OnPointerDown" />
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<div id="drag_input" draggable="true" @ondragstart="@OnDragStart">Drag Me</div>
|
||||||
|
<div id="drop" @ondrop="@OnDrop" ondragover="event.preventDefault()" style="width: 100px; height: 100px; border: dotted">Drop Target</div>
|
||||||
|
</p>
|
||||||
<p>
|
<p>
|
||||||
<button @onclick="@Clear">Clear</button>
|
<button @onclick="@Clear">Clear</button>
|
||||||
</p>
|
</p>
|
||||||
|
|
@ -63,6 +70,27 @@
|
||||||
StateHasChanged();
|
StateHasChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void OnPointerDown(UIPointerEventArgs e)
|
||||||
|
{
|
||||||
|
DumpEvent(e);
|
||||||
|
message += "onpointerdown";
|
||||||
|
StateHasChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
void OnDragStart(UIDragEventArgs e)
|
||||||
|
{
|
||||||
|
DumpEvent(e);
|
||||||
|
message += "ondragstart,";
|
||||||
|
StateHasChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
void OnDrop(UIDragEventArgs e)
|
||||||
|
{
|
||||||
|
DumpEvent(e);
|
||||||
|
message += "ondrop,";
|
||||||
|
StateHasChanged();
|
||||||
|
}
|
||||||
|
|
||||||
void DumpEvent(UIMouseEventArgs e)
|
void DumpEvent(UIMouseEventArgs e)
|
||||||
{
|
{
|
||||||
Console.WriteLine(JsonSerializer.ToString(e));
|
Console.WriteLine(JsonSerializer.ToString(e));
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue