Vue testing - How to simulate a long press mouse click - vue.js

I created a helper to simulate long click with the mouse (press left click for one second for example).
Now I would like to test it with vue-test-utils but I could not find anything about this question.
The only thing I found is the trigger('mousedown') function here but it does not solve my issue.
Thank you for your help!

The events mousedown and mouseup are the 2 'halves' of the click event. If you want to simulate a long click for say 1 second, you need to do something like:
trigger('mousedown')
await new Promise(resolve => setTimeout(resolve, 1000))
trigger('mouseup')

Related

Input type search clear button Microsoft Edge not working properly with Datatables

I am using Datatables to sort and filter my tables. When you activate Datatables, there is a search field. In Chrome, Firefox, Edge and Internet Explorer 11 there is a clear button present with every search input field.
When you click on it, the text is cleared and the table will reset. Except in Microsoft Edge, this does not work. The table is not resetting.
Is this an issue with Microsoft Edge or Datatables?
I believe it is Edge that not is triggering the events the DT input is listening on. That is keyup, keydown, keypress, cut and paste ...There is two additional events that is fired when you click on the search input clear button: mousedown and mouseup.
You could create event handler that force a redraw when mouseup is triggered :
$('.dataTables_filter input').on('mouseup', function() {
table.draw()
})
See this question where the issue is discussed more thoroughly -> Event fired when clearing text input on IE10 with clear icon
This is a known bug found in build 17.17134 of Edge.
https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/17584515/
I am using an earlier version and it still works.
I try to make a test on my side with EDGE and got the same result like yours.
When click on 'X' it is not reset the table.
Click here to see testing result
Then i made some other tests and find that if you use BackSpace key to clear the search text then it will work as expected.
If you use 'X' button then after text get clear you need to press enter to reset the data.
I agree with other community members that Edge is not triggering the event to reset data.
I think you need to submit your feedback to Datatables site. So that they modify their code which can work properly with Edge.
Regards
Deepak

Not able to click on a button in a new window

I trigger a click on a button which then opens another window (which is neither a new browser nor a frame).
In the new window I wish to click a button but my code is not triggering the click.
I tried to switch to keyword matching but it is still not working.
My code:
driver.findElement(By.xpath("//span[text()='Continue to General Information']")).click();
…which I am sure is not correct to click the button in the new window.
What syntax should I use to click the button?
You can try something like this:
driver.SwitchTo().Window(driver.WindowHandles.Last());
I found it here. There is bit of an explanation of how it works there.

Activate dojo dgrid editor using keyboard

Triggering edit mode in dojo dgrid with mouse event is easy. Here's what I have done:
editor({field: "checkNumber",label: "Check Number",editOn: "click"})
However, i want to trigger edit mode using keyboard. Specifically, i want to go into edit mode when I press the space key. How can I programmatically set a cell to 'edit mode' or 'non-edit mode'?
When you add one or more editor columns to a grid, it makes the edit method available on the grid instance, which you can call with a cell element (or event referencing one) to programmatically shift focus to the editor for the cell.
Meanwhile, the Keyboard mixin has an addKeyHandler method which you can use to add handlers to respond to keydown events for particular keys.
Combining these two things, you can easily do the following to cause the grid to edit the focused cell when space is pressed:
grid.addKeyHandler(32, function (event) {
grid.edit(event);
});
(edit should have no effect for cells in non-editor columns.)
An alternative solution could be to create an extension event which triggers either on mouse click or on space keypress, and pass that to editOn instead of 'click'.
var grdobj = dijit.byId("...");
var editCell=grdobj.cell(rowNo, "checkNumber");
grdobj.edit(editCell);
Instead of cell function, you could make use of right, left, up, or down functions.
Hope that helps.

App calls Method on mouse click. How can I stop it?

So I am pretty new to Xcode and Objective C, I've been using it about 2 weeks now. I am building an app for OSX. One of the windows in the app has 5 text boxes, some labels and a submit button at the bottom. The submit button is linked to a method that closes the window, opens a new one and outputs the contents of the text boxes into one text field on the new window.
I had it working correctly, but now when I do anything but click on the top text field the submit method is called and the window closes. I can click on the black space in the window, but click on any of the objects calls the method. Also, pressing tab calls the method. I am not sure when I did to cause this error, but any insight or tips would be very useful.
Sorry if this is vague, I'm not even sure how to describe the problem. If you need any specific information please ask.
Try looking in Interface Builder. Ctrl Click or Right click on the each one of the fields that are responding with calling the function. See if they are linked to the function.
Also check the "responder" as was suggested earlier. You can do this by also right click or ctrl clicking the red responder box labeled "responder". See if anything in there maps to your function

How to build a Main Menu screen

Good day (and happy New Year),
I'm a beginner VB.Net programmer using VS 2008.
I'm planning a new winform project whose main form should look more or less like this:
MAIN MENU
1. DoSomething1
2. DoSomething2
3. DoSomething3
...
Please choose: [TextBox]
The user can either choose from the Main Menu (by clicking an item) or enter the item number in the textbox. For example, if the user clicks DoSomething3 in the Main Menu (or alternatively enters 3 in the textbox), another form will be opened and hide the main form.
What would be the best way to implement it?
Specifically, I would like to know how I make so that choosing from the menu and entering a number in the textbox fire the same event.
Any help or hints will be appreciated.
This is the traditional user interface for a console mode program. It is quite inappropriate for a GUI app, the kind that Winforms let you build. The closest approximation is buttons for each menu item. So the user can just click one directly, rather than having to type a number. The keyboard still works too, pressing Tab to move through the buttons, Space to activate one.
Look around a bit at user interfaces of other programs you use. Note their use of a menu and a toolbar.
Context Menu and Event Handling in Visual Basic .NET
Edit:
Ok. I think I did not understand. May these links will help you:
Multiple Forms in VB.NET. Part 2 - Accessing Controls on Other Forms
You can use buttons to goto other forms: Look at this thread:
Link from one form to another (Thread)
it's been almost 2 yrs i did not use vb.net but i'll try to help u.
you can make something very simple.e.g.
Have three buttons on the main menu of the main form e.g.
Button 1
Button 2
Button 3
Add click events to all the tree buttons. Create a method for button1,button2,button3
e.g.
void SimulateButton1
{
SpecifiedForm.show();
}
void SimulateButton2
{
SpecifiedForm.show();
}
void SimulateButton3
{
SpecifiedForm.show();
}
Now for the main menu its ok, lets consider entering the Number manually
//get the number first
String Choice=txtChoiceTextBox.getText();
You can add a button next to the textbox with caption Choose Option
and then add an onclick event to this button
on clicking on the button, do the following
if (Choice="1")
{
SimulateButton1();
return;
}
if (Choice="2")
{
SimulateButton2();
return;
}
if (Choice="3")
{
SimulateButton2();
return;
}
For the first tree button it mentioned, it can not be a button but a menu item but the principle is the same
that's it, hope it helps