From 28fedd0a976a2ac74188124d005040424f70b492 Mon Sep 17 00:00:00 2001 From: Wouter Admiraal Date: Wed, 17 Jul 2019 18:20:25 +0200 Subject: SONAR-12276 Remove badge styling from elements --- .../quality-profiles/details/ProfileHeader.tsx | 42 ++------ .../details/__tests__/ProfileHeader-test.tsx | 38 +++++++ .../__snapshots__/ProfileHeader-test.tsx.snap | 117 +++++++++++++++++++++ .../apps/quality-profiles/home/ProfilesListRow.tsx | 24 +---- 4 files changed, 164 insertions(+), 57 deletions(-) create mode 100644 server/sonar-web/src/main/js/apps/quality-profiles/details/__tests__/ProfileHeader-test.tsx create mode 100644 server/sonar-web/src/main/js/apps/quality-profiles/details/__tests__/__snapshots__/ProfileHeader-test.tsx.snap (limited to 'server/sonar-web/src') diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileHeader.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileHeader.tsx index e359a032362..a9e518c7903 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileHeader.tsx +++ b/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileHeader.tsx @@ -25,12 +25,7 @@ import ProfileActions from '../components/ProfileActions'; import ProfileDate from '../components/ProfileDate'; import ProfileLink from '../components/ProfileLink'; import { Profile } from '../types'; -import { - getProfileChangelogPath, - getProfilesForLanguagePath, - getProfilesPath, - isStagnant -} from '../utils'; +import { getProfileChangelogPath, getProfilesForLanguagePath, getProfilesPath } from '../utils'; interface Props { profile: Profile; @@ -39,33 +34,6 @@ interface Props { } export default class ProfileHeader extends React.PureComponent { - renderUpdateDate() { - const { profile } = this.props; - let inner = ( - - {translate('quality_profiles.updated_')} - - ); - if (isStagnant(profile)) { - inner = {inner}; - } - return
  • {inner}
  • ; - } - - renderUsageDate() { - const { profile } = this.props; - let inner = ( - - {translate('quality_profiles.used_')} - - ); - if (!profile.lastUsed) { - inner = {inner}; - } - - return
  • {inner}
  • ; - } - render() { const { organization, profile } = this.props; @@ -98,8 +66,12 @@ export default class ProfileHeader extends React.PureComponent {
      - {this.renderUpdateDate()} - {this.renderUsageDate()} +
    • + {translate('quality_profiles.updated_')} +
    • +
    • + {translate('quality_profiles.used_')} +
    • { + expect(shallowRender()).toMatchSnapshot(); +}); + +function shallowRender(props: Partial = {}) { + return shallow( + + ); +} diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/details/__tests__/__snapshots__/ProfileHeader-test.tsx.snap b/server/sonar-web/src/main/js/apps/quality-profiles/details/__tests__/__snapshots__/ProfileHeader-test.tsx.snap new file mode 100644 index 00000000000..dabf705a8b0 --- /dev/null +++ b/server/sonar-web/src/main/js/apps/quality-profiles/details/__tests__/__snapshots__/ProfileHeader-test.tsx.snap @@ -0,0 +1,117 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`should render correctly 1`] = ` +
      +
      + + quality_profiles.page + + / + + JavaScript + +
      +

      + + + name + + +

      +
      +
        +
      • + quality_profiles.updated_ + + +
      • +
      • + quality_profiles.used_ + + +
      • +
      • + + changelog + +
      • +
      • + +
      • +
      +
      +
      +`; diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/home/ProfilesListRow.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/home/ProfilesListRow.tsx index 8c36db28cbc..85aa99aeed8 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/home/ProfilesListRow.tsx +++ b/server/sonar-web/src/main/js/apps/quality-profiles/home/ProfilesListRow.tsx @@ -28,7 +28,6 @@ import ProfileActions from '../components/ProfileActions'; import ProfileDate from '../components/ProfileDate'; import ProfileLink from '../components/ProfileLink'; import { Profile } from '../types'; -import { isStagnant } from '../utils'; interface Props { organization: string | null; @@ -107,25 +106,6 @@ export default class ProfilesListRow extends React.PureComponent { ); } - renderUpdateDate() { - const date = ; - if (isStagnant(this.props.profile)) { - return {date}; - } else { - return date; - } - } - - renderUsageDate() { - const { lastUsed } = this.props.profile; - const date = ; - if (!lastUsed) { - return {date}; - } else { - return date; - } - } - render() { return ( { {this.renderRules()} - {this.renderUpdateDate()} + - {this.renderUsageDate()} +