MCPcopy Index your code
hub / github.com/ChartGPU/ChartGPU / testLineStyleColorPrecedence

Function testLineStyleColorPrecedence

examples/acceptance/line-style-color.ts:32–230  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

30}
31
32function testLineStyleColorPrecedence() {
33 console.log('\n=== Line Style Color Precedence Tests ===\n');
34
35 // Test 1: lineStyle.color takes precedence over series.color
36 {
37 const options: ChartGPUOptions = {
38 series: [
39 {
40 type: 'line',
41 data: [[0, 0], [1, 1]],
42 color: '#ff0000',
43 lineStyle: { color: '#00ff00' },
44 },
45 ],
46 };
47
48 const resolved = resolveOptions(options);
49 const series = resolved.series[0];
50
51 if (series?.type === 'line') {
52 assertEquals(
53 series.lineStyle.color,
54 '#00ff00',
55 'lineStyle.color overrides series.color'
56 );
57 assertEquals(
58 series.color,
59 '#00ff00',
60 'resolved series.color matches lineStyle.color'
61 );
62 } else {
63 console.error(`${RED}✗${RESET} Expected line series`);
64 failed++;
65 }
66 }
67
68 // Test 2: series.color takes precedence over palette
69 {
70 const options: ChartGPUOptions = {
71 palette: ['#ff0000', '#00ff00'],
72 series: [
73 {
74 type: 'line',
75 data: [[0, 0], [1, 1]],
76 color: '#0000ff',
77 },
78 ],
79 };
80
81 const resolved = resolveOptions(options);
82 const series = resolved.series[0];
83
84 if (series?.type === 'line') {
85 assertEquals(
86 series.color,
87 '#0000ff',
88 'series.color overrides palette'
89 );

Callers 1

mainFunction · 0.85

Calls 2

resolveOptionsFunction · 0.90
assertEqualsFunction · 0.70

Tested by

no test coverage detected