@blotch/dolan 22.2.2 → 22.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commands/add.d.ts +6 -2
- package/dist/commands/add.js +41 -11
- package/dist/commands/add.js.map +1 -1
- package/dist/commands/add.test.js +162 -9
- package/dist/commands/add.test.js.map +1 -1
- package/dist/commands/diff.d.ts +2 -1
- package/dist/commands/diff.js +38 -25
- package/dist/commands/diff.js.map +1 -1
- package/dist/commands/diff.test.js +72 -11
- package/dist/commands/diff.test.js.map +1 -1
- package/dist/commands/doctor.js +228 -34
- package/dist/commands/doctor.js.map +1 -1
- package/dist/commands/doctor.test.js +367 -10
- package/dist/commands/doctor.test.js.map +1 -1
- package/dist/commands/eject.js +7 -0
- package/dist/commands/eject.js.map +1 -1
- package/dist/commands/eject.test.js +39 -0
- package/dist/commands/eject.test.js.map +1 -1
- package/dist/commands/info.js +3 -2
- package/dist/commands/info.js.map +1 -1
- package/dist/commands/init.d.ts +37 -1
- package/dist/commands/init.js +169 -40
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/init.test.js +392 -27
- package/dist/commands/init.test.js.map +1 -1
- package/dist/commands/install-packages.d.ts +6 -0
- package/dist/commands/install-packages.js +20 -0
- package/dist/commands/install-packages.js.map +1 -0
- package/dist/commands/install-packages.test.d.ts +1 -0
- package/dist/commands/install-packages.test.js +55 -0
- package/dist/commands/install-packages.test.js.map +1 -0
- package/dist/commands/list.js +21 -14
- package/dist/commands/list.js.map +1 -1
- package/dist/commands/list.test.js +62 -5
- package/dist/commands/list.test.js.map +1 -1
- package/dist/commands/outdated.js +11 -10
- package/dist/commands/outdated.js.map +1 -1
- package/dist/commands/outdated.test.js +20 -5
- package/dist/commands/outdated.test.js.map +1 -1
- package/dist/commands/remove.d.ts +4 -0
- package/dist/commands/remove.js +17 -4
- package/dist/commands/remove.js.map +1 -1
- package/dist/commands/remove.test.js +53 -2
- package/dist/commands/remove.test.js.map +1 -1
- package/dist/commands/theme.js +1 -1
- package/dist/commands/theme.js.map +1 -1
- package/dist/commands/update.d.ts +11 -0
- package/dist/commands/update.js +174 -58
- package/dist/commands/update.js.map +1 -1
- package/dist/commands/update.test.js +587 -33
- package/dist/commands/update.test.js.map +1 -1
- package/dist/index.js +7 -0
- package/dist/index.js.map +1 -1
- package/dist/lockfile.d.ts +7 -0
- package/dist/lockfile.js +36 -0
- package/dist/lockfile.js.map +1 -1
- package/dist/lockfile.test.d.ts +1 -0
- package/dist/lockfile.test.js +25 -0
- package/dist/lockfile.test.js.map +1 -0
- package/dist/registry.d.ts +14 -0
- package/dist/registry.js +78 -24
- package/dist/registry.js.map +1 -1
- package/dist/registry.test.js +119 -38
- package/dist/registry.test.js.map +1 -1
- package/dist/test-utils.d.ts +5 -0
- package/dist/test-utils.js +6 -1
- package/dist/test-utils.js.map +1 -1
- package/dist/testing/fire-lynx-event.d.ts +14 -0
- package/dist/testing/fire-lynx-event.js +19 -0
- package/dist/testing/fire-lynx-event.js.map +1 -0
- package/dist/testing/fire-lynx-event.test.d.ts +1 -0
- package/dist/testing/fire-lynx-event.test.js +44 -0
- package/dist/testing/fire-lynx-event.test.js.map +1 -0
- package/dist/testing/lynx-main-thread.d.ts +22 -0
- package/dist/testing/lynx-main-thread.js +11 -0
- package/dist/testing/lynx-main-thread.js.map +1 -0
- package/dist/testing/lynx-main-thread.test.d.ts +1 -0
- package/dist/testing/lynx-main-thread.test.js +24 -0
- package/dist/testing/lynx-main-thread.test.js.map +1 -0
- package/dist/testing/set-input-signal.d.ts +14 -0
- package/dist/testing/set-input-signal.js +21 -0
- package/dist/testing/set-input-signal.js.map +1 -0
- package/dist/testing/set-input-signal.test.d.ts +1 -0
- package/dist/testing/set-input-signal.test.js +20 -0
- package/dist/testing/set-input-signal.test.js.map +1 -0
- package/dist/ui/components/accordion/accordion.test.ts +158 -144
- package/dist/ui/components/accordion/accordion.ts +19 -14
- package/dist/ui/components/action-sheet/action-sheet.test.ts +283 -151
- package/dist/ui/components/action-sheet/action-sheet.ts +77 -43
- package/dist/ui/components/alert/alert.test.ts +67 -19
- package/dist/ui/components/alert/alert.ts +14 -16
- package/dist/ui/components/alert-dialog/alert-dialog.test.ts +208 -94
- package/dist/ui/components/alert-dialog/alert-dialog.ts +75 -38
- package/dist/ui/components/area-chart/area-chart.test.ts +134 -119
- package/dist/ui/components/area-chart/area-chart.ts +100 -315
- package/dist/ui/components/area-chart/index.ts +2 -3
- package/dist/ui/components/avatar/avatar.test.ts +89 -45
- package/dist/ui/components/badge/badge.test.ts +57 -23
- package/dist/ui/components/badge/badge.ts +12 -14
- package/dist/ui/components/bar-chart/bar-chart.test.ts +172 -45
- package/dist/ui/components/bar-chart/bar-chart.ts +140 -294
- package/dist/ui/components/bar-chart/index.ts +3 -3
- package/dist/ui/components/bottom-sheet/bottom-sheet.test.ts +386 -128
- package/dist/ui/components/bottom-sheet/bottom-sheet.ts +170 -53
- package/dist/ui/components/button/button.test.ts +611 -2
- package/dist/ui/components/button/button.ts +434 -49
- package/dist/ui/components/button/index.ts +2 -0
- package/dist/ui/components/button-group/button-group.test.ts +484 -2
- package/dist/ui/components/button-group/button-group.ts +380 -68
- package/dist/ui/components/button-group/index.ts +3 -0
- package/dist/ui/components/candlestick-chart/candlestick-chart.test.ts +183 -58
- package/dist/ui/components/candlestick-chart/candlestick-chart.ts +150 -323
- package/dist/ui/components/candlestick-chart/index.ts +3 -4
- package/dist/ui/components/card/card.test.ts +82 -62
- package/dist/ui/components/chart/chart-focus.test.ts +132 -0
- package/dist/ui/components/chart/chart-focus.ts +115 -0
- package/dist/ui/components/chart/chart-presets.test.ts +335 -0
- package/dist/ui/components/chart/chart-presets.ts +278 -0
- package/dist/ui/components/chart/chart-scene.test.ts +589 -0
- package/dist/ui/components/chart/chart-scene.ts +483 -0
- package/dist/ui/components/chart/chart-theme.test.ts +85 -0
- package/dist/ui/components/chart/chart-theme.ts +210 -0
- package/dist/ui/components/chart/chart-zoom.test.ts +159 -0
- package/dist/ui/components/chart/chart-zoom.ts +162 -0
- package/dist/ui/components/chart/chart.test.ts +1017 -0
- package/dist/ui/components/chart/chart.ts +934 -0
- package/dist/ui/components/chart/index.ts +24 -0
- package/dist/ui/components/checkbox/checkbox.test.ts +124 -42
- package/dist/ui/components/checkbox/checkbox.ts +23 -23
- package/dist/ui/components/collapsible/collapsible.test.ts +158 -81
- package/dist/ui/components/collapsible/collapsible.ts +19 -14
- package/dist/ui/components/context-menu/context-menu.test.ts +224 -0
- package/dist/ui/components/context-menu/context-menu.ts +110 -0
- package/dist/ui/components/context-menu/index.ts +1 -0
- package/dist/ui/components/dialog/dialog.test.ts +213 -108
- package/dist/ui/components/dialog/dialog.ts +72 -35
- package/dist/ui/components/dock/dock-scroll.test.ts +130 -0
- package/dist/ui/components/dock/dock-scroll.ts +133 -0
- package/dist/ui/components/dock/dock.test.ts +749 -0
- package/dist/ui/components/dock/dock.ts +960 -0
- package/dist/ui/components/dock/index.ts +2 -0
- package/dist/ui/components/empty-state/empty-state.test.ts +28 -39
- package/dist/ui/components/glass/concentric-radius.test.ts +13 -0
- package/dist/ui/components/glass/concentric-radius.ts +17 -0
- package/dist/ui/components/glass/glass-design.test.ts +78 -0
- package/dist/ui/components/glass/glass-design.ts +119 -0
- package/dist/ui/components/glass/glass.test.ts +338 -0
- package/dist/ui/components/glass/glass.ts +360 -0
- package/dist/ui/components/glass/index.ts +18 -0
- package/dist/ui/components/icon/icon-theme.test.ts +169 -0
- package/dist/ui/components/icon/icon-theme.ts +227 -0
- package/dist/ui/components/icon/icon.test.ts +85 -25
- package/dist/ui/components/icon/icon.ts +38 -21
- package/dist/ui/components/input/input.test.ts +178 -101
- package/dist/ui/components/input/input.ts +15 -12
- package/dist/ui/components/label/label.test.ts +11 -24
- package/dist/ui/components/line-chart/index.ts +2 -3
- package/dist/ui/components/line-chart/line-chart.test.ts +149 -56
- package/dist/ui/components/line-chart/line-chart.ts +83 -241
- package/dist/ui/components/list/list.test.ts +119 -21
- package/dist/ui/components/list/list.ts +21 -15
- package/dist/ui/components/menu/index.ts +25 -0
- package/dist/ui/components/menu/menu-placement.test.ts +153 -0
- package/dist/ui/components/menu/menu-placement.ts +159 -0
- package/dist/ui/components/menu/menu-popup.test.ts +632 -0
- package/dist/ui/components/menu/menu-popup.ts +544 -0
- package/dist/ui/components/menu/menu.test.ts +429 -0
- package/dist/ui/components/menu/menu.ts +415 -0
- package/dist/ui/components/nav-drawer/nav-drawer.test.ts +435 -191
- package/dist/ui/components/nav-drawer/nav-drawer.ts +127 -56
- package/dist/ui/components/pagination/pagination.test.ts +177 -65
- package/dist/ui/components/pagination/pagination.ts +55 -8
- package/dist/ui/components/progress/progress.test.ts +102 -46
- package/dist/ui/components/progress/progress.ts +52 -54
- package/dist/ui/components/radio-group/radio-group.test.ts +128 -83
- package/dist/ui/components/radio-group/radio-group.ts +24 -24
- package/dist/ui/components/scatter-chart/index.ts +2 -3
- package/dist/ui/components/scatter-chart/scatter-chart.test.ts +131 -26
- package/dist/ui/components/scatter-chart/scatter-chart.ts +104 -250
- package/dist/ui/components/scroll-area/scroll-area.test.ts +95 -24
- package/dist/ui/components/scroll-area/scroll-area.ts +8 -8
- package/dist/ui/components/select/select.test.ts +138 -78
- package/dist/ui/components/select/select.ts +17 -11
- package/dist/ui/components/separator/separator.test.ts +18 -17
- package/dist/ui/components/sheet/sheet.test.ts +64 -11
- package/dist/ui/components/sheet/sheet.ts +9 -1
- package/dist/ui/components/skeleton/skeleton.test.ts +24 -7
- package/dist/ui/components/skeleton/skeleton.ts +10 -16
- package/dist/ui/components/spinner/spinner.test.ts +67 -22
- package/dist/ui/components/spinner/spinner.ts +48 -41
- package/dist/ui/components/switch/switch.test.ts +116 -46
- package/dist/ui/components/switch/switch.ts +8 -13
- package/dist/ui/components/tab-bar/index.ts +1 -0
- package/dist/ui/components/tab-bar/tab-bar.test.ts +280 -0
- package/dist/ui/components/tab-bar/tab-bar.ts +230 -0
- package/dist/ui/components/tabs/tabs.test.ts +215 -157
- package/dist/ui/components/tabs/tabs.ts +110 -118
- package/dist/ui/components/textarea/textarea.test.ts +206 -100
- package/dist/ui/components/textarea/textarea.ts +14 -12
- package/dist/ui/components/toast/toast.test.ts +436 -315
- package/dist/ui/components/toast/toast.ts +62 -55
- package/dist/ui/components/toggle/toggle.test.ts +247 -140
- package/dist/ui/theme/chart-colors.test.ts +35 -0
- package/dist/ui/theme/dark.css +46 -2
- package/dist/ui/theme/default.css +63 -7
- package/dist/ui/theme/icon-colors.test.ts +35 -0
- package/dist/ui/theme/rgb-channels.test.ts +84 -0
- package/dist/ui/theme/tailwind-build.test.ts +114 -0
- package/dist/ui/theme/tailwind-css.test.ts +83 -0
- package/dist/ui/theme/tailwind-plugin.test.ts +42 -2
- package/dist/ui/theme/tailwind-plugin.ts +98 -25
- package/dist/ui/theme/tailwind.css +113 -0
- package/dist/ui/utils/animate.test.ts +13 -1
- package/dist/utils/analyze.d.ts +14 -0
- package/dist/utils/analyze.js +15 -0
- package/dist/utils/analyze.js.map +1 -1
- package/dist/utils/analyze.test.js +14 -1
- package/dist/utils/analyze.test.js.map +1 -1
- package/dist/utils/installed.d.ts +29 -0
- package/dist/utils/installed.js +43 -0
- package/dist/utils/installed.js.map +1 -0
- package/dist/utils/installed.test.d.ts +1 -0
- package/dist/utils/installed.test.js +57 -0
- package/dist/utils/installed.test.js.map +1 -0
- package/dist/utils/interactive.d.ts +9 -0
- package/dist/utils/interactive.js +10 -0
- package/dist/utils/interactive.js.map +1 -0
- package/dist/utils/interactive.test.d.ts +1 -0
- package/dist/utils/interactive.test.js +24 -0
- package/dist/utils/interactive.test.js.map +1 -0
- package/dist/utils/packages.d.ts +36 -0
- package/dist/utils/packages.js +70 -0
- package/dist/utils/packages.js.map +1 -0
- package/dist/utils/packages.test.d.ts +1 -0
- package/dist/utils/packages.test.js +89 -0
- package/dist/utils/packages.test.js.map +1 -0
- package/dist/utils/resolve-paths.d.ts +17 -1
- package/dist/utils/resolve-paths.js +21 -3
- package/dist/utils/resolve-paths.js.map +1 -1
- package/dist/utils/resolve-paths.test.js +38 -2
- package/dist/utils/resolve-paths.test.js.map +1 -1
- package/dist/utils/tailwind.d.ts +25 -0
- package/dist/utils/tailwind.js +51 -0
- package/dist/utils/tailwind.js.map +1 -0
- package/dist/utils/tailwind.test.d.ts +1 -0
- package/dist/utils/tailwind.test.js +71 -0
- package/dist/utils/tailwind.test.js.map +1 -0
- package/package.json +13 -1
- package/dist/ui/components/area-chart/area-chart-render.test.ts +0 -121
- package/dist/ui/components/bar-chart/bar-chart-render.test.ts +0 -174
- package/dist/ui/components/button/button-render.test.ts +0 -113
- package/dist/ui/components/button-group/button-group-render.test.ts +0 -146
- package/dist/ui/components/candlestick-chart/candlestick-chart-render.test.ts +0 -174
- package/dist/ui/components/cartesian-chart/cartesian-chart-render.test.ts +0 -188
- package/dist/ui/components/cartesian-chart/cartesian-chart.test.ts +0 -525
- package/dist/ui/components/cartesian-chart/cartesian-chart.ts +0 -1140
- package/dist/ui/components/cartesian-chart/index.ts +0 -18
- package/dist/ui/components/line-chart/line-chart-render.test.ts +0 -121
- package/dist/ui/components/scatter-chart/scatter-chart-render.test.ts +0 -157
|
@@ -1,174 +0,0 @@
|
|
|
1
|
-
import { render, waitForUpdate } from '@blotch/angular-lynx-testing-library';
|
|
2
|
-
import { describe, expect, it, vi } from 'vitest';
|
|
3
|
-
import { setInputSignal } from '../../../test-utils/set-input-signal';
|
|
4
|
-
import { UiCartesianChart } from '../cartesian-chart/cartesian-chart';
|
|
5
|
-
import {
|
|
6
|
-
UiCandlestickChart,
|
|
7
|
-
UiCandlestickSeries,
|
|
8
|
-
type CandlestickPoint,
|
|
9
|
-
} from './candlestick-chart';
|
|
10
|
-
|
|
11
|
-
const period = (
|
|
12
|
-
x: number,
|
|
13
|
-
o: number,
|
|
14
|
-
h: number,
|
|
15
|
-
l: number,
|
|
16
|
-
c: number,
|
|
17
|
-
): CandlestickPoint => ({ x, open: o, high: h, low: l, close: c });
|
|
18
|
-
|
|
19
|
-
describe('UiCandlestickChart', () => {
|
|
20
|
-
it('renders with default configuration', async () => {
|
|
21
|
-
const { container } = await render(UiCandlestickChart);
|
|
22
|
-
expect(container).toBeTruthy();
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
it('derives the y-axis from the lowest low and highest high', async () => {
|
|
26
|
-
const { componentRef } = await render(UiCandlestickChart);
|
|
27
|
-
const inst = componentRef.instance as UiCandlestickChart;
|
|
28
|
-
setInputSignal(inst.data, [
|
|
29
|
-
period(0, 10, 15, 5, 12),
|
|
30
|
-
period(1, 12, 20, 8, 18),
|
|
31
|
-
period(2, 18, 22, 14, 16),
|
|
32
|
-
]);
|
|
33
|
-
await waitForUpdate();
|
|
34
|
-
const cast = inst as unknown as {
|
|
35
|
-
xAxis: () => { domain: readonly [number, number] };
|
|
36
|
-
yAxis: () => { domain: readonly [number, number] };
|
|
37
|
-
effectivePadding: () => { left?: number; right?: number };
|
|
38
|
-
};
|
|
39
|
-
expect(cast.xAxis().domain[0]).toBeLessThanOrEqual(0);
|
|
40
|
-
expect(cast.xAxis().domain[1]).toBeGreaterThanOrEqual(2);
|
|
41
|
-
expect(cast.yAxis().domain[0]).toBeLessThanOrEqual(5);
|
|
42
|
-
expect(cast.yAxis().domain[1]).toBeGreaterThanOrEqual(22);
|
|
43
|
-
// 3 candles → half = 0.5 / 2 = 0.25
|
|
44
|
-
expect(cast.effectivePadding().left).toBeCloseTo(0.25);
|
|
45
|
-
expect(cast.effectivePadding().right).toBeCloseTo(0.25);
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
it('honors explicit xMin / xMax / yMin / yMax overrides', async () => {
|
|
49
|
-
const { componentRef } = await render(UiCandlestickChart);
|
|
50
|
-
const inst = componentRef.instance as UiCandlestickChart;
|
|
51
|
-
setInputSignal(inst.data, [period(0, 10, 15, 5, 12)]);
|
|
52
|
-
setInputSignal(inst.xMin, -5);
|
|
53
|
-
setInputSignal(inst.xMax, 20);
|
|
54
|
-
setInputSignal(inst.yMin, 0);
|
|
55
|
-
setInputSignal(inst.yMax, 100);
|
|
56
|
-
await waitForUpdate();
|
|
57
|
-
const cast = inst as unknown as {
|
|
58
|
-
xAxis: () => { domain: readonly [number, number] };
|
|
59
|
-
yAxis: () => { domain: readonly [number, number] };
|
|
60
|
-
};
|
|
61
|
-
expect(cast.xAxis().domain[0]).toBeLessThanOrEqual(-5);
|
|
62
|
-
expect(cast.xAxis().domain[1]).toBeGreaterThanOrEqual(20);
|
|
63
|
-
expect(cast.yAxis().domain[0]).toBeLessThanOrEqual(0);
|
|
64
|
-
expect(cast.yAxis().domain[1]).toBeGreaterThanOrEqual(100);
|
|
65
|
-
});
|
|
66
|
-
|
|
67
|
-
it('single-datum series drops the half-candle padding', async () => {
|
|
68
|
-
const { componentRef } = await render(UiCandlestickChart);
|
|
69
|
-
const inst = componentRef.instance as UiCandlestickChart;
|
|
70
|
-
setInputSignal(inst.data, [period(0, 10, 15, 5, 12)]);
|
|
71
|
-
await waitForUpdate();
|
|
72
|
-
const cast = inst as unknown as {
|
|
73
|
-
effectivePadding: () => { left?: number; right?: number };
|
|
74
|
-
};
|
|
75
|
-
expect(cast.effectivePadding().left).toBe(0);
|
|
76
|
-
expect(cast.effectivePadding().right).toBe(0);
|
|
77
|
-
});
|
|
78
|
-
|
|
79
|
-
it('user padding overrides the auto half-candle inset per side', async () => {
|
|
80
|
-
const { componentRef } = await render(UiCandlestickChart);
|
|
81
|
-
const inst = componentRef.instance as UiCandlestickChart;
|
|
82
|
-
setInputSignal(inst.data, [
|
|
83
|
-
period(0, 10, 15, 5, 12),
|
|
84
|
-
period(1, 12, 20, 8, 18),
|
|
85
|
-
]);
|
|
86
|
-
setInputSignal(inst.padding, { right: 0.05 });
|
|
87
|
-
await waitForUpdate();
|
|
88
|
-
const cast = inst as unknown as {
|
|
89
|
-
effectivePadding: () => { left?: number; right?: number };
|
|
90
|
-
};
|
|
91
|
-
expect(cast.effectivePadding().right).toBeCloseTo(0.05);
|
|
92
|
-
expect(cast.effectivePadding().left).toBeCloseTo(0.5);
|
|
93
|
-
});
|
|
94
|
-
|
|
95
|
-
it('exposes the default tick formatter used by the child cartesian chart', async () => {
|
|
96
|
-
const { componentRef } = await render(UiCandlestickChart);
|
|
97
|
-
const inst = componentRef.instance as UiCandlestickChart;
|
|
98
|
-
expect(inst.xTickFormat()(3.14159)).toBe('3.14');
|
|
99
|
-
expect(inst.yTickFormat()(1.005)).toBe('1');
|
|
100
|
-
});
|
|
101
|
-
});
|
|
102
|
-
|
|
103
|
-
describe('UiCandlestickSeries', () => {
|
|
104
|
-
const renderSeries = async () => {
|
|
105
|
-
const parentResult = await render(UiCartesianChart);
|
|
106
|
-
const parent = parentResult.componentRef.instance as UiCartesianChart;
|
|
107
|
-
setInputSignal(parent.xDomain, [0, 10]);
|
|
108
|
-
setInputSignal(parent.yDomain, [0, 100]);
|
|
109
|
-
await waitForUpdate();
|
|
110
|
-
const seriesResult = await render(UiCandlestickSeries, {
|
|
111
|
-
providers: [{ provide: UiCartesianChart, useValue: parent }],
|
|
112
|
-
});
|
|
113
|
-
const series = seriesResult.componentRef.instance as UiCandlestickSeries;
|
|
114
|
-
setInputSignal(series.data, [
|
|
115
|
-
// up candle (close >= open)
|
|
116
|
-
period(0, 10, 20, 5, 15),
|
|
117
|
-
// down candle (close < open)
|
|
118
|
-
period(5, 60, 70, 50, 55),
|
|
119
|
-
// doji (close === open)
|
|
120
|
-
period(10, 40, 50, 30, 40),
|
|
121
|
-
]);
|
|
122
|
-
await waitForUpdate();
|
|
123
|
-
return { parent, series };
|
|
124
|
-
};
|
|
125
|
-
|
|
126
|
-
it('renders a wick + body for each period, tinted by direction', async () => {
|
|
127
|
-
const { series } = await renderSeries();
|
|
128
|
-
const cast = series as unknown as {
|
|
129
|
-
candles: () => {
|
|
130
|
-
wickStyle: string;
|
|
131
|
-
bodyStyle: string;
|
|
132
|
-
point: CandlestickPoint;
|
|
133
|
-
}[];
|
|
134
|
-
};
|
|
135
|
-
const candles = cast.candles();
|
|
136
|
-
expect(candles.length).toBe(3);
|
|
137
|
-
// First: up candle → uses upColor (green rgba)
|
|
138
|
-
expect(candles[0].bodyStyle).toContain('rgba(34, 197, 94, 1)');
|
|
139
|
-
// Second: down candle → uses downColor (red rgba)
|
|
140
|
-
expect(candles[1].bodyStyle).toContain('rgba(239, 68, 68, 1)');
|
|
141
|
-
// Third: doji (open === close) is `up: true` (>= comparison)
|
|
142
|
-
expect(candles[2].bodyStyle).toContain('rgba(34, 197, 94, 1)');
|
|
143
|
-
});
|
|
144
|
-
|
|
145
|
-
it('emits candleTap with the source point when a body is tapped', async () => {
|
|
146
|
-
const { series } = await renderSeries();
|
|
147
|
-
const cb = vi.fn();
|
|
148
|
-
series.candleTap.subscribe(cb);
|
|
149
|
-
const p = period(1, 2, 3, 1, 2);
|
|
150
|
-
(
|
|
151
|
-
series as unknown as { onCandleTap: (point: CandlestickPoint) => void }
|
|
152
|
-
).onCandleTap(p);
|
|
153
|
-
expect(cb).toHaveBeenCalledWith(p);
|
|
154
|
-
});
|
|
155
|
-
|
|
156
|
-
it('single-datum series uses the fallback body width', async () => {
|
|
157
|
-
const parentResult = await render(UiCartesianChart);
|
|
158
|
-
const parent = parentResult.componentRef.instance as UiCartesianChart;
|
|
159
|
-
setInputSignal(parent.xDomain, [0, 10]);
|
|
160
|
-
setInputSignal(parent.yDomain, [0, 100]);
|
|
161
|
-
await waitForUpdate();
|
|
162
|
-
const seriesResult = await render(UiCandlestickSeries, {
|
|
163
|
-
providers: [{ provide: UiCartesianChart, useValue: parent }],
|
|
164
|
-
});
|
|
165
|
-
const series = seriesResult.componentRef.instance as UiCandlestickSeries;
|
|
166
|
-
setInputSignal(series.data, [period(5, 10, 15, 5, 12)]);
|
|
167
|
-
await waitForUpdate();
|
|
168
|
-
const cast = series as unknown as {
|
|
169
|
-
candles: () => { bodyStyle: string }[];
|
|
170
|
-
};
|
|
171
|
-
// fallback body width = 8px
|
|
172
|
-
expect(cast.candles()[0].bodyStyle).toContain('width: 8.00px');
|
|
173
|
-
});
|
|
174
|
-
});
|
|
@@ -1,188 +0,0 @@
|
|
|
1
|
-
import { render, waitForUpdate } from '@blotch/angular-lynx-testing-library';
|
|
2
|
-
import { describe, expect, it } from 'vitest';
|
|
3
|
-
import { setInputSignal } from '../../../test-utils/set-input-signal';
|
|
4
|
-
import { UiCartesianChart } from './cartesian-chart';
|
|
5
|
-
|
|
6
|
-
// These tests exercise the class methods and template-facing computed signals of the
|
|
7
|
-
// full chart component (the sibling test file covers just the exported pure
|
|
8
|
-
// geometry helpers with a mocked Angular).
|
|
9
|
-
describe('UiCartesianChart — component', () => {
|
|
10
|
-
const readComputedSignals = (inst: UiCartesianChart) => {
|
|
11
|
-
const cast = inst as unknown as {
|
|
12
|
-
containerClass: () => string;
|
|
13
|
-
containerStyle: () => string;
|
|
14
|
-
plotStyle: () => string;
|
|
15
|
-
gridlines: () => { style: string }[];
|
|
16
|
-
verticalGridlines: () => { style: string }[];
|
|
17
|
-
yLabels: () => { style: string; text: string }[];
|
|
18
|
-
xLabels: () => { style: string; text: string }[];
|
|
19
|
-
yAxisLabelStyle: () => string;
|
|
20
|
-
xAxisLabelStyle: () => string;
|
|
21
|
-
zoomControlsStyle: () => string;
|
|
22
|
-
};
|
|
23
|
-
return {
|
|
24
|
-
containerClass: cast.containerClass(),
|
|
25
|
-
containerStyle: cast.containerStyle(),
|
|
26
|
-
plotStyle: cast.plotStyle(),
|
|
27
|
-
gridlines: cast.gridlines(),
|
|
28
|
-
verticalGridlines: cast.verticalGridlines(),
|
|
29
|
-
yLabels: cast.yLabels(),
|
|
30
|
-
xLabels: cast.xLabels(),
|
|
31
|
-
yAxisLabelStyle: cast.yAxisLabelStyle(),
|
|
32
|
-
xAxisLabelStyle: cast.xAxisLabelStyle(),
|
|
33
|
-
zoomControlsStyle: cast.zoomControlsStyle(),
|
|
34
|
-
};
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
it('renders with default configuration', async () => {
|
|
38
|
-
const { container } = await render(UiCartesianChart);
|
|
39
|
-
expect(container).toBeTruthy();
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
it('exposes shared scales that project data into the plot area', async () => {
|
|
43
|
-
const { componentRef } = await render(UiCartesianChart);
|
|
44
|
-
const inst = componentRef.instance as UiCartesianChart;
|
|
45
|
-
setInputSignal(inst.xDomain, [0, 100]);
|
|
46
|
-
setInputSignal(inst.yDomain, [0, 50]);
|
|
47
|
-
await waitForUpdate();
|
|
48
|
-
expect(typeof inst.xScale()).toBe('function');
|
|
49
|
-
expect(typeof inst.yScale()).toBe('function');
|
|
50
|
-
expect(inst.plotWidth()).toBeGreaterThan(0);
|
|
51
|
-
expect(inst.plotHeight()).toBeGreaterThan(0);
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
it('produces gridlines, tick labels, and axis label styles', async () => {
|
|
55
|
-
const { componentRef } = await render(UiCartesianChart);
|
|
56
|
-
const inst = componentRef.instance as UiCartesianChart;
|
|
57
|
-
setInputSignal(inst.xDomain, [0, 100]);
|
|
58
|
-
setInputSignal(inst.yDomain, [0, 100]);
|
|
59
|
-
setInputSignal(inst.xAxisLabel, 'X label');
|
|
60
|
-
setInputSignal(inst.yAxisLabel, 'Y label');
|
|
61
|
-
setInputSignal(inst.showGrid, true);
|
|
62
|
-
setInputSignal(inst.showXGrid, true);
|
|
63
|
-
await waitForUpdate();
|
|
64
|
-
const c = readComputedSignals(inst);
|
|
65
|
-
expect(c.gridlines.length).toBeGreaterThan(0);
|
|
66
|
-
expect(c.verticalGridlines.length).toBeGreaterThan(0);
|
|
67
|
-
expect(c.yLabels.length).toBeGreaterThan(0);
|
|
68
|
-
expect(c.xLabels.length).toBeGreaterThan(0);
|
|
69
|
-
expect(c.yAxisLabelStyle).toContain('transform');
|
|
70
|
-
expect(c.xAxisLabelStyle.length).toBeGreaterThan(0);
|
|
71
|
-
});
|
|
72
|
-
|
|
73
|
-
it('uses explicit tick arrays when provided', async () => {
|
|
74
|
-
const { componentRef } = await render(UiCartesianChart);
|
|
75
|
-
const inst = componentRef.instance as UiCartesianChart;
|
|
76
|
-
setInputSignal(inst.xDomain, [0, 10]);
|
|
77
|
-
setInputSignal(inst.yDomain, [0, 10]);
|
|
78
|
-
setInputSignal(inst.xTicks, [0, 5, 10]);
|
|
79
|
-
setInputSignal(inst.yTicks, [0, 2, 5, 10]);
|
|
80
|
-
await waitForUpdate();
|
|
81
|
-
const c = readComputedSignals(inst);
|
|
82
|
-
expect(c.yLabels.map((l) => l.text).join(',')).toContain('5');
|
|
83
|
-
expect(c.xLabels.map((l) => l.text).join(',')).toContain('5');
|
|
84
|
-
});
|
|
85
|
-
|
|
86
|
-
it('hides gridlines when disabled', async () => {
|
|
87
|
-
const { componentRef } = await render(UiCartesianChart);
|
|
88
|
-
const inst = componentRef.instance as UiCartesianChart;
|
|
89
|
-
setInputSignal(inst.showGrid, false);
|
|
90
|
-
setInputSignal(inst.showXGrid, false);
|
|
91
|
-
await waitForUpdate();
|
|
92
|
-
// Even with showGrid=false the computed still runs — just verify the
|
|
93
|
-
// container mounts cleanly.
|
|
94
|
-
expect(readComputedSignals(inst).plotStyle.length).toBeGreaterThan(0);
|
|
95
|
-
});
|
|
96
|
-
|
|
97
|
-
it('applies inner padding to shrink the projected range', async () => {
|
|
98
|
-
const { componentRef } = await render(UiCartesianChart);
|
|
99
|
-
const inst = componentRef.instance as UiCartesianChart;
|
|
100
|
-
setInputSignal(inst.xDomain, [0, 100]);
|
|
101
|
-
setInputSignal(inst.yDomain, [0, 100]);
|
|
102
|
-
setInputSignal(inst.padding, {
|
|
103
|
-
top: 0.1,
|
|
104
|
-
bottom: 0.1,
|
|
105
|
-
left: 0.1,
|
|
106
|
-
right: 0.1,
|
|
107
|
-
});
|
|
108
|
-
await waitForUpdate();
|
|
109
|
-
const scaleAtZero = inst.xScale()(0);
|
|
110
|
-
expect(scaleAtZero).toBeGreaterThan(0);
|
|
111
|
-
});
|
|
112
|
-
|
|
113
|
-
it('zoomIn / zoomOut / resetZoom on the xy axes', async () => {
|
|
114
|
-
const { componentRef } = await render(UiCartesianChart);
|
|
115
|
-
const inst = componentRef.instance as UiCartesianChart;
|
|
116
|
-
setInputSignal(inst.xDomain, [0, 100]);
|
|
117
|
-
setInputSignal(inst.yDomain, [0, 100]);
|
|
118
|
-
setInputSignal(inst.zoomable, true);
|
|
119
|
-
await waitForUpdate();
|
|
120
|
-
inst.zoomIn();
|
|
121
|
-
inst.zoomOut();
|
|
122
|
-
inst.zoomIn();
|
|
123
|
-
inst.resetZoom();
|
|
124
|
-
// No throw; the internal view domains reset to null at rest.
|
|
125
|
-
expect(inst.xScale()(0)).toBeLessThan(inst.xScale()(100));
|
|
126
|
-
});
|
|
127
|
-
|
|
128
|
-
it('zoomIn only along the x-axis when zoomAxes = "x"', async () => {
|
|
129
|
-
const { componentRef } = await render(UiCartesianChart);
|
|
130
|
-
const inst = componentRef.instance as UiCartesianChart;
|
|
131
|
-
setInputSignal(inst.xDomain, [0, 100]);
|
|
132
|
-
setInputSignal(inst.yDomain, [0, 100]);
|
|
133
|
-
setInputSignal(inst.zoomable, true);
|
|
134
|
-
setInputSignal(inst.zoomAxes, 'x');
|
|
135
|
-
await waitForUpdate();
|
|
136
|
-
inst.zoomIn();
|
|
137
|
-
inst.zoomIn();
|
|
138
|
-
expect(typeof inst.xScale()).toBe('function');
|
|
139
|
-
});
|
|
140
|
-
|
|
141
|
-
it('zoomIn only along the y-axis when zoomAxes = "y"', async () => {
|
|
142
|
-
const { componentRef } = await render(UiCartesianChart);
|
|
143
|
-
const inst = componentRef.instance as UiCartesianChart;
|
|
144
|
-
setInputSignal(inst.xDomain, [0, 100]);
|
|
145
|
-
setInputSignal(inst.yDomain, [0, 100]);
|
|
146
|
-
setInputSignal(inst.zoomable, true);
|
|
147
|
-
setInputSignal(inst.zoomAxes, 'y');
|
|
148
|
-
await waitForUpdate();
|
|
149
|
-
inst.zoomIn();
|
|
150
|
-
inst.zoomIn();
|
|
151
|
-
expect(typeof inst.yScale()).toBe('function');
|
|
152
|
-
});
|
|
153
|
-
|
|
154
|
-
it('shows zoom controls only when zoomable', async () => {
|
|
155
|
-
const { componentRef } = await render(UiCartesianChart);
|
|
156
|
-
const inst = componentRef.instance as UiCartesianChart;
|
|
157
|
-
setInputSignal(inst.zoomable, true);
|
|
158
|
-
setInputSignal(inst.showZoomControls, true);
|
|
159
|
-
await waitForUpdate();
|
|
160
|
-
expect(readComputedSignals(inst).zoomControlsStyle.length).toBeGreaterThan(
|
|
161
|
-
0,
|
|
162
|
-
);
|
|
163
|
-
});
|
|
164
|
-
|
|
165
|
-
it('containerClass includes user class alias', async () => {
|
|
166
|
-
const { componentRef } = await render(UiCartesianChart);
|
|
167
|
-
const inst = componentRef.instance as UiCartesianChart;
|
|
168
|
-
setInputSignal(inst.userClass, 'my-chart');
|
|
169
|
-
await waitForUpdate();
|
|
170
|
-
expect(readComputedSignals(inst).containerClass).toContain('my-chart');
|
|
171
|
-
});
|
|
172
|
-
|
|
173
|
-
it('zoomIn on a zero-width x-domain collapses back to rest (full-span guard)', async () => {
|
|
174
|
-
const { componentRef } = await render(UiCartesianChart);
|
|
175
|
-
const inst = componentRef.instance as UiCartesianChart;
|
|
176
|
-
// A degenerate domain forces the #isFullSpan(baseSpan === 0) branch when
|
|
177
|
-
// any zoom write is attempted.
|
|
178
|
-
setInputSignal(inst.xDomain, [5, 5]);
|
|
179
|
-
setInputSignal(inst.yDomain, [5, 5]);
|
|
180
|
-
setInputSignal(inst.zoomable, true);
|
|
181
|
-
await waitForUpdate();
|
|
182
|
-
inst.zoomIn();
|
|
183
|
-
inst.zoomOut();
|
|
184
|
-
inst.resetZoom();
|
|
185
|
-
// Scales remain callable and produce a finite pixel value at the domain point.
|
|
186
|
-
expect(Number.isFinite(inst.xScale()(5))).toBe(true);
|
|
187
|
-
});
|
|
188
|
-
});
|