cuprite
cuprite copied to clipboard
Support `steps` option for dragging
I've been trying to get a system test working with https://sortablejs.github.io/Sortable/
I had to do two things:
- Change the sortable
forceFallback
config totrue
: this is an application level change to not use HTML native drag and drop and use a different event fallback - Add
steps
to themouse.move
calls
This PR adds an option to pass steps
to use when dragging in case you need to more closely simulate dragging the mouse across the browser (vs the current "teleport" behavior)
@route would you be able to review?
Yea sorry busy week at work, going to to do it
@route hi, just wanted to check in on this and see if there was anything I could help with getting this merged. Been running with this patch on my project for a few weeks now without any problems.
@swanson Can you share an example of usage too? I have tried your patch without any luck.
@mrtnin
test "Can drag and drop content blocks from toolbar onto page" do
visit "/pages/new"
text_block = find("#toolbar div", text: "Text Block")
sidebar = find("#sidebar)
text_block.drag_to(sidebar, steps: 10)
page.driver.wait_for_network_idle
within "#sidebar" do
assert_text "Enter text content"
end
end
I am using this in combination with the Sortable.js library and I set the option for forceFallback
to true when running my app in the Rails test environment (via a variable in my Stimulus controller that initializes Sortable). This option uses a fallback instead of the HTML5 drag and drop APIs which don't seem to work.
Without the steps: 10
the dragging is more like a "teleport" where the block just goes straight to the sidebar.