From 8723b6a9d794ad6ff89028506e417eecc89e3d49 Mon Sep 17 00:00:00 2001 From: Mathieu Suen Date: Wed, 28 Sep 2022 15:38:39 +0200 Subject: [PATCH] SONAR-17365 Refactor audit app enzyme to RTL --- server/sonar-web/package.json | 1 + ...sServiceMock.ts => SettingsServiceMock.ts} | 19 +- .../apps/audit-logs/components/AuditApp.tsx | 6 - .../audit-logs/components/DownloadButton.tsx | 3 + .../components/__tests__/AuditApp-it.tsx | 133 ++++- .../components/__tests__/AuditApp-test.tsx | 110 ---- .../__tests__/AuditAppRenderer-test.tsx | 55 -- .../__tests__/DownloadButton-test.tsx | 81 --- .../__snapshots__/AuditApp-test.tsx.snap | 12 - .../AuditAppRenderer-test.tsx.snap | 501 ------------------ .../DownloadButton-test.tsx.snap | 90 ---- .../main/js/components/controls/DateInput.tsx | 2 + .../__snapshots__/DateInput-test.tsx.snap | 2 + server/sonar-web/yarn.lock | 10 + .../resources/org/sonar/l10n/core.properties | 2 + 15 files changed, 153 insertions(+), 874 deletions(-) rename server/sonar-web/src/main/js/api/mocks/{AuditLogsServiceMock.ts => SettingsServiceMock.ts} (74%) delete mode 100644 server/sonar-web/src/main/js/apps/audit-logs/components/__tests__/AuditApp-test.tsx delete mode 100644 server/sonar-web/src/main/js/apps/audit-logs/components/__tests__/AuditAppRenderer-test.tsx delete mode 100644 server/sonar-web/src/main/js/apps/audit-logs/components/__tests__/DownloadButton-test.tsx delete mode 100644 server/sonar-web/src/main/js/apps/audit-logs/components/__tests__/__snapshots__/AuditApp-test.tsx.snap delete mode 100644 server/sonar-web/src/main/js/apps/audit-logs/components/__tests__/__snapshots__/AuditAppRenderer-test.tsx.snap delete mode 100644 server/sonar-web/src/main/js/apps/audit-logs/components/__tests__/__snapshots__/DownloadButton-test.tsx.snap diff --git a/server/sonar-web/package.json b/server/sonar-web/package.json index a2ffdeec0ef..34541da1e24 100644 --- a/server/sonar-web/package.json +++ b/server/sonar-web/package.json @@ -105,6 +105,7 @@ "postcss-custom-properties": "9.1.1", "prettier": "1.19.1", "react-select-event": "5.5.1", + "testing-library-selector": "0.2.1", "typescript": "4.6.3", "whatwg-fetch": "3.6.2" }, diff --git a/server/sonar-web/src/main/js/api/mocks/AuditLogsServiceMock.ts b/server/sonar-web/src/main/js/api/mocks/SettingsServiceMock.ts similarity index 74% rename from server/sonar-web/src/main/js/api/mocks/AuditLogsServiceMock.ts rename to server/sonar-web/src/main/js/api/mocks/SettingsServiceMock.ts index 8d52440034d..9f02909bc9f 100644 --- a/server/sonar-web/src/main/js/api/mocks/AuditLogsServiceMock.ts +++ b/server/sonar-web/src/main/js/api/mocks/SettingsServiceMock.ts @@ -19,12 +19,15 @@ */ import { cloneDeep } from 'lodash'; import { HousekeepingPolicy } from '../../apps/audit-logs/utils'; -import { SettingValue } from '../../types/settings'; +import { SettingsKey, SettingValue } from '../../types/settings'; import { getValue } from '../settings'; -export default class AuditLogsServiceMock { - settingValue: SettingValue; - defaultValues: SettingValue = { key: 'test', value: HousekeepingPolicy.Weekly }; +export default class SettingsServiceMock { + settingValue?: SettingValue; + defaultValues: SettingValue = { + key: SettingsKey.AuditHouseKeeping, + value: HousekeepingPolicy.Weekly + }; constructor() { this.settingValue = cloneDeep(this.defaultValues); @@ -35,6 +38,14 @@ export default class AuditLogsServiceMock { return Promise.resolve(this.settingValue); }; + unsetHousekeepingPolicy() { + this.settingValue = undefined; + } + + setYearlyHousekeepingPolicy() { + this.settingValue = { key: 'test', value: HousekeepingPolicy.Yearly }; + } + resetSettingvalues = () => { this.settingValue = cloneDeep(this.defaultValues); }; diff --git a/server/sonar-web/src/main/js/apps/audit-logs/components/AuditApp.tsx b/server/sonar-web/src/main/js/apps/audit-logs/components/AuditApp.tsx index 7582b963c92..7cce3ac91ed 100644 --- a/server/sonar-web/src/main/js/apps/audit-logs/components/AuditApp.tsx +++ b/server/sonar-web/src/main/js/apps/audit-logs/components/AuditApp.tsx @@ -55,12 +55,6 @@ export class AuditApp extends React.PureComponent { } } - componentDidUpdate(prevProps: Props) { - if (prevProps.adminPages !== this.props.adminPages && this.hasGovernanceExtension()) { - this.fetchHouseKeepingPolicy(); - } - } - fetchHouseKeepingPolicy = async () => { const result = await getValue({ key: SettingsKey.AuditHouseKeeping }); diff --git a/server/sonar-web/src/main/js/apps/audit-logs/components/DownloadButton.tsx b/server/sonar-web/src/main/js/apps/audit-logs/components/DownloadButton.tsx index ab00e68fbea..ae80edbfffa 100644 --- a/server/sonar-web/src/main/js/apps/audit-logs/components/DownloadButton.tsx +++ b/server/sonar-web/src/main/js/apps/audit-logs/components/DownloadButton.tsx @@ -45,6 +45,8 @@ const toISODateString = (date: Date) => date.toISOString(); function getRangeParams(selection: RangeOption, dateRange?: { from?: Date; to?: Date }) { if (selection === RangeOption.Custom) { // dateRange should be complete if 'custom' is selected + // This is not strickly necessary since submit is disable + // when the if condition is true. if (!(dateRange?.to && dateRange?.from)) { return ''; } @@ -78,6 +80,7 @@ export default function DownloadButton(props: DownloadButtonProps) { { + // Timezone will not play well so we fake the response from lib. + const dateFns = jest.requireActual('date-fns'); + return { + ...dateFns, + endOfDay: jest.fn().mockImplementation(d => d), + startOfDay: jest.fn().mockImplementation(d => d) + }; +}); -beforeAll(() => { - handler = new AuditLogsServiceMock(); +jest.mock('../../../../helpers/dates', () => { + return { + ...jest.requireActual('../../../../helpers/dates'), + now: jest.fn(() => new Date('2020-07-21T12:00:00Z')) + }; }); -afterEach(() => handler.resetSettingvalues()); +const ui = { + pageTitle: byRole('heading', { name: 'audit_logs.page' }), + downloadButton: byRole('link', { name: 'download_verb' }), + todayRadio: byRole('radio', { name: 'audit_logs.range_option.today' }), + weekRadio: byRole('radio', { name: 'audit_logs.range_option.7days' }), + monthRadio: byRole('radio', { name: 'audit_logs.range_option.30days' }), + trimesterRadio: byRole('radio', { name: 'audit_logs.range_option.90days' }), + customRadio: byRole('radio', { name: 'audit_logs.range_option.custom' }), + downloadSentenceStart: byText('audit_logs.download_start.sentence.1'), + startDateInput: byPlaceholderText('start_date'), + endDateInput: byPlaceholderText('end_date') +}; -it('should render audit logs page correctly', async () => { - renderAuditLogs(); - expect(await screen.findByText('audit_logs.page')).toBeInTheDocument(); +let handler: SettingsServiceMock; + +beforeAll(() => { + handler = new SettingsServiceMock(); }); +afterEach(() => handler.resetSettingvalues()); + it('should handle download button click', async () => { const user = userEvent.setup(); + handler.setYearlyHousekeepingPolicy(); renderAuditLogs(); - const downloadButton = await screen.findByText('download_verb'); + const downloadButton = await ui.downloadButton.find(); expect(downloadButton).toBeInTheDocument(); + expect(downloadButton).toHaveAttribute( + 'href', + '/api/audit_logs/download?from=2020-07-21T12%3A00%3A00.000Z&to=2020-07-21T12%3A00%3A00.000Z' + ); + await user.click(ui.weekRadio.get()); + expect(downloadButton).toHaveAttribute( + 'href', + '/api/audit_logs/download?from=2020-07-14T12%3A00%3A00.000Z&to=2020-07-21T12%3A00%3A00.000Z' + ); + await user.click(ui.monthRadio.get()); + expect(downloadButton).toHaveAttribute( + 'href', + '/api/audit_logs/download?from=2020-06-21T12%3A00%3A00.000Z&to=2020-07-21T12%3A00%3A00.000Z' + ); + await user.click(ui.trimesterRadio.get()); + expect(downloadButton).toHaveAttribute( + 'href', + '/api/audit_logs/download?from=2020-04-22T12%3A00%3A00.000Z&to=2020-07-21T12%3A00%3A00.000Z' + ); await user.click(downloadButton); - expect(await screen.findByText('download_verb')).toHaveAttribute('href', '#'); - expect(screen.getByText('audit_logs.download_start.sentence.1')).toBeInTheDocument(); - expect(screen.getByText('audit_logs.download_start.sentence.2')).toBeInTheDocument(); - expect(screen.getByText('audit_logs.download_start.sentence.3')).toBeInTheDocument(); + expect(await ui.downloadButton.find()).toHaveAttribute('aria-disabled', 'true'); + expect(ui.downloadSentenceStart.get()).toBeInTheDocument(); + + // Custom date + const startDay = subDays(now(), 5); + const endDate = subDays(now(), 1); + await user.click(ui.customRadio.get()); + expect(ui.downloadButton.get()).toHaveAttribute('aria-disabled', 'true'); + await user.click(ui.startDateInput.get()); + + await selectEvent.select(screen.getByRole('textbox', { name: 'select_month' }), [ + getShortMonthName(getMonth(startDay)) + ]); + await selectEvent.select(screen.getByRole('textbox', { name: 'select_year' }), [ + getYear(startDay) + ]); + await user.click(screen.getByText(getDate(startDay))); + await user.click(ui.endDateInput.get()); + + await selectEvent.select(screen.getByRole('textbox', { name: 'select_month' }), [ + getShortMonthName(getMonth(endDate)) + ]); + await selectEvent.select(screen.getByRole('textbox', { name: 'select_year' }), [ + getYear(endDate) + ]); + await user.click(screen.getByText(getDate(endDate))); + + expect(await ui.downloadButton.find()).toHaveAttribute('aria-disabled', 'false'); + await user.click(downloadButton); + expect(await ui.downloadButton.find()).toHaveAttribute('aria-disabled', 'true'); +}); + +it('should not render if governance is not enable', () => { + renderAuditLogs([]); + expect(ui.pageTitle.query()).not.toBeInTheDocument(); +}); + +it('should show right option when keeping log for month', async () => { + handler.unsetHousekeepingPolicy(); + renderAuditLogs(); + expect(await ui.pageTitle.find()).toBeInTheDocument(); + expect(ui.todayRadio.get()).toBeInTheDocument(); + expect(ui.weekRadio.get()).toBeInTheDocument(); + expect(ui.monthRadio.get()).toBeInTheDocument(); + expect(ui.customRadio.get()).toBeInTheDocument(); + expect(ui.trimesterRadio.query()).not.toBeInTheDocument(); +}); + +it('should show right option when keeping log for year', async () => { + handler.setYearlyHousekeepingPolicy(); + renderAuditLogs(); + expect(await ui.pageTitle.find()).toBeInTheDocument(); + expect(ui.todayRadio.get()).toBeInTheDocument(); + expect(ui.weekRadio.get()).toBeInTheDocument(); + expect(ui.monthRadio.get()).toBeInTheDocument(); + expect(ui.trimesterRadio.get()).toBeInTheDocument(); + expect(ui.customRadio.get()).toBeInTheDocument(); }); -function renderAuditLogs() { - renderAppWithAdminContext('admin/audit', routes, {}, { adminPages: extensions }); +function renderAuditLogs(adminPages = extensions) { + renderAppWithAdminContext('admin/audit', routes, {}, { adminPages }); } diff --git a/server/sonar-web/src/main/js/apps/audit-logs/components/__tests__/AuditApp-test.tsx b/server/sonar-web/src/main/js/apps/audit-logs/components/__tests__/AuditApp-test.tsx deleted file mode 100644 index 21ffca857b0..00000000000 --- a/server/sonar-web/src/main/js/apps/audit-logs/components/__tests__/AuditApp-test.tsx +++ /dev/null @@ -1,110 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2022 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -import { subDays } from 'date-fns'; -import { shallow } from 'enzyme'; -import * as React from 'react'; -import { getValue } from '../../../../api/settings'; -import { waitAndUpdate } from '../../../../helpers/testUtils'; -import { AdminPageExtension } from '../../../../types/extension'; -import { HousekeepingPolicy, RangeOption } from '../../utils'; -import { AuditApp } from '../AuditApp'; -import AuditAppRenderer from '../AuditAppRenderer'; - -jest.mock('../../../../api/settings', () => ({ - getValue: jest.fn().mockResolvedValue({}) -})); - -beforeEach(() => { - jest.clearAllMocks(); -}); - -it('should render correctly', () => { - expect(shallowRender()).toMatchSnapshot(); -}); - -it('should do nothing if governance is not available', async () => { - const wrapper = shallowRender({ adminPages: [] }); - await waitAndUpdate(wrapper); - - expect(wrapper.type()).toBeNull(); - expect(getValue).not.toBeCalled(); -}); - -it('should handle housekeeping policy', async () => { - (getValue as jest.Mock).mockResolvedValueOnce({ value: HousekeepingPolicy.Weekly }); - - const wrapper = shallowRender(); - - await waitAndUpdate(wrapper); - - expect(wrapper.find(AuditAppRenderer).props().housekeepingPolicy).toBe(HousekeepingPolicy.Weekly); -}); - -it('should handle date selection', () => { - const wrapper = shallowRender(); - const range = { from: subDays(new Date(), 2), to: new Date() }; - - expect(wrapper.state().selection).toBe(RangeOption.Today); - - wrapper - .find(AuditAppRenderer) - .props() - .handleDateSelection(range); - - expect(wrapper.state().selection).toBe(RangeOption.Custom); - expect(wrapper.state().dateRange).toBe(range); -}); - -it('should handle predefined selection', () => { - const wrapper = shallowRender(); - const dateRange = { from: subDays(new Date(), 2), to: new Date() }; - - wrapper.setState({ dateRange, selection: RangeOption.Custom }); - - wrapper - .find(AuditAppRenderer) - .props() - .handleOptionSelection(RangeOption.Week); - - expect(wrapper.state().selection).toBe(RangeOption.Week); - expect(wrapper.state().dateRange).toBeUndefined(); -}); - -it('should handle update to admin pages', async () => { - const wrapper = shallowRender({ adminPages: [] }); - await waitAndUpdate(wrapper); - - expect(wrapper.type()).toBeNull(); - expect(getValue).not.toBeCalled(); - - wrapper.setProps({ adminPages: [{ key: AdminPageExtension.GovernanceConsole, name: 'name' }] }); - await waitAndUpdate(wrapper); - - expect(getValue).toBeCalled(); -}); - -function shallowRender(props: Partial = {}) { - return shallow( - - ); -} diff --git a/server/sonar-web/src/main/js/apps/audit-logs/components/__tests__/AuditAppRenderer-test.tsx b/server/sonar-web/src/main/js/apps/audit-logs/components/__tests__/AuditAppRenderer-test.tsx deleted file mode 100644 index d28fbb03aa8..00000000000 --- a/server/sonar-web/src/main/js/apps/audit-logs/components/__tests__/AuditAppRenderer-test.tsx +++ /dev/null @@ -1,55 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2022 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -import { shallow } from 'enzyme'; -import * as React from 'react'; -import { now } from '../../../../helpers/dates'; -import { HousekeepingPolicy, RangeOption } from '../../utils'; -import AuditAppRenderer, { AuditAppRendererProps } from '../AuditAppRenderer'; - -jest.mock('../../../../helpers/dates', () => { - return { - ...jest.requireActual('../../../../helpers/dates'), - now: jest.fn(() => new Date('2020-07-21T12:00:00Z')) - }; -}); - -it.each([ - [HousekeepingPolicy.Weekly], - [HousekeepingPolicy.Monthly], - [HousekeepingPolicy.Trimestrial], - [HousekeepingPolicy.Yearly] -])('should render correctly for %s housekeeping policy', housekeepingPolicy => { - expect(shallowRender({ housekeepingPolicy })).toMatchSnapshot(); - now(); -}); - -function shallowRender(props: Partial = {}) { - return shallow( - - ); -} diff --git a/server/sonar-web/src/main/js/apps/audit-logs/components/__tests__/DownloadButton-test.tsx b/server/sonar-web/src/main/js/apps/audit-logs/components/__tests__/DownloadButton-test.tsx deleted file mode 100644 index 27b74dbf321..00000000000 --- a/server/sonar-web/src/main/js/apps/audit-logs/components/__tests__/DownloadButton-test.tsx +++ /dev/null @@ -1,81 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2022 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -import { subDays } from 'date-fns'; -import { shallow } from 'enzyme'; -import * as React from 'react'; -import { RangeOption } from '../../utils'; -import DownloadButton, { DownloadButtonProps } from '../DownloadButton'; - -jest.mock('date-fns', () => { - const { subDays } = jest.requireActual('date-fns'); - return { - endOfDay: jest.fn().mockImplementation(d => d), - startOfDay: jest.fn().mockImplementation(d => d), - subDays - }; -}); - -jest.mock('../../../../helpers/dates', () => { - return { - ...jest.requireActual('../../../../helpers/dates'), - now: jest.fn(() => new Date('2020-07-21T12:00:00Z')) - }; -}); - -it.each([[RangeOption.Today], [RangeOption.Week], [RangeOption.Month], [RangeOption.Trimester]])( - 'should render correctly for %s', - selection => { - expect(shallowRender({ selection })).toMatchSnapshot('default'); - } -); - -it('should render correctly for custom range', () => { - const baseDate = new Date('2020-07-21T12:00:00Z'); - - expect(shallowRender({ selection: RangeOption.Custom })).toMatchSnapshot('no dates'); - expect( - shallowRender({ - dateRange: { from: subDays(baseDate, 2), to: baseDate }, - selection: RangeOption.Custom - }) - ).toMatchSnapshot('with dates'); -}); - -it('should handle download', () => { - const onStartDownload = jest.fn(); - const wrapper = shallowRender({ onStartDownload }); - - wrapper.find('a').simulate('click'); - wrapper.setProps({ downloadStarted: true }); - wrapper.find('a').simulate('click'); - - expect(onStartDownload).toBeCalledTimes(1); -}); - -function shallowRender(props: Partial = {}) { - return shallow( - - ); -} diff --git a/server/sonar-web/src/main/js/apps/audit-logs/components/__tests__/__snapshots__/AuditApp-test.tsx.snap b/server/sonar-web/src/main/js/apps/audit-logs/components/__tests__/__snapshots__/AuditApp-test.tsx.snap deleted file mode 100644 index 7520c26fee4..00000000000 --- a/server/sonar-web/src/main/js/apps/audit-logs/components/__tests__/__snapshots__/AuditApp-test.tsx.snap +++ /dev/null @@ -1,12 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`should render correctly 1`] = ` - -`; diff --git a/server/sonar-web/src/main/js/apps/audit-logs/components/__tests__/__snapshots__/AuditAppRenderer-test.tsx.snap b/server/sonar-web/src/main/js/apps/audit-logs/components/__tests__/__snapshots__/AuditAppRenderer-test.tsx.snap deleted file mode 100644 index db78b925ddd..00000000000 --- a/server/sonar-web/src/main/js/apps/audit-logs/components/__tests__/__snapshots__/AuditAppRenderer-test.tsx.snap +++ /dev/null @@ -1,501 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`should render correctly for Monthly housekeeping policy 1`] = ` -
- - -
-

- audit_logs.page -

-
-

- audit_logs.page.description.1 -
- - audit_logs.page.description.link - , - } - } - /> -

-
-

- audit_logs.download -

-
    -
  • - - audit_logs.range_option.today - -
  • -
  • - - audit_logs.range_option.7days - -
  • -
  • - - audit_logs.range_option.30days - -
  • -
  • - - audit_logs.range_option.custom - -
  • -
- -
- -
-`; - -exports[`should render correctly for Trimestrial housekeeping policy 1`] = ` -
- - -
-

- audit_logs.page -

-
-

- audit_logs.page.description.1 -
- - audit_logs.page.description.link - , - } - } - /> -

-
-

- audit_logs.download -

-
    -
  • - - audit_logs.range_option.today - -
  • -
  • - - audit_logs.range_option.7days - -
  • -
  • - - audit_logs.range_option.30days - -
  • -
  • - - audit_logs.range_option.90days - -
  • -
  • - - audit_logs.range_option.custom - -
  • -
- -
- -
-`; - -exports[`should render correctly for Weekly housekeeping policy 1`] = ` -
- - -
-

- audit_logs.page -

-
-

- audit_logs.page.description.1 -
- - audit_logs.page.description.link - , - } - } - /> -

