Fixes tests

This commit is contained in:
Steve Ruiz 2021-07-14 12:40:18 +01:00
parent 43276c700f
commit 6ce1f0b5f1
3 changed files with 68 additions and 218 deletions

View file

@ -41,14 +41,8 @@
"name": "Rectangle",
"parentId": "page1",
"childIndex": 3,
"point": [
171.47,
288.63
],
"size": [
176.22,
192.26
],
"point": [171.47, 288.63],
"size": [176.22, 192.26],
"radius": 2,
"rotation": 0,
"style": {
@ -64,14 +58,8 @@
"name": "Rectangle",
"parentId": "page1",
"childIndex": 4,
"point": [
511.7,
404.19
],
"size": [
181.08999999999992,
150.40999999999997
],
"point": [511.7, 404.19],
"size": [181.08999999999992, 150.40999999999997],
"radius": 2,
"rotation": 0,
"style": {
@ -87,14 +75,8 @@
"name": "Rectangle",
"parentId": "page1",
"childIndex": 5,
"point": [
384.09,
378.45
],
"size": [
95.20999999999992,
91.1799999999999
],
"point": [384.09, 378.45],
"size": [95.20999999999992, 91.1799999999999],
"radius": 2,
"rotation": 0,
"style": {
@ -110,10 +92,7 @@
"name": "Ellipse",
"parentId": "page1",
"childIndex": 6,
"point": [
162.45,
679.23
],
"point": [162.45, 679.23],
"radiusX": 102.99999999999997,
"radiusY": 102.99999999999994,
"rotation": 0,
@ -130,10 +109,7 @@
"name": "Ellipse",
"parentId": "page1",
"childIndex": 7,
"point": [
517.18,
783.54
],
"point": [517.18, 783.54],
"radiusX": 102.99999999999997,
"radiusY": 102.99999999999994,
"rotation": 0,
@ -150,10 +126,7 @@
"name": "Ellipse",
"parentId": "page1",
"childIndex": 8,
"point": [
398.99,
810.79
],
"point": [398.99, 810.79],
"radiusX": 45.484999999999985,
"radiusY": 45.48499999999996,
"rotation": 0,
@ -170,36 +143,24 @@
"name": "Arrow",
"parentId": "page1",
"childIndex": 9,
"point": [
252.85,
1057.5
],
"point": [252.85, 1057.5],
"rotation": 0,
"bend": 0,
"handles": {
"start": {
"id": "start",
"index": 0,
"point": [
0,
0
]
"point": [0, 0]
},
"end": {
"id": "end",
"index": 1,
"point": [
0.09000000000000341,
208
]
"point": [0.09000000000000341, 208]
},
"bend": {
"id": "bend",
"index": 2,
"point": [
0.045000000000001705,
104
]
"point": [0.045000000000001705, 104]
}
},
"decorations": {
@ -220,36 +181,24 @@
"name": "Arrow",
"parentId": "page1",
"childIndex": 10,
"point": [
616.9,
1124.3
],
"point": [616.9, 1124.3],
"rotation": 0,
"bend": 0,
"handles": {
"start": {
"id": "start",
"index": 0,
"point": [
0,
0
]
"point": [0, 0]
},
"end": {
"id": "end",
"index": 1,
"point": [
2.4500000000000455,
185.20000000000005
]
"point": [2.4500000000000455, 185.20000000000005]
},
"bend": {
"id": "bend",
"index": 2,
"point": [
1.2250000000000227,
92.60000000000002
]
"point": [1.2250000000000227, 92.60000000000002]
}
},
"decorations": {
@ -270,36 +219,24 @@
"name": "Arrow",
"parentId": "page1",
"childIndex": 11,
"point": [
425.18,
1143.2
],
"point": [425.18, 1143.2],
"rotation": 0,
"bend": 0,
"handles": {
"start": {
"id": "start",
"index": 0,
"point": [
0,
0
]
"point": [0, 0]
},
"end": {
"id": "end",
"index": 1,
"point": [
1.8500000000000227,
95.70000000000005
]
"point": [1.8500000000000227, 95.70000000000005]
},
"bend": {
"id": "bend",
"index": 2,
"point": [
0.9250000000000114,
47.85000000000002
]
"point": [0.9250000000000114, 47.85000000000002]
}
},
"decorations": {
@ -320,10 +257,7 @@
"name": "Text",
"parentId": "page1",
"childIndex": 12,
"point": [
207.16,
1422.4
],
"point": [207.16, 1422.4],
"rotation": 0,
"style": {
"color": "Black",
@ -340,10 +274,7 @@
"name": "Text",
"parentId": "page1",
"childIndex": 13,
"point": [
389.57,
1496.5
],
"point": [389.57, 1496.5],
"rotation": 0,
"style": {
"color": "Black",
@ -360,10 +291,7 @@
"name": "Text",
"parentId": "page1",
"childIndex": 14,
"point": [
564.06,
1558.1
],
"point": [564.06, 1558.1],
"rotation": 0,
"style": {
"color": "Black",
@ -389,13 +317,10 @@
"page1": {
"id": "page1",
"camera": {
"point": [
0,
-145
],
"point": [0, -145],
"zoom": 1
},
"selectedIds": {}
}
}
}
}

View file

@ -15,14 +15,8 @@
"name": "Rectangle",
"parentId": "page1",
"childIndex": 3,
"point": [
100,
100
],
"size": [
100,
100
],
"point": [100, 100],
"size": [100, 100],
"radius": 2,
"rotation": 0,
"style": {
@ -38,14 +32,8 @@
"name": "Rectangle",
"parentId": "page1",
"childIndex": 4,
"point": [
500,
400
],
"size": [
200,
200
],
"point": [500, 400],
"size": [200, 200],
"radius": 2,
"rotation": 0,
"style": {
@ -61,14 +49,8 @@
"name": "Rectangle",
"parentId": "page1",
"childIndex": 5,
"point": [
384.09,
378.45
],
"size": [
95.20999999999992,
91.1799999999999
],
"point": [384.09, 378.45],
"size": [95.20999999999992, 91.1799999999999],
"radius": 2,
"rotation": 0,
"style": {
@ -84,10 +66,7 @@
"name": "Ellipse",
"parentId": "page1",
"childIndex": 6,
"point": [
162.45,
679.23
],
"point": [162.45, 679.23],
"radiusX": 102.99999999999997,
"radiusY": 102.99999999999994,
"rotation": 0,
@ -104,10 +83,7 @@
"name": "Ellipse",
"parentId": "page1",
"childIndex": 7,
"point": [
517.18,
783.54
],
"point": [517.18, 783.54],
"radiusX": 102.99999999999997,
"radiusY": 102.99999999999994,
"rotation": 0,
@ -124,10 +100,7 @@
"name": "Ellipse",
"parentId": "page1",
"childIndex": 8,
"point": [
398.99,
810.79
],
"point": [398.99, 810.79],
"radiusX": 45.484999999999985,
"radiusY": 45.48499999999996,
"rotation": 0,
@ -144,36 +117,24 @@
"name": "Arrow",
"parentId": "page1",
"childIndex": 9,
"point": [
252.85,
1057.5
],
"point": [252.85, 1057.5],
"rotation": 0,
"bend": 0,
"handles": {
"start": {
"id": "start",
"index": 0,
"point": [
0,
0
]
"point": [0, 0]
},
"end": {
"id": "end",
"index": 1,
"point": [
0.09000000000000341,
208
]
"point": [0.09000000000000341, 208]
},
"bend": {
"id": "bend",
"index": 2,
"point": [
0.045000000000001705,
104
]
"point": [0.045000000000001705, 104]
}
},
"decorations": {
@ -194,36 +155,24 @@
"name": "Arrow",
"parentId": "page1",
"childIndex": 10,
"point": [
616.9,
1124.3
],
"point": [616.9, 1124.3],
"rotation": 0,
"bend": 0,
"handles": {
"start": {
"id": "start",
"index": 0,
"point": [
0,
0
]
"point": [0, 0]
},
"end": {
"id": "end",
"index": 1,
"point": [
2.4500000000000455,
185.20000000000005
]
"point": [2.4500000000000455, 185.20000000000005]
},
"bend": {
"id": "bend",
"index": 2,
"point": [
1.2250000000000227,
92.60000000000002
]
"point": [1.2250000000000227, 92.60000000000002]
}
},
"decorations": {
@ -244,36 +193,24 @@
"name": "Arrow",
"parentId": "page1",
"childIndex": 11,
"point": [
425.18,
1143.2
],
"point": [425.18, 1143.2],
"rotation": 0,
"bend": 0,
"handles": {
"start": {
"id": "start",
"index": 0,
"point": [
0,
0
]
"point": [0, 0]
},
"end": {
"id": "end",
"index": 1,
"point": [
1.8500000000000227,
95.70000000000005
]
"point": [1.8500000000000227, 95.70000000000005]
},
"bend": {
"id": "bend",
"index": 2,
"point": [
0.9250000000000114,
47.85000000000002
]
"point": [0.9250000000000114, 47.85000000000002]
}
},
"decorations": {
@ -294,10 +231,7 @@
"name": "Text",
"parentId": "page1",
"childIndex": 12,
"point": [
207.16,
1422.4
],
"point": [207.16, 1422.4],
"rotation": 0,
"style": {
"color": "Black",
@ -314,10 +248,7 @@
"name": "Text",
"parentId": "page1",
"childIndex": 13,
"point": [
389.57,
1496.5
],
"point": [389.57, 1496.5],
"rotation": 0,
"style": {
"color": "Black",
@ -334,10 +265,7 @@
"name": "Text",
"parentId": "page1",
"childIndex": 14,
"point": [
564.06,
1558.1
],
"point": [564.06, 1558.1],
"rotation": 0,
"style": {
"color": "Black",
@ -362,12 +290,9 @@
"pageState": {
"id": "page1",
"camera": {
"point": [
0,
-145
],
"point": [0, -145],
"zoom": 1
},
"selectedIds": {}
}
}
}

View file

@ -26,30 +26,30 @@ describe('rename page command', () => {
})
})
// describe('renames a page other than the current page', () => {
// tt.restore()
// .reset()
// .send('CREATED_PAGE')
// .send('CHANGED_PAGE', { id: 'page1' })
describe('renames a page other than the current page', () => {
tt.restore()
.reset()
.send('CREATED_PAGE')
.send('CHANGED_PAGE', { id: 'page1' })
// expect(Object.keys(tt.data.document.pages).length).toBe(2)
expect(Object.keys(tt.data.document.pages).length).toBe(2)
// expect(tt.data.currentPageId).toBe('page1')
expect(tt.data.currentPageId).toBe('page1')
// const secondPageId = Object.keys(tt.data.document.pages)[1]
const secondPageId = Object.keys(tt.data.document.pages)[1]
// expect(tt.data.document.pages[secondPageId].name).toBe('New Page')
expect(tt.data.document.pages[secondPageId].name).toBe('Page 2')
// tt.send('RENAMED_PAGE', { id: secondPageId, name: 'My Second Page' })
tt.send('RENAMED_PAGE', { id: secondPageId, name: 'My Second Page' })
// expect(tt.data.document.pages[secondPageId].name).toBe('My Second Page')
expect(tt.data.document.pages[secondPageId].name).toBe('My Second Page')
// tt.undo()
tt.undo()
// expect(tt.data.document.pages[secondPageId].name).toBe('New Page')
expect(tt.data.document.pages[secondPageId].name).toBe('Page 2')
// tt.redo()
tt.redo()
// expect(tt.data.document.pages[secondPageId].name).toBe('My Second Page')
// })
expect(tt.data.document.pages[secondPageId].name).toBe('My Second Page')
})
})