mirror of
https://github.com/apache/superset.git
synced 2026-06-03 06:39:25 +00:00
feat: Certify Charts and Dashboards (#17335)
* Certify charts * Format * Certify dashboards * Format * Refactor card certification * Clear details when certified by empty * Show certification in detail page * Add RTL tests * Test charts api * Enhance integration tests * Lint * Fix dashboards count * Format * Handle empty value * Handle empty slice * Downgrade migration * Indent * Use alter * Fix revision * Fix revision
This commit is contained in:
@@ -27,6 +27,8 @@ import PropertiesModal from '.';
|
||||
const createProps = () => ({
|
||||
slice: {
|
||||
cache_timeout: null,
|
||||
certified_by: 'John Doe',
|
||||
certification_details: 'Sample certification',
|
||||
changed_on: '2021-03-19T16:30:56.750230',
|
||||
changed_on_humanized: '7 days ago',
|
||||
datasource: 'FCC 2018 Survey',
|
||||
@@ -87,6 +89,8 @@ fetchMock.get('http://localhost/api/v1/chart/318', {
|
||||
},
|
||||
result: {
|
||||
cache_timeout: null,
|
||||
certified_by: 'John Doe',
|
||||
certification_details: 'Sample certification',
|
||||
dashboards: [
|
||||
{
|
||||
dashboard_title: 'FCC New Coder Survey 2018',
|
||||
@@ -145,6 +149,8 @@ fetchMock.put('http://localhost/api/v1/chart/318', {
|
||||
id: 318,
|
||||
result: {
|
||||
cache_timeout: null,
|
||||
certified_by: 'John Doe',
|
||||
certification_details: 'Sample certification',
|
||||
description: null,
|
||||
owners: [],
|
||||
slice_name: 'Age distribution of respondents',
|
||||
@@ -211,7 +217,7 @@ test('Should render all elements inside modal', async () => {
|
||||
const props = createProps();
|
||||
render(<PropertiesModal {...props} />);
|
||||
await waitFor(() => {
|
||||
expect(screen.getAllByRole('textbox')).toHaveLength(3);
|
||||
expect(screen.getAllByRole('textbox')).toHaveLength(5);
|
||||
expect(screen.getByRole('combobox')).toBeInTheDocument();
|
||||
expect(
|
||||
screen.getByRole('heading', { name: 'Basic information' }),
|
||||
@@ -226,6 +232,12 @@ test('Should render all elements inside modal', async () => {
|
||||
|
||||
expect(screen.getByRole('heading', { name: 'Access' })).toBeVisible();
|
||||
expect(screen.getByText('Owners')).toBeVisible();
|
||||
|
||||
expect(
|
||||
screen.getByRole('heading', { name: 'Configuration' }),
|
||||
).toBeVisible();
|
||||
expect(screen.getByText('Certified by')).toBeVisible();
|
||||
expect(screen.getByText('Certification details')).toBeVisible();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -275,3 +287,19 @@ test('"Save" button should call only "onSave"', async () => {
|
||||
expect(props.onHide).toBeCalledTimes(1);
|
||||
});
|
||||
});
|
||||
|
||||
test('Empty "Certified by" should clear "Certification details"', async () => {
|
||||
const props = createProps();
|
||||
const noCertifiedByProps = {
|
||||
...props,
|
||||
slice: {
|
||||
...props.slice,
|
||||
certified_by: '',
|
||||
},
|
||||
};
|
||||
render(<PropertiesModal {...noCertifiedByProps} />);
|
||||
|
||||
expect(
|
||||
screen.getByRole('textbox', { name: 'Certification details' }),
|
||||
).toHaveValue('');
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user