-
-

- audit_logs.download -

-
    -
  • - - audit_logs.range_option.today - -
  • -
  • - - audit_logs.range_option.7days - -
  • -
  • - - audit_logs.range_option.custom - -
  • -
- -
- -
-`; - -exports[`should render correctly for Yearly housekeeping policy 1`] = ` -
- - -
-

- audit_logs.page -

-
-

- audit_logs.page.description.1 -
- - audit_logs.page.description.link - , - } - } - /> -

-
-

- audit_logs.download -

-
    -
  • - - audit_logs.range_option.today - -
  • -
  • - - audit_logs.range_option.7days - -
  • -
  • - - audit_logs.range_option.30days - -
  • -
  • - - audit_logs.range_option.90days - -
  • -
  • - - audit_logs.range_option.custom - -
  • -
- -
- -
-`; diff --git a/server/sonar-web/src/main/js/apps/audit-logs/components/__tests__/__snapshots__/DownloadButton-test.tsx.snap b/server/sonar-web/src/main/js/apps/audit-logs/components/__tests__/__snapshots__/DownloadButton-test.tsx.snap deleted file mode 100644 index 2bd20adf4e5..00000000000 --- a/server/sonar-web/src/main/js/apps/audit-logs/components/__tests__/__snapshots__/DownloadButton-test.tsx.snap +++ /dev/null @@ -1,90 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`should render correctly for 7days: default 1`] = ` - -
- download_verb - - -`; - -exports[`should render correctly for 30days: default 1`] = ` - - - download_verb - - -`; - -exports[`should render correctly for 90days: default 1`] = ` - - - download_verb - - -`; - -exports[`should render correctly for custom range: no dates 1`] = ` - - - download_verb - - -`; - -exports[`should render correctly for custom range: with dates 1`] = ` - - - download_verb - - -`; - -exports[`should render correctly for today: default 1`] = ` - - - download_verb - - -`; diff --git a/server/sonar-web/src/main/js/components/controls/DateInput.tsx b/server/sonar-web/src/main/js/components/controls/DateInput.tsx index b54fbcd0158..9ed6b165b10 100644 --- a/server/sonar-web/src/main/js/components/controls/DateInput.tsx +++ b/server/sonar-web/src/main/js/components/controls/DateInput.tsx @@ -191,12 +191,14 @@ export default class DateInput extends React.PureComponent {