-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add data-atom-map-no props in the circle of the svg (#170)
- Loading branch information
Showing
4 changed files
with
54 additions
and
12 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
|
||
|
||
|
||
5 4 0 0 0 0 0 0 0 0999 V2000 | ||
-1.4289 0.2062 0.0000 H 0 0 0 0 0 0 0 0 0 2 0 0 | ||
-0.7145 -0.2062 0.0000 C 0 0 0 0 0 0 0 0 0 1 0 0 | ||
-0.0000 0.2062 0.0000 C 0 0 0 0 0 0 0 0 0 3 0 0 | ||
0.7145 -0.2062 0.0000 C 0 0 0 0 0 0 0 0 0 4 0 0 | ||
1.4289 0.2062 0.0000 O 0 0 0 0 0 0 0 0 0 5 0 0 | ||
1 2 1 0 0 | ||
2 3 1 0 0 | ||
3 4 1 0 0 | ||
4 5 1 0 0 | ||
M END |
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,27 @@ | ||
'use strict'; | ||
|
||
const { readFileSync } = require('fs'); | ||
|
||
const { Molecule } = require('../minimal'); | ||
|
||
|
||
|
||
test('molfile with atomMapNo', () => { | ||
const molfile = readFileSync( | ||
`${__dirname}/data/atomMapNo.mol`, | ||
'utf8', | ||
); | ||
const molecule = Molecule.fromMolfile(molfile); | ||
|
||
const newMolfile = molecule.toMolfile(); | ||
const atomMapNo = newMolfile.split(/\r?\n/).filter((line) => line.match(/ [OCH] /)) | ||
.map(line => line.replace(/.* ([OCH]) .*(.) {2}0 {2}0$/, '$1 $2')); | ||
Check warning on line 18 in __tests__/molfileAndAtomMapNo.test.js GitHub Actions / lint
|
||
expect(atomMapNo).toStrictEqual(['O 5', 'C 1', 'C 3', 'C 4', 'H 2']) | ||
|
||
const svg = molecule.toSVG(300, 200); | ||
const mapNos = svg.split(/\r?\n/).filter((line) => line.includes('data-atom-map')).map(line => line.replace(/.*atom-map-no="(.).*/, '$1')); | ||
expect(mapNos).toStrictEqual(["5", "1", "3", "4", "2"]) | ||
|
||
|
||
|
||
}) |
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