datajunction-ui 0.0.44 → 0.0.45

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.
@@ -199,18 +199,6 @@ describe('SelectionPanel', () => {
199
199
  const items = screen.getAllByRole('checkbox');
200
200
  expect(items.length).toBeGreaterThan(0);
201
201
  });
202
-
203
- it('clears search when clear button is clicked', () => {
204
- render(<SelectionPanel {...defaultProps} />);
205
-
206
- const searchInput = screen.getByPlaceholderText('Search metrics...');
207
- fireEvent.change(searchInput, { target: { value: 'test' } });
208
-
209
- const clearButton = screen.getAllByText('×')[0];
210
- fireEvent.click(clearButton);
211
-
212
- expect(searchInput.value).toBe('');
213
- });
214
202
  });
215
203
 
216
204
  describe('Select All / Clear Actions', () => {
@@ -220,7 +208,13 @@ describe('SelectionPanel', () => {
220
208
  fireEvent.click(screen.getByText('default'));
221
209
 
222
210
  expect(screen.getByText('Select all')).toBeInTheDocument();
223
- expect(screen.getByText('Clear')).toBeInTheDocument();
211
+ // Check for namespace-level Clear button (inside namespace-actions)
212
+ // Both buttons have select-all-btn class, Clear is the second one
213
+ const namespaceButtons = document.querySelectorAll(
214
+ '.namespace-actions .select-all-btn',
215
+ );
216
+ expect(namespaceButtons.length).toBe(2);
217
+ expect(namespaceButtons[1].textContent).toBe('Clear');
224
218
  });
225
219
 
226
220
  it('selects all metrics in namespace when Select all is clicked', () => {
@@ -239,7 +233,7 @@ describe('SelectionPanel', () => {
239
233
  ]);
240
234
  });
241
235
 
242
- it('clears all metrics in namespace when Clear is clicked', () => {
236
+ it('clears all metrics in namespace when namespace Clear is clicked', () => {
243
237
  const onMetricsChange = jest.fn();
244
238
  render(
245
239
  <SelectionPanel
@@ -253,7 +247,11 @@ describe('SelectionPanel', () => {
253
247
  );
254
248
 
255
249
  fireEvent.click(screen.getByText('default'));
256
- fireEvent.click(screen.getByText('Clear'));
250
+ // Click the namespace-level Clear button (second button in namespace-actions)
251
+ const namespaceButtons = document.querySelectorAll(
252
+ '.namespace-actions .select-all-btn',
253
+ );
254
+ fireEvent.click(namespaceButtons[1]); // Clear is the second button
257
255
 
258
256
  expect(onMetricsChange).toHaveBeenCalledWith([]);
259
257
  });
@@ -571,7 +569,7 @@ describe('SelectionPanel', () => {
571
569
  />,
572
570
  );
573
571
 
574
- expect(screen.getByText(/Show all 12/)).toBeInTheDocument();
572
+ expect(screen.getByText('Show all')).toBeInTheDocument();
575
573
  });
576
574
 
577
575
  it('toggles chips expansion when Show all/Show less is clicked', () => {
@@ -588,7 +586,7 @@ describe('SelectionPanel', () => {
588
586
  );
589
587
 
590
588
  // Click to expand
591
- const expandBtn = screen.getByText(/Show all 12/);
589
+ const expandBtn = screen.getByText('Show all');
592
590
  fireEvent.click(expandBtn);
593
591
 
594
592
  // Should now show "Show less"
@@ -598,7 +596,7 @@ describe('SelectionPanel', () => {
598
596
  fireEvent.click(screen.getByText('Show less'));
599
597
 
600
598
  // Should show "Show all" again
601
- expect(screen.getByText(/Show all 12/)).toBeInTheDocument();
599
+ expect(screen.getByText('Show all')).toBeInTheDocument();
602
600
  });
603
601
  });
604
602
 
@@ -616,10 +614,8 @@ describe('SelectionPanel', () => {
616
614
  const chipElements = screen.getAllByText('date_dim.dateint');
617
615
  // Should have at least one chip (and possibly one in the list)
618
616
  expect(chipElements.length).toBeGreaterThanOrEqual(1);
619
- // The chip should have the chip-label class
620
- expect(
621
- document.querySelector('.dimension-chip .chip-label'),
622
- ).toBeInTheDocument();
617
+ // The chip should have the dimension-chip class
618
+ expect(document.querySelector('.dimension-chip')).toBeInTheDocument();
623
619
  });
624
620
 
625
621
  it('removes dimension when chip remove button is clicked', () => {
@@ -646,8 +642,8 @@ describe('SelectionPanel', () => {
646
642
  });
647
643
  });
648
644
 
649
- describe('Clear All Button', () => {
650
- it('shows Clear all button when items are selected', () => {
645
+ describe('Clear Button', () => {
646
+ it('shows global Clear button when items are selected', () => {
651
647
  render(
652
648
  <SelectionPanel
653
649
  {...defaultProps}
@@ -656,10 +652,12 @@ describe('SelectionPanel', () => {
656
652
  />,
657
653
  );
658
654
 
659
- expect(screen.getByText('Clear all')).toBeInTheDocument();
655
+ const clearAllBtn = document.querySelector('.clear-all-btn');
656
+ expect(clearAllBtn).toBeInTheDocument();
657
+ expect(clearAllBtn.textContent).toBe('Clear');
660
658
  });
661
659
 
662
- it('calls onClearSelection when Clear all is clicked', () => {
660
+ it('calls onClearSelection when global Clear is clicked', () => {
663
661
  const onClearSelection = jest.fn();
664
662
  render(
665
663
  <SelectionPanel
@@ -670,7 +668,8 @@ describe('SelectionPanel', () => {
670
668
  />,
671
669
  );
672
670
 
673
- fireEvent.click(screen.getByText('Clear all'));
671
+ const clearAllBtn = document.querySelector('.clear-all-btn');
672
+ fireEvent.click(clearAllBtn);
674
673
 
675
674
  expect(onClearSelection).toHaveBeenCalled();
676
675
  });
@@ -689,7 +688,8 @@ describe('SelectionPanel', () => {
689
688
  />,
690
689
  );
691
690
 
692
- fireEvent.click(screen.getByText('Clear all'));
691
+ const clearAllBtn = document.querySelector('.clear-all-btn');
692
+ fireEvent.click(clearAllBtn);
693
693
 
694
694
  expect(onMetricsChange).toHaveBeenCalledWith([]);
695
695
  expect(onDimensionsChange).toHaveBeenCalledWith([]);
@@ -865,7 +865,7 @@ describe('SelectionPanel', () => {
865
865
  />,
866
866
  );
867
867
 
868
- expect(screen.getByText(/Show all 15/)).toBeInTheDocument();
868
+ expect(screen.getByText('Show all')).toBeInTheDocument();
869
869
  });
870
870
 
871
871
  it('toggles dimension chips expansion', () => {
@@ -884,7 +884,7 @@ describe('SelectionPanel', () => {
884
884
  );
885
885
 
886
886
  // Click to expand
887
- const expandBtn = screen.getByText(/Show all 15/);
887
+ const expandBtn = screen.getByText('Show all');
888
888
  fireEvent.click(expandBtn);
889
889
 
890
890
  // Should show "Show less"
@@ -894,7 +894,7 @@ describe('SelectionPanel', () => {
894
894
  fireEvent.click(screen.getByText('Show less'));
895
895
 
896
896
  // Should show "Show all" again
897
- expect(screen.getByText(/Show all 15/)).toBeInTheDocument();
897
+ expect(screen.getByText('Show all')).toBeInTheDocument();
898
898
  });
899
899
  });
900
900
 
@@ -928,26 +928,6 @@ describe('SelectionPanel', () => {
928
928
  });
929
929
  });
930
930
 
931
- describe('Clear Dimension Search', () => {
932
- it('clears dimension search when clear button is clicked', () => {
933
- render(
934
- <SelectionPanel {...defaultProps} selectedMetrics={['default.test']} />,
935
- );
936
-
937
- const searchInput = screen.getByPlaceholderText('Search dimensions...');
938
- fireEvent.change(searchInput, { target: { value: 'test' } });
939
-
940
- expect(searchInput.value).toBe('test');
941
-
942
- // Find the clear button (there are two × buttons, one for each search)
943
- const clearButtons = screen.getAllByText('×');
944
- // The second one is for dimension search
945
- fireEvent.click(clearButtons[clearButtons.length - 1]);
946
-
947
- expect(searchInput.value).toBe('');
948
- });
949
- });
950
-
951
931
  describe('Remove Dimension from Selected', () => {
952
932
  it('removes dimension when clicking X on dimension chip', () => {
953
933
  const onDimensionsChange = jest.fn();