Skip to content

Commit 775063a

Browse files
committed
fix last test
1 parent d2f1abc commit 775063a

File tree

1 file changed

+6
-22
lines changed

1 file changed

+6
-22
lines changed

superset-frontend/src/components/Chart/DrillDetail/DrillDetailModal.test.tsx

Lines changed: 6 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -92,21 +92,21 @@ test('should render the title', async () => {
9292
expect(screen.getByText(`Drill to detail: ${chartName}`)).toBeInTheDocument();
9393
});
9494

95-
test('should not render Edit chart button when no drill-through chart is configured', async () => {
95+
test('should not render Explore button when no drill-through chart is configured', async () => {
9696
await renderModal();
9797
expect(
98-
screen.queryByRole('button', { name: 'Edit chart' }),
98+
screen.queryByRole('button', { name: 'Explore' }),
9999
).not.toBeInTheDocument();
100100
expect(screen.getAllByRole('button', { name: 'Close' })).toHaveLength(2);
101101
});
102102

103-
test('should render Edit chart link when drill-through chart is configured', async () => {
103+
test('should render Explore button when drill-through chart is configured', async () => {
104104
const datasetWithDrillThrough = {
105105
drill_through_chart_id: 123,
106106
id: 456, // Required for URL generation
107107
};
108108
await renderModal({}, datasetWithDrillThrough);
109-
expect(screen.getByRole('link', { name: 'Edit chart' })).toBeInTheDocument();
109+
expect(screen.getByRole('button', { name: 'Explore' })).toBeInTheDocument();
110110
expect(screen.getAllByRole('button', { name: 'Close' })).toHaveLength(2);
111111
});
112112

@@ -117,23 +117,7 @@ test('should close the modal', async () => {
117117
expect(screen.queryByRole('dialog')).not.toBeInTheDocument();
118118
});
119119

120-
test('should have correct href for drill-through chart', async () => {
121-
const drillThroughChartId = 123;
122-
const datasetId = 456;
123-
const datasetWithDrillThrough = {
124-
drill_through_chart_id: drillThroughChartId,
125-
id: datasetId,
126-
};
127-
await renderModal({}, datasetWithDrillThrough);
128-
const editLink = screen.getByRole('link', { name: 'Edit chart' });
129-
expect(editLink).toHaveAttribute(
130-
'href',
131-
`/explore/?dashboard_page_id=&slice_id=${drillThroughChartId}`,
132-
);
133-
expect(editLink).not.toHaveAttribute('target'); // We removed target="_blank"
134-
});
135-
136-
test('should render "Edit chart" as disabled without can_explore permission', async () => {
120+
test('should render "Explore" as disabled without can_explore permission', async () => {
137121
const datasetWithDrillThrough = {
138122
drill_through_chart_id: 123,
139123
id: 456, // Required for URL generation
@@ -147,5 +131,5 @@ test('should render "Edit chart" as disabled without can_explore permission', as
147131
},
148132
datasetWithDrillThrough,
149133
);
150-
expect(screen.getByRole('button', { name: 'Edit chart' })).toBeDisabled();
134+
expect(screen.getByRole('button', { name: 'Explore' })).toBeDisabled();
151135
});

0 commit comments

Comments
 (0)