@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,18 +0,0 @@
|
|
|
1
|
-
export {
|
|
2
|
-
UiCartesianChart,
|
|
3
|
-
linearScale,
|
|
4
|
-
invertLinear,
|
|
5
|
-
niceNum,
|
|
6
|
-
niceScale,
|
|
7
|
-
generateTicks,
|
|
8
|
-
generateAlignedTicks,
|
|
9
|
-
isValueOutsideDomain,
|
|
10
|
-
gridlineOffset,
|
|
11
|
-
clampWindow,
|
|
12
|
-
panWindow,
|
|
13
|
-
zoomWindow,
|
|
14
|
-
type ChartPoint,
|
|
15
|
-
type ChartDomain,
|
|
16
|
-
type ChartScale,
|
|
17
|
-
type ChartPadding,
|
|
18
|
-
} from './cartesian-chart';
|
|
@@ -1,121 +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 { UiLineChart, UiLineSeries } from './line-chart';
|
|
6
|
-
|
|
7
|
-
describe('UiLineChart', () => {
|
|
8
|
-
it('renders with default configuration', async () => {
|
|
9
|
-
const { container } = await render(UiLineChart);
|
|
10
|
-
expect(container).toBeTruthy();
|
|
11
|
-
});
|
|
12
|
-
|
|
13
|
-
it('computes axis domains from data', async () => {
|
|
14
|
-
const { componentRef } = await render(UiLineChart);
|
|
15
|
-
const inst = componentRef.instance as UiLineChart;
|
|
16
|
-
setInputSignal(inst.data, [
|
|
17
|
-
{ x: 0, y: 0 },
|
|
18
|
-
{ x: 5, y: 10 },
|
|
19
|
-
{ x: 10, y: 5 },
|
|
20
|
-
]);
|
|
21
|
-
await waitForUpdate();
|
|
22
|
-
const cast = inst as unknown as {
|
|
23
|
-
xAxis: () => { domain: readonly [number, number]; ticks: number[] };
|
|
24
|
-
yAxis: () => { domain: readonly [number, number]; ticks: number[] };
|
|
25
|
-
};
|
|
26
|
-
expect(cast.xAxis().domain[0]).toBeLessThanOrEqual(0);
|
|
27
|
-
expect(cast.xAxis().domain[1]).toBeGreaterThanOrEqual(10);
|
|
28
|
-
expect(cast.yAxis().domain[0]).toBeLessThanOrEqual(0);
|
|
29
|
-
expect(cast.yAxis().domain[1]).toBeGreaterThanOrEqual(10);
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
it('honors explicit xMin / xMax / yMin / yMax overrides', async () => {
|
|
33
|
-
const { componentRef } = await render(UiLineChart);
|
|
34
|
-
const inst = componentRef.instance as UiLineChart;
|
|
35
|
-
setInputSignal(inst.data, [
|
|
36
|
-
{ x: 0, y: 0 },
|
|
37
|
-
{ x: 10, y: 10 },
|
|
38
|
-
]);
|
|
39
|
-
setInputSignal(inst.xMin, -5);
|
|
40
|
-
setInputSignal(inst.xMax, 20);
|
|
41
|
-
setInputSignal(inst.yMin, -1);
|
|
42
|
-
setInputSignal(inst.yMax, 15);
|
|
43
|
-
await waitForUpdate();
|
|
44
|
-
const cast = inst as unknown as {
|
|
45
|
-
xAxis: () => { domain: readonly [number, number] };
|
|
46
|
-
yAxis: () => { domain: readonly [number, number] };
|
|
47
|
-
};
|
|
48
|
-
expect(cast.xAxis().domain[0]).toBeLessThanOrEqual(-5);
|
|
49
|
-
expect(cast.xAxis().domain[1]).toBeGreaterThanOrEqual(20);
|
|
50
|
-
expect(cast.yAxis().domain[0]).toBeLessThanOrEqual(-1);
|
|
51
|
-
expect(cast.yAxis().domain[1]).toBeGreaterThanOrEqual(15);
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
it('exposes the default tick formatter used by the child cartesian chart', async () => {
|
|
55
|
-
const { componentRef } = await render(UiLineChart);
|
|
56
|
-
const inst = componentRef.instance as UiLineChart;
|
|
57
|
-
// JIT doesn't wire the child cartesian chart's [xTickFormat] input, so the
|
|
58
|
-
// default formatter is never invoked through the template. Invoke it
|
|
59
|
-
// directly to cover its two-decimal rounding branch.
|
|
60
|
-
expect(inst.xTickFormat()(3.14159)).toBe('3.14');
|
|
61
|
-
expect(inst.yTickFormat()(1.005)).toBe('1');
|
|
62
|
-
});
|
|
63
|
-
});
|
|
64
|
-
|
|
65
|
-
describe('UiLineSeries', () => {
|
|
66
|
-
const renderSeries = async () => {
|
|
67
|
-
const parentResult = await render(UiCartesianChart);
|
|
68
|
-
const parent = parentResult.componentRef.instance as UiCartesianChart;
|
|
69
|
-
setInputSignal(parent.xDomain, [0, 10]);
|
|
70
|
-
setInputSignal(parent.yDomain, [0, 10]);
|
|
71
|
-
await waitForUpdate();
|
|
72
|
-
const seriesResult = await render(UiLineSeries, {
|
|
73
|
-
providers: [{ provide: UiCartesianChart, useValue: parent }],
|
|
74
|
-
});
|
|
75
|
-
const series = seriesResult.componentRef.instance as UiLineSeries;
|
|
76
|
-
setInputSignal(series.data, [
|
|
77
|
-
{ x: 0, y: 0 },
|
|
78
|
-
{ x: 5, y: 5 },
|
|
79
|
-
{ x: 10, y: 10 },
|
|
80
|
-
]);
|
|
81
|
-
await waitForUpdate();
|
|
82
|
-
return { parent, series, seriesResult };
|
|
83
|
-
};
|
|
84
|
-
|
|
85
|
-
it('renders segments and dots for the projected data', async () => {
|
|
86
|
-
const { series } = await renderSeries();
|
|
87
|
-
const cast = series as unknown as {
|
|
88
|
-
segments: () => { style: string }[];
|
|
89
|
-
dots: () => { style: string }[];
|
|
90
|
-
};
|
|
91
|
-
expect(cast.segments().length).toBeGreaterThan(0);
|
|
92
|
-
expect(cast.dots().length).toBe(3);
|
|
93
|
-
});
|
|
94
|
-
|
|
95
|
-
it('hides dots when showDots is false', async () => {
|
|
96
|
-
const { series } = await renderSeries();
|
|
97
|
-
setInputSignal(series.showDots, false);
|
|
98
|
-
await waitForUpdate();
|
|
99
|
-
const cast = series as unknown as { dots: () => { style: string }[] };
|
|
100
|
-
expect(cast.dots()).toEqual([]);
|
|
101
|
-
});
|
|
102
|
-
|
|
103
|
-
it('emits pointTap when onPointTap is invoked', async () => {
|
|
104
|
-
const { series } = await renderSeries();
|
|
105
|
-
const cb = vi.fn();
|
|
106
|
-
series.pointTap.subscribe(cb);
|
|
107
|
-
(series as unknown as { onPointTap: (p: unknown) => void }).onPointTap({
|
|
108
|
-
x: 1,
|
|
109
|
-
y: 2,
|
|
110
|
-
});
|
|
111
|
-
expect(cb).toHaveBeenCalledWith({ x: 1, y: 2 });
|
|
112
|
-
});
|
|
113
|
-
|
|
114
|
-
it('smooth mode resamples through sampleSmoothLine', async () => {
|
|
115
|
-
const { series } = await renderSeries();
|
|
116
|
-
setInputSignal(series.smooth, true);
|
|
117
|
-
await waitForUpdate();
|
|
118
|
-
const cast = series as unknown as { segments: () => { style: string }[] };
|
|
119
|
-
expect(cast.segments().length).toBeGreaterThan(2);
|
|
120
|
-
});
|
|
121
|
-
});
|
|
@@ -1,157 +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 { UiScatterChart, UiScatterSeries } from './scatter-chart';
|
|
6
|
-
|
|
7
|
-
describe('UiScatterChart', () => {
|
|
8
|
-
it('renders with default configuration', async () => {
|
|
9
|
-
const { container } = await render(UiScatterChart);
|
|
10
|
-
expect(container).toBeTruthy();
|
|
11
|
-
});
|
|
12
|
-
|
|
13
|
-
it('derives axis domains from the data extremes', async () => {
|
|
14
|
-
const { componentRef } = await render(UiScatterChart);
|
|
15
|
-
const inst = componentRef.instance as UiScatterChart;
|
|
16
|
-
setInputSignal(inst.data, [
|
|
17
|
-
{ x: 0, y: 0 },
|
|
18
|
-
{ x: 5, y: 8 },
|
|
19
|
-
{ x: 10, y: 3 },
|
|
20
|
-
]);
|
|
21
|
-
await waitForUpdate();
|
|
22
|
-
const cast = inst as unknown as {
|
|
23
|
-
xAxis: () => { domain: readonly [number, number] };
|
|
24
|
-
yAxis: () => { domain: readonly [number, number] };
|
|
25
|
-
effectivePadding: () => {
|
|
26
|
-
top?: number;
|
|
27
|
-
right?: number;
|
|
28
|
-
bottom?: number;
|
|
29
|
-
left?: number;
|
|
30
|
-
};
|
|
31
|
-
};
|
|
32
|
-
expect(cast.xAxis().domain[0]).toBeLessThanOrEqual(0);
|
|
33
|
-
expect(cast.xAxis().domain[1]).toBeGreaterThanOrEqual(10);
|
|
34
|
-
expect(cast.yAxis().domain[0]).toBeLessThanOrEqual(0);
|
|
35
|
-
expect(cast.yAxis().domain[1]).toBeGreaterThanOrEqual(8);
|
|
36
|
-
// Default SCATTER_INSET on every side.
|
|
37
|
-
expect(cast.effectivePadding().top).toBeCloseTo(0.04);
|
|
38
|
-
expect(cast.effectivePadding().right).toBeCloseTo(0.04);
|
|
39
|
-
expect(cast.effectivePadding().bottom).toBeCloseTo(0.04);
|
|
40
|
-
expect(cast.effectivePadding().left).toBeCloseTo(0.04);
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
it('honors explicit xMin / xMax / yMin / yMax overrides', async () => {
|
|
44
|
-
const { componentRef } = await render(UiScatterChart);
|
|
45
|
-
const inst = componentRef.instance as UiScatterChart;
|
|
46
|
-
setInputSignal(inst.data, [
|
|
47
|
-
{ x: 0, y: 0 },
|
|
48
|
-
{ x: 10, y: 10 },
|
|
49
|
-
]);
|
|
50
|
-
setInputSignal(inst.xMin, -5);
|
|
51
|
-
setInputSignal(inst.xMax, 20);
|
|
52
|
-
setInputSignal(inst.yMin, -1);
|
|
53
|
-
setInputSignal(inst.yMax, 15);
|
|
54
|
-
await waitForUpdate();
|
|
55
|
-
const cast = inst as unknown as {
|
|
56
|
-
xAxis: () => { domain: readonly [number, number] };
|
|
57
|
-
yAxis: () => { domain: readonly [number, number] };
|
|
58
|
-
};
|
|
59
|
-
expect(cast.xAxis().domain[0]).toBeLessThanOrEqual(-5);
|
|
60
|
-
expect(cast.xAxis().domain[1]).toBeGreaterThanOrEqual(20);
|
|
61
|
-
expect(cast.yAxis().domain[0]).toBeLessThanOrEqual(-1);
|
|
62
|
-
expect(cast.yAxis().domain[1]).toBeGreaterThanOrEqual(15);
|
|
63
|
-
});
|
|
64
|
-
|
|
65
|
-
it('user padding overrides individual sides of the default inset', async () => {
|
|
66
|
-
const { componentRef } = await render(UiScatterChart);
|
|
67
|
-
const inst = componentRef.instance as UiScatterChart;
|
|
68
|
-
setInputSignal(inst.padding, { top: 0.2 });
|
|
69
|
-
await waitForUpdate();
|
|
70
|
-
const cast = inst as unknown as {
|
|
71
|
-
effectivePadding: () => {
|
|
72
|
-
top?: number;
|
|
73
|
-
right?: number;
|
|
74
|
-
bottom?: number;
|
|
75
|
-
left?: number;
|
|
76
|
-
};
|
|
77
|
-
};
|
|
78
|
-
expect(cast.effectivePadding().top).toBeCloseTo(0.2);
|
|
79
|
-
expect(cast.effectivePadding().left).toBeCloseTo(0.04);
|
|
80
|
-
});
|
|
81
|
-
|
|
82
|
-
it('exposes the default tick formatter used by the child cartesian chart', async () => {
|
|
83
|
-
const { componentRef } = await render(UiScatterChart);
|
|
84
|
-
const inst = componentRef.instance as UiScatterChart;
|
|
85
|
-
expect(inst.xTickFormat()(3.14159)).toBe('3.14');
|
|
86
|
-
expect(inst.yTickFormat()(1.005)).toBe('1');
|
|
87
|
-
});
|
|
88
|
-
});
|
|
89
|
-
|
|
90
|
-
describe('UiScatterSeries', () => {
|
|
91
|
-
const renderSeries = async () => {
|
|
92
|
-
const parentResult = await render(UiCartesianChart);
|
|
93
|
-
const parent = parentResult.componentRef.instance as UiCartesianChart;
|
|
94
|
-
setInputSignal(parent.xDomain, [0, 10]);
|
|
95
|
-
setInputSignal(parent.yDomain, [0, 10]);
|
|
96
|
-
await waitForUpdate();
|
|
97
|
-
const seriesResult = await render(UiScatterSeries, {
|
|
98
|
-
providers: [{ provide: UiCartesianChart, useValue: parent }],
|
|
99
|
-
});
|
|
100
|
-
const series = seriesResult.componentRef.instance as UiScatterSeries;
|
|
101
|
-
setInputSignal(series.data, [
|
|
102
|
-
{ x: 0, y: 0 },
|
|
103
|
-
{ x: 5, y: 5 },
|
|
104
|
-
{ x: 10, y: 10 },
|
|
105
|
-
]);
|
|
106
|
-
await waitForUpdate();
|
|
107
|
-
return { parent, series };
|
|
108
|
-
};
|
|
109
|
-
|
|
110
|
-
it('renders a circular dot per datum with the fallback color', async () => {
|
|
111
|
-
const { series } = await renderSeries();
|
|
112
|
-
const cast = series as unknown as {
|
|
113
|
-
dots: () => { style: string; point: { x: number; y: number } }[];
|
|
114
|
-
};
|
|
115
|
-
const dots = cast.dots();
|
|
116
|
-
expect(dots.length).toBe(3);
|
|
117
|
-
for (const d of dots) {
|
|
118
|
-
expect(d.style).toContain('background-color: var(--primary)');
|
|
119
|
-
expect(d.style).toContain('border-radius');
|
|
120
|
-
}
|
|
121
|
-
});
|
|
122
|
-
|
|
123
|
-
it('cycles through the per-dot palette when colors are provided', async () => {
|
|
124
|
-
const { series } = await renderSeries();
|
|
125
|
-
setInputSignal(series.colors, ['#f00', '#0f0']);
|
|
126
|
-
await waitForUpdate();
|
|
127
|
-
const cast = series as unknown as { dots: () => { style: string }[] };
|
|
128
|
-
const dots = cast.dots();
|
|
129
|
-
expect(dots[0].style).toContain('#f00');
|
|
130
|
-
expect(dots[1].style).toContain('#0f0');
|
|
131
|
-
expect(dots[2].style).toContain('#f00');
|
|
132
|
-
});
|
|
133
|
-
|
|
134
|
-
it('per-dot sizes drive per-dot radii for a bubble chart', async () => {
|
|
135
|
-
const { series } = await renderSeries();
|
|
136
|
-
setInputSignal(series.sizes, [10, 6]);
|
|
137
|
-
await waitForUpdate();
|
|
138
|
-
const cast = series as unknown as { dots: () => { style: string }[] };
|
|
139
|
-
const dots = cast.dots();
|
|
140
|
-
// radius 10 → width 20px
|
|
141
|
-
expect(dots[0].style).toContain('width: 20.00px');
|
|
142
|
-
// radius 6 → width 12px
|
|
143
|
-
expect(dots[1].style).toContain('width: 12.00px');
|
|
144
|
-
// No entry → falls back to uniform radius (default 4) → width 8px
|
|
145
|
-
expect(dots[2].style).toContain('width: 8.00px');
|
|
146
|
-
});
|
|
147
|
-
|
|
148
|
-
it('emits pointTap with the source point when a dot is tapped', async () => {
|
|
149
|
-
const { series } = await renderSeries();
|
|
150
|
-
const cb = vi.fn();
|
|
151
|
-
series.pointTap.subscribe(cb);
|
|
152
|
-
(
|
|
153
|
-
series as unknown as { onPointTap: (p: { x: number; y: number }) => void }
|
|
154
|
-
).onPointTap({ x: 3, y: 4 });
|
|
155
|
-
expect(cb).toHaveBeenCalledWith({ x: 3, y: 4 });
|
|
156
|
-
});
|
|
157
|
-
});
|