Skip to content

Commit

Permalink
Revert "test: create new instance for each test"
Browse files Browse the repository at this point in the history
This reverts commit 6039fb6.
  • Loading branch information
tomivirkki authored and sissbruecker committed Dec 20, 2021
1 parent 8a0349a commit 2a97134
Showing 1 changed file with 32 additions and 5 deletions.
37 changes: 32 additions & 5 deletions test/drag-and-drop.html
Original file line number Diff line number Diff line change
Expand Up @@ -124,12 +124,9 @@
return event;
};

beforeEach(done => {
dragData = {};
before(done => {
grid = fixture('default');
grid.hidden = true;
grid.items = getTestItems();
flushGrid(grid);
requestAnimationFrame(() => {
// Wait for the appear animation to finish
listenOnce(grid, 'animationend', () => {
Expand All @@ -139,6 +136,31 @@
});
});

beforeEach(done => {
dragData = {};
if (!grid.parentElement) {
document.body.appendChild(grid);
}
grid.items = getTestItems();
flushGrid(grid);
if (grid._safari) {
setTimeout(() => done());
} else {
done();
}

});

afterEach(() => {
fireDragEnd(grid.$.table);
fireDrop(grid.$.table);
grid.rowsDraggable = false;
grid.dropMode = null;
grid.style.height = '';
grid.selectedItems = [];
grid.dataProvider = null;
});

it('should not be draggable by default', () => {
expect(getDraggable(grid)).not.to.be.ok;
});
Expand All @@ -164,13 +186,18 @@
let dragStartSpy;
let dropSpy;

beforeEach(() => {
before(() => {
dragStartSpy = sinon.spy();
dropSpy = sinon.spy();
grid.addEventListener('grid-dragstart', dragStartSpy);
grid.addEventListener('grid-drop', dropSpy);
});

beforeEach(() => {
grid.rowsDraggable = true;
grid.dropMode = 'on-top';
dragStartSpy.reset();
dropSpy.reset();
});

it('should stop the native event', () => {
Expand Down

0 comments on commit 2a97134

Please sign in to comment.