-
-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2cf4730
commit 0a1aa2e
Showing
27 changed files
with
998 additions
and
652 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { test, expect, Page } from "@playwright/test"; | ||
import { drag } from "../../utils"; | ||
|
||
let page: Page; | ||
|
||
test.beforeEach(async ({ browser }) => { | ||
page = await browser.newPage(); | ||
}); | ||
|
||
test.describe("Native drag with drag handles", async () => { | ||
test("Native drag with drag handles. Should not be able to pick up item unless using drag handle", async () => { | ||
await page.goto("http://localhost:3001/draghandle"); | ||
await new Promise((r) => setTimeout(r, 1000)); | ||
// Should not be able to pick up item unless using drag handle | ||
await drag(page, { | ||
originEl: { id: "Apple", position: "center" }, | ||
destinationEl: { id: "Banana", position: "center" }, | ||
dragStart: true, | ||
}); | ||
await expect(page.locator("#values_1")).toHaveText("Apple Banana Orange"); | ||
// When using drag handle, should be able to pick up item and see dragging | ||
// class. | ||
await drag(page, { | ||
originEl: { id: "Apple_dragHandle", position: "center" }, | ||
destinationEl: { id: "Banana", position: "center" }, | ||
dragStart: true, | ||
}); | ||
await expect(page.locator("#values_1")).toHaveText("Banana Apple Orange"); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
import { test, expect, Page } from "@playwright/test"; | ||
import { drag } from "../../utils"; | ||
|
||
let page: Page; | ||
|
||
test.beforeEach(async ({ browser }) => { | ||
page = await browser.newPage(); | ||
}); | ||
|
||
test.describe("Issue #133", async () => { | ||
test("When an element is transferred to another list, and then moved back to the root and dropped, `config.handlEnd` should still be invoked.", async () => { | ||
await page.goto("http://localhost:3001/issue-133"); | ||
await new Promise((r) => setTimeout(r, 1000)); | ||
await expect( | ||
page.locator("body").getAttribute("data-target-dragend") | ||
).resolves.toBe(null); | ||
// Should not be able to pick up item unless using drag handle | ||
await drag(page, { | ||
originEl: { id: "Apple", position: "center" }, | ||
destinationEl: { id: "Apple", position: "center" }, | ||
dragStart: true, | ||
drop: false, | ||
}); | ||
await expect( | ||
page.locator("body").getAttribute("data-target-dragend") | ||
).resolves.toBe(null); | ||
// When using drag handle, should be able to pick up item and see dragging | ||
// class. | ||
await drag(page, { | ||
originEl: { id: "Apple", position: "center" }, | ||
destinationEl: { id: "Pineapple", position: "center" }, | ||
}); | ||
|
||
await expect(page.locator("#values_1")).toHaveText( | ||
"Banana Orange Cherry Grape" | ||
); | ||
await expect(page.locator("#values_2")).toHaveText( | ||
"Apple Pineapple Strawberry" | ||
); | ||
|
||
await drag(page, { | ||
originEl: { id: "Apple", position: "center" }, | ||
destinationEl: { id: "issue-133-title", position: "center" }, | ||
drop: true, | ||
}); | ||
|
||
await new Promise((r) => setTimeout(r, 1000)); | ||
|
||
await expect( | ||
page.locator("body").getAttribute("data-source-dragend") | ||
).resolves.toBe("true"); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { test, expect, Page } from "@playwright/test"; | ||
import { syntheticDrag } from "../../utils"; | ||
|
||
let page: Page; | ||
|
||
test.beforeEach(async ({ browser }) => { | ||
page = await browser.newPage(); | ||
}); | ||
|
||
test.describe("Synth Drag handles", async () => { | ||
test("Test #1: Elements can only be picked up by the drag handle.", async () => { | ||
await page.goto("http://localhost:3001/draghandle"); | ||
await new Promise((r) => setTimeout(r, 1000)); | ||
// Should not be able to pick up item unless using drag handle | ||
await syntheticDrag(page, { | ||
originEl: { id: "Apple", position: "center" }, | ||
destinationEl: { id: "Banana", position: "center" }, | ||
dragStart: true, | ||
}); | ||
await expect(page.locator("#values_1")).toHaveText("Apple Banana Orange"); | ||
// When using drag handle, should be able to pick up item and see dragging | ||
// class. | ||
await syntheticDrag(page, { | ||
originEl: { id: "Apple_dragHandle", position: "center" }, | ||
destinationEl: { id: "Banana", position: "center" }, | ||
dragStart: true, | ||
}); | ||
await expect(page.locator("#values_1")).toHaveText("Banana Apple Orange"); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.