Skip to content

Commit 72d8018

Browse files
harlantwoodCI Bot
andauthored
Bufix: pass settings to from Radix to AspectCalculator (#71)
* Test to drive bugfix: #71 * Bufix: pass settings to from Radix to AspectCalculator --------- Co-authored-by: CI Bot <[email protected]>
1 parent a16fb94 commit 72d8018

File tree

3 files changed

+44
-1
lines changed

3 files changed

+44
-1
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
"types": "./dist/project/src/index.d.ts",
1919
"scripts": {
2020
"test": "jest",
21+
"test:w": "jest --watch",
2122
"test:coverage": "jest --coverage",
2223
"build": "webpack",
2324
"build:w": "webpack --watch",

project/src/radix.test.ts

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
import Radix from './radix';
2+
import SVG from './svg';
3+
import default_settings from './settings';
4+
5+
describe('Radix', () => {
6+
const data = {
7+
planets: {
8+
Sun: [0],
9+
Moon: [90],
10+
},
11+
cusps: [0, 30, 60, 90, 120, 150, 180, 210, 240, 270, 300, 330]
12+
};
13+
14+
it('should draw aspect lines with default colors', () => {
15+
document.body.innerHTML = '<div id="chart"></div>';
16+
const settings = default_settings;
17+
const paper = new SVG('chart', 500, 500, settings);
18+
const radix = new Radix(paper, 500, 500, 500, data, settings);
19+
radix.aspects();
20+
21+
const aspectLines = document.querySelectorAll('#chart-astrology-aspects > line');
22+
expect(aspectLines[0].getAttribute('stroke')).toBe(default_settings.ASPECTS.square.color);
23+
});
24+
25+
it('should draw aspect lines with custom colors via settings', () => {
26+
document.body.innerHTML = '<div id="chart"></div>';
27+
28+
const settings = {
29+
...default_settings,
30+
ASPECTS: {
31+
square: { degree: 90, orbit: 10, color: 'purple' },
32+
},
33+
};
34+
35+
const paper = new SVG('chart', 500, 500, settings);
36+
const radix = new Radix(paper, 500, 500, 500, data, settings);
37+
radix.aspects();
38+
39+
const aspectLines = document.querySelectorAll('#chart-astrology-aspects > line');
40+
expect(aspectLines[0].getAttribute('stroke')).toBe('purple');
41+
});
42+
});

project/src/radix.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,7 @@ class Radix {
327327
aspects(customAspects?: FormedAspect[] | null): Radix {
328328
const aspectsList = customAspects != null && Array.isArray(customAspects)
329329
? customAspects
330-
: new AspectCalculator(this.toPoints).radix(this.data.planets)
330+
: new AspectCalculator(this.toPoints, this.settings).radix(this.data.planets)
331331

332332
const universe = this.universe
333333
const wrapper = getEmptyWrapper(universe, this.paper.root.id + '-' + this.settings.ID_ASPECTS, this.paper.root.id)

0 commit comments

Comments
 (0)