Skip to content

Commit

Permalink
Update tests; trigger CI; trigger CI.
Browse files Browse the repository at this point in the history
  • Loading branch information
codyml committed Dec 8, 2022
1 parent 5e1ccaa commit 630af0c
Showing 1 changed file with 23 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import { SET_FOCUSED_NATIVE_FILTER } from 'src/dashboard/actions/nativeFilters';
import { FilterCardContent } from './FilterCardContent';

const baseInitialState = {
dashboardInfo: {},
nativeFilters: {
filters: {
'NATIVE_FILTER-1': {
Expand Down Expand Up @@ -232,13 +233,11 @@ const renderContent = (filter = baseFilter, initialState = baseInitialState) =>
initialState,
});

test('filter card title, edit, type, scope, dependencies', () => {
test('filter card title, type, scope, dependencies', () => {
renderContent();
expect(screen.getByText('Native filter 1')).toBeVisible();
expect(screen.getByLabelText('filter-small')).toBeVisible();

expect(screen.getByRole('button', { name: /edit/i })).toBeVisible();

expect(screen.getByText('Filter type')).toBeVisible();
expect(screen.getByText('Select filter')).toBeVisible();

Expand Down Expand Up @@ -311,8 +310,28 @@ test('focus filter on filter card dependency click', () => {
});
});

test('edit filter on filter card edit click', async () => {
test('edit filter button for dashboard viewer', () => {
renderContent();
expect(
screen.queryByRole('button', { name: /edit/i }),
).not.toBeInTheDocument();
});

test('edit filter button for dashboard editor', () => {
renderContent(baseFilter, {
...baseInitialState,
dashboardInfo: { dash_edit_perm: true },
});

expect(screen.getByRole('button', { name: /edit/i })).toBeVisible();
});

test('open modal on edit filter button click', async () => {
renderContent(baseFilter, {
...baseInitialState,
dashboardInfo: { dash_edit_perm: true },
});

const editButton = screen.getByRole('button', { name: /edit/i });
userEvent.click(editButton);
expect(
Expand Down

0 comments on commit 630af0c

Please sign in to comment.