Skip to content

Commit

Permalink
Prevent running tests for drafts PR (#283)
Browse files Browse the repository at this point in the history
  • Loading branch information
jalal246 authored Jul 13, 2021
1 parent 94f06d8 commit 5a0b0e2
Show file tree
Hide file tree
Showing 5 changed files with 816 additions and 1,035 deletions.
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ jobs:
unit-test:
name: Unit Test
runs-on: ubuntu-latest
if: github.event.pull_request.draft != true
steps:
- name: Check out repository
uses: actions/checkout@master
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/cypress.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ jobs:
cypress-dnd:
name: E2E Test For DnD React APP
runs-on: ubuntu-latest
if: github.event.pull_request.draft != true
steps:
- name: Check out repository
uses: actions/checkout@master
Expand Down
2 changes: 1 addition & 1 deletion packages/dnd/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"devDependencies": {
"@cypress/code-coverage": "^3.8.1",
"cross-env": "^7.0.2",
"cypress": "^7.5.0",
"cypress": "7.6.0",
"eslint-plugin-cypress": "^2.11.1",
"start-server-and-test": "^1.11.2",
"v8-to-istanbul": "^8.0.0"
Expand Down
48 changes: 25 additions & 23 deletions packages/dnd/playgrounds/dflex-react-dnd/src/extended/DnDItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ export const TodoItem = ({ id, task, style, depth = 0 }: Props) => {
}, []);

const onMouseMove = (e: MouseEvent) => {
e.stopPropagation();

if (dndEvent) {
const { clientX, clientY } = e;

Expand Down Expand Up @@ -61,41 +63,41 @@ export const TodoItem = ({ id, task, style, depth = 0 }: Props) => {
}
};

const onTouchMove = (e: TouchEvent) => {
if (dndEvent) {
const { clientX, clientY } = e.touches[0];
// const onTouchMove = (e: TouchEvent) => {
// if (dndEvent) {
// const { clientX, clientY } = e.touches[0];

dndEvent.dragAt(clientX, clientY);
}
};
// dndEvent.dragAt(clientX, clientY);
// }
// };

const onTouchEnd = () => {
if (dndEvent) {
dndEvent.endDragging();
// const onTouchEnd = () => {
// if (dndEvent) {
// dndEvent.endDragging();

dndEvent = null;
// dndEvent = null;

document.removeEventListener("touchend", onTouchEnd);
document.removeEventListener("touchmove", onTouchMove);
}
};
// document.removeEventListener("touchend", onTouchEnd);
// document.removeEventListener("touchmove", onTouchMove);
// }
// };

const onTouchStart = (e: React.TouchEvent) => {
const { clientX, clientY } = e.touches[0];
// const onTouchStart = (e: React.TouchEvent) => {
// const { clientX, clientY } = e.touches[0];

if (id) {
dndEvent = new DnD(id, { x: clientX, y: clientY });
// if (id) {
// dndEvent = new DnD(id, { x: clientX, y: clientY });

document.addEventListener("touchend", onTouchEnd);
document.addEventListener("touchmove", onTouchMove);
}
};
// document.addEventListener("touchend", onTouchEnd);
// document.addEventListener("touchmove", onTouchMove);
// }
// };

return (
<li
ref={taskRef}
id={id}
onTouchStart={onTouchStart}
// onTouchStart={onTouchStart}
onMouseDown={onMouseDown}
style={style}
>
Expand Down
Loading

0 comments on commit 5a0b0e2

Please sign in to comment.