Skip to content

Commit

Permalink
Add test for #308
Browse files Browse the repository at this point in the history
  • Loading branch information
ndrsn committed Sep 25, 2020
1 parent d9ea7fa commit 95dd151
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions test/tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,11 @@
}
if (cond) { return new Error(msg); }
}
// This is a temporary assert, until we migrate
// testing libraries
function doAssert(assertion, message) {
if (!assertion) throw new Error(message);
}
describe('canvas-datagrid', function () {
after(function (done) {
// git rid of lingering artifacts from the run
Expand Down Expand Up @@ -1655,8 +1660,17 @@

grid.focus();
grid.setActiveCell(0, 0);
grid.selectArea({ top: 0, left: 0, bottom: 0, right: 0 });

grid.addEventListener('afterpaste', function (event) {
try {
doAssert(!!event.cells, "event has cells property");
doAssert(event.cells.length === 1, "one row has been pasted ");
doAssert(event.cells[0][0] === 0, "pasted column == 0");
} catch (error) {
done(error);
}

done();
});

Expand Down

0 comments on commit 95dd151

Please sign in to comment.