diff options
author | Jeremy <47277647+jeremy-davis-sonarsource@users.noreply.github.com> | 2019-02-08 15:38:46 +0100 |
---|---|---|
committer | sonartech <sonartech@sonarsource.com> | 2019-02-11 09:11:45 +0100 |
commit | f5d0d6237b0e52afcb1981953a7c08baee794915 (patch) | |
tree | 55d559a806a46539f5cf1ef3e8ffc1794c274580 /server/sonar-web/src/main/js | |
parent | 223a718fb3dfdf1f49ae61d149ccaeb0b8e31b21 (diff) | |
download | sonarqube-f5d0d6237b0e52afcb1981953a7c08baee794915.tar.gz sonarqube-f5d0d6237b0e52afcb1981953a7c08baee794915.zip |
Bugfixing (#1227)
* SONAR-11656 Fix Quality Profile changelog order
* SONAR-11715 Fix license threshold modal close button
* Fix account tokens header label
Diffstat (limited to 'server/sonar-web/src/main/js')
-rw-r--r-- | server/sonar-web/src/main/js/apps/quality-profiles/changelog/Changelog.tsx | 3 | ||||
-rw-r--r-- | server/sonar-web/src/main/js/apps/quality-profiles/changelog/__tests__/Changelog-test.tsx | 23 |
2 files changed, 24 insertions, 2 deletions
diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/changelog/Changelog.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/changelog/Changelog.tsx index 6a29ffc2ed7..ea5e152909c 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/changelog/Changelog.tsx +++ b/server/sonar-web/src/main/js/apps/quality-profiles/changelog/Changelog.tsx @@ -21,7 +21,6 @@ import * as React from 'react'; import { Link } from 'react-router'; import { sortBy } from 'lodash'; import * as isSameMinute from 'date-fns/is_same_minute'; -import * as startOfMinute from 'date-fns/start_of_minute'; import ChangesList from './ChangesList'; import DateTimeFormatter from '../../../components/intl/DateTimeFormatter'; import { translate } from '../../../helpers/l10n'; @@ -39,7 +38,7 @@ export default function Changelog(props: Props) { const sortedRows = sortBy( props.events, // sort events by date, rounded to a minute, recent events first - e => -Number(startOfMinute(parseDate(e.date))), + e => -Number(parseDate(e.date)), e => e.action ); diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/changelog/__tests__/Changelog-test.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/changelog/__tests__/Changelog-test.tsx index af66ac441e9..4afbc84b778 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/changelog/__tests__/Changelog-test.tsx +++ b/server/sonar-web/src/main/js/apps/quality-profiles/changelog/__tests__/Changelog-test.tsx @@ -79,3 +79,26 @@ it('should render ChangesList', () => { expect(changesList.length).toBe(1); expect(changesList.prop('changes')).toBe(params); }); + +it('should render events sorted by time and action', () => { + const events = [ + createEvent({ date: '2019-02-07T14:03:45', action: 'DEACTIVATED' }), + createEvent({ date: '2019-02-07T14:03:14', action: 'DEACTIVATED' }), + createEvent({ date: '2019-02-07T14:03:14', action: 'ACTIVATED' }), + createEvent({ date: '2019-02-07T14:03:07', action: 'ACTIVATED' }) + ]; + const changelog = shallow(<Changelog events={events} organization={null} />); + const rows = changelog.find('tbody').find('tr'); + + const getAction = (index: number) => + rows + .at(index) + .childAt(2) + .childAt(0) + .text(); + + expect(getAction(0)).toBe('quality_profiles.changelog.DEACTIVATED'); + expect(getAction(1)).toBe('quality_profiles.changelog.ACTIVATED'); + expect(getAction(2)).toBe('quality_profiles.changelog.DEACTIVATED'); + expect(getAction(3)).toBe('quality_profiles.changelog.ACTIVATED'); +}); |