mirror of
https://github.com/idrawjs/idraw
synced 2026-05-24 10:08:34 +00:00
chore: update testing
This commit is contained in:
parent
b67077d6cb
commit
142effc54c
3 changed files with 16 additions and 7 deletions
|
|
@ -65,7 +65,7 @@ describe('Screenshot testing', function() {
|
|||
assert.ok(rateList.length > 0);
|
||||
rateList.forEach((data) => {
|
||||
// console.log(`${data.path}]diff-rate: ${data.rate}`, );
|
||||
assert.ok(data.rate < 0.05);
|
||||
assert.ok(data.rate < 0.005);
|
||||
});
|
||||
|
||||
done();
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
const data = {
|
||||
bgColor: '#f0f0f0',
|
||||
// bgColor: '#f0f0f0',
|
||||
elements: [
|
||||
{
|
||||
name: "rect-001",
|
||||
|
|
@ -56,7 +56,7 @@ const data = {
|
|||
desc: {
|
||||
color: "#e0e0e0",
|
||||
borderRadius: 20,
|
||||
borderWidth: 2,
|
||||
borderWidth: 10,
|
||||
borderColor: "#bd0b64",
|
||||
},
|
||||
},
|
||||
|
|
|
|||
|
|
@ -69,14 +69,23 @@ describe("idraw", () => {
|
|||
await delay(10);
|
||||
|
||||
const undo1 = idraw.undo();
|
||||
expect(undo1).toBe(2);
|
||||
expect(undo1.doRecordCount).toBe(2);
|
||||
expect(undo1.data?.elements?.length).toBe(4);
|
||||
|
||||
|
||||
const undo2 = idraw.undo();
|
||||
expect(undo2).toBe(1);
|
||||
expect(undo2.doRecordCount).toBe(1);
|
||||
expect(undo2.data?.elements?.length).toBe(4);
|
||||
|
||||
const redo1 = idraw.redo();
|
||||
expect(redo1).toBe(1);
|
||||
expect(redo1.undoRecordCount).toBe(1);
|
||||
expect(redo1.data?.elements?.length).toBe(4);
|
||||
|
||||
idraw.moveDownElement('image-003');
|
||||
|
||||
const redo2 = idraw.redo();
|
||||
expect(redo2).toBe(0);
|
||||
expect(redo2.undoRecordCount).toBe(0);
|
||||
expect(redo2.data).toBe(null);
|
||||
|
||||
requestAnimationFrameMock.triggerNextAnimationFrame();
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue