Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 9 additions & 10 deletions assets/js/components/Helper/DragDropItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,7 @@
:aria-label="$t('config.general.dragItem', { title })"
tabindex="0"
>
<div
class="drag-handle me-2"
:aria-label="$t('config.general.dragHandle')"
role="button"
tabindex="-1"
>
<div class="drag-handle me-2" aria-hidden="true">
<shopicon-regular-menu></shopicon-regular-menu>
</div>
<div class="flex-grow-1">
Expand Down Expand Up @@ -42,14 +37,18 @@ export default defineComponent({

<style scoped>
.drag-drop-item {
cursor: move;
cursor: grab;
user-select: none;
background-color: var(--evcc-box);
border-color: var(--bs-border-color-translucent) !important;
transition: all var(--evcc-transition-fast) ease-in-out;
transform: translate(0, 0);
}

.drag-drop-item:active {
cursor: grabbing;
}

.drag-drop-item--hidden {
opacity: 0.6;
}
Expand All @@ -58,11 +57,11 @@ export default defineComponent({
color: var(--bs-secondary);
opacity: 0.7;
transition: opacity var(--evcc-transition-fast) ease-in-out;
cursor: grab;
cursor: inherit;
}

.drag-handle:active {
cursor: grabbing;
.drag-handle > * {
pointer-events: none;
}

.drag-drop-item:hover .drag-handle {
Expand Down
25 changes: 10 additions & 15 deletions tests/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,22 +109,17 @@ export async function dragElement(
sourceElement: Locator,
targetElement: Locator
): Promise<void> {
// Get bounding boxes to calculate actual positions
const sourceBox = await sourceElement.boundingBox();
const targetBox = await targetElement.boundingBox();
// hover() waits for animations to settle before grabbing the source —
// avoids stale coordinates during the modal slide-in.
await sourceElement.hover();
await page.mouse.down();

if (sourceBox && targetBox) {
// Move from center of source item to center of target item
const startX = sourceBox.x + sourceBox.width / 2;
const startY = sourceBox.y + sourceBox.height / 2;
const endX = targetBox.x + targetBox.width / 2;
const endY = targetBox.y + targetBox.height / 2;

await page.mouse.move(startX, startY);
await page.mouse.down();
await page.mouse.move(endX, endY, { steps: 10 });
await page.mouse.up();
}
const targetBox = await targetElement.boundingBox();
if (!targetBox) throw new Error("dragElement: target has no bounding box");
await page.mouse.move(targetBox.x + targetBox.width / 2, targetBox.y + targetBox.height / 2, {
steps: 10,
});
await page.mouse.up();
}

export async function getDatalistOptions(input: Locator): Promise<string[]> {
Expand Down
Loading