@opendata-ai/openchart-vanilla 6.3.0 → 6.5.0

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.
@@ -142,7 +142,7 @@ describe('chart event handlers', () => {
142
142
  const onAnnotationClick = vi.fn();
143
143
  const chart = createChart(container, annotatedSpec, { onAnnotationClick });
144
144
 
145
- const annotation = container.querySelector('.viz-annotation');
145
+ const annotation = container.querySelector('.oc-annotation');
146
146
  if (!annotation) {
147
147
  // Refline at y=0 may resolve outside the chart area in test env
148
148
  chart.destroy();
@@ -166,7 +166,7 @@ describe('chart event handlers', () => {
166
166
  const onAnnotationEdit = vi.fn();
167
167
  const chart = createChart(container, textAnnotatedSpec, { onAnnotationEdit });
168
168
 
169
- const annotation = container.querySelector('.viz-annotation-text') as SVGGElement | null;
169
+ const annotation = container.querySelector('.oc-annotation-text') as SVGGElement | null;
170
170
  if (!annotation) {
171
171
  chart.destroy();
172
172
  return;
@@ -180,7 +180,7 @@ describe('chart event handlers', () => {
180
180
  const onAnnotationEdit = vi.fn();
181
181
  const chart = createChart(container, annotatedSpec, { onAnnotationEdit });
182
182
 
183
- const annotation = container.querySelector('.viz-annotation-refline') as SVGGElement | null;
183
+ const annotation = container.querySelector('.oc-annotation-refline') as SVGGElement | null;
184
184
  if (!annotation) {
185
185
  chart.destroy();
186
186
  return;
@@ -194,7 +194,7 @@ describe('chart event handlers', () => {
194
194
  const onAnnotationEdit = vi.fn();
195
195
  const chart = createChart(container, textAnnotatedSpec, { onAnnotationEdit });
196
196
 
197
- const annotation = container.querySelector('.viz-annotation-text') as SVGGElement | null;
197
+ const annotation = container.querySelector('.oc-annotation-text') as SVGGElement | null;
198
198
  if (!annotation) {
199
199
  chart.destroy();
200
200
  return;
@@ -220,7 +220,7 @@ describe('chart event handlers', () => {
220
220
  const onAnnotationEdit = vi.fn();
221
221
  const chart = createChart(container, textAnnotatedSpec, { onAnnotationEdit });
222
222
 
223
- const annotation = container.querySelector('.viz-annotation-text') as SVGGElement | null;
223
+ const annotation = container.querySelector('.oc-annotation-text') as SVGGElement | null;
224
224
  if (!annotation) {
225
225
  chart.destroy();
226
226
  return;
@@ -243,7 +243,7 @@ describe('chart event handlers', () => {
243
243
  onAnnotationEdit,
244
244
  });
245
245
 
246
- const annotation = container.querySelector('.viz-annotation-text') as SVGGElement | null;
246
+ const annotation = container.querySelector('.oc-annotation-text') as SVGGElement | null;
247
247
  if (!annotation) {
248
248
  chart.destroy();
249
249
  return;
@@ -268,7 +268,7 @@ describe('chart event handlers', () => {
268
268
  const onAnnotationEdit = vi.fn();
269
269
  const chart = createChart(container, textAnnotatedSpec, { onAnnotationEdit });
270
270
 
271
- const annotation = container.querySelector('.viz-annotation-text') as SVGGElement | null;
271
+ const annotation = container.querySelector('.oc-annotation-text') as SVGGElement | null;
272
272
  if (!annotation) {
273
273
  chart.destroy();
274
274
  return;
@@ -67,7 +67,7 @@ describe('exportSVG', () => {
67
67
  const result = exportSVG(svg);
68
68
  // Bar chart should have rect elements
69
69
  expect(result).toContain('<rect');
70
- expect(result).toContain('viz-mark-rect');
70
+ expect(result).toContain('oc-mark-rect');
71
71
  });
72
72
 
73
73
  it('returned string is well-formed XML (ends with closing svg tag)', () => {
@@ -23,7 +23,7 @@ describe('createChart', () => {
23
23
 
24
24
  const svg = container.querySelector('svg');
25
25
  expect(svg).not.toBeNull();
26
- expect(svg?.getAttribute('class')).toBe('viz-chart');
26
+ expect(svg?.getAttribute('class')).toBe('oc-chart');
27
27
 
28
28
  chart.destroy();
29
29
  });
@@ -41,15 +41,15 @@ describe('createChart', () => {
41
41
  it('chrome text elements are present with correct content', () => {
42
42
  const chart = createChart(container, lineSpec);
43
43
 
44
- const title = container.querySelector('.viz-title');
44
+ const title = container.querySelector('.oc-title');
45
45
  expect(title).not.toBeNull();
46
46
  expect(title?.textContent).toBe('GDP Growth');
47
47
 
48
- const subtitle = container.querySelector('.viz-subtitle');
48
+ const subtitle = container.querySelector('.oc-subtitle');
49
49
  expect(subtitle).not.toBeNull();
50
50
  expect(subtitle?.textContent).toBe('US vs UK over time');
51
51
 
52
- const source = container.querySelector('.viz-source');
52
+ const source = container.querySelector('.oc-source');
53
53
  expect(source).not.toBeNull();
54
54
  expect(source?.textContent).toBe('World Bank');
55
55
 
@@ -59,12 +59,12 @@ describe('createChart', () => {
59
59
  it('update() re-renders with new data', () => {
60
60
  const chart = createChart(container, lineSpec);
61
61
 
62
- const titleBefore = container.querySelector('.viz-title');
62
+ const titleBefore = container.querySelector('.oc-title');
63
63
  expect(titleBefore?.textContent).toBe('GDP Growth');
64
64
 
65
65
  chart.update(barSpec);
66
66
 
67
- const titleAfter = container.querySelector('.viz-title');
67
+ const titleAfter = container.querySelector('.oc-title');
68
68
  expect(titleAfter?.textContent).toBe('Updated Chart');
69
69
 
70
70
  chart.destroy();
@@ -82,7 +82,7 @@ describe('createChart', () => {
82
82
  expect(svgAfter).toBeNull();
83
83
 
84
84
  // Tooltip div should also be removed
85
- const tooltip = container.querySelector('.viz-tooltip');
85
+ const tooltip = container.querySelector('.oc-tooltip');
86
86
  expect(tooltip).toBeNull();
87
87
  });
88
88
 
@@ -132,8 +132,8 @@ describe('createChart', () => {
132
132
  it('renders axis elements', () => {
133
133
  const chart = createChart(container, lineSpec);
134
134
 
135
- const xAxis = container.querySelector('.viz-axis-x');
136
- const yAxis = container.querySelector('.viz-axis-y');
135
+ const xAxis = container.querySelector('.oc-axis-x');
136
+ const yAxis = container.querySelector('.oc-axis-y');
137
137
  expect(xAxis).not.toBeNull();
138
138
  expect(yAxis).not.toBeNull();
139
139
 
@@ -143,7 +143,7 @@ describe('createChart', () => {
143
143
  it('renders chrome wrapper group', () => {
144
144
  const chart = createChart(container, lineSpec);
145
145
 
146
- const chromeGroup = container.querySelector('.viz-chrome');
146
+ const chromeGroup = container.querySelector('.oc-chrome');
147
147
  expect(chromeGroup).not.toBeNull();
148
148
 
149
149
  chart.destroy();