-
Notifications
You must be signed in to change notification settings - Fork 177
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#2838 - Bonds between atoms are not centered and not drawn symmetrically
- Loading branch information
Aliaksei
committed
Aug 16, 2023
1 parent
020b61c
commit b253040
Showing
4 changed files
with
75 additions
and
9 deletions.
There are no files selected for viewing
35 changes: 35 additions & 0 deletions
35
packages/ketcher-core/__tests__/application/render/util.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import { HalfBond } from 'domain/entities'; | ||
import util from './../../../src/application/render/util'; | ||
|
||
describe('util', () => { | ||
describe('updateHalfBondCoordinates()', () => { | ||
let hb1: HalfBond; | ||
let hb2: HalfBond; | ||
const xShift = 1; | ||
beforeEach(() => { | ||
hb1 = new HalfBond(1, 2, 1); | ||
hb2 = new HalfBond(1, 2, 1); | ||
hb1.p.x = 100; | ||
hb1.p.y = 100; | ||
hb2.p.x = 110; | ||
hb2.p.y = 100; | ||
}); | ||
|
||
it('should not update the coordinates if y-coordinates are different', () => { | ||
hb2.p.y = hb2.p.y + 1; | ||
|
||
const result = util.updateHalfBondCoordinates(hb1, hb2, xShift); | ||
expect(result).toEqual([hb1, hb2]); | ||
}); | ||
it('should update the coordinates if x-coordinate of hb1 is less than hb2', () => { | ||
const result = util.updateHalfBondCoordinates(hb1, hb2, xShift); | ||
|
||
expect(result[0].p.x).toBe(101); | ||
}); | ||
it('should update the coordinates if x-coordinate of hb2 is less than hb1', () => { | ||
hb2.p.x = 90; | ||
const result = util.updateHalfBondCoordinates(hb1, hb2, xShift); | ||
expect(result[0].p.x).toBe(99); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters