]> source.dussan.org Git - sonarqube.git/commitdiff
SONARCLOUD-34 Automatically update the footer date in SonarCloud
authorGrégoire Aubert <gregoire.aubert@sonarsource.com>
Fri, 4 May 2018 13:42:50 +0000 (15:42 +0200)
committerSonarTech <sonartech@sonarsource.com>
Tue, 8 May 2018 18:20:45 +0000 (20:20 +0200)
server/sonar-web/src/main/js/app/components/GlobalFooterSonarCloud.tsx
server/sonar-web/src/main/js/app/components/__tests__/GlobalFooterSonarCloud-test.tsx
server/sonar-web/src/main/js/app/components/__tests__/__snapshots__/GlobalFooterSonarCloud-test.tsx.snap

index c98b44150591cdc41bc847d9718773783fa07dcf..6dd0208f57a4aaf68c3dc5c2d20c11a47b6c8971 100644 (file)
  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  */
 import * as React from 'react';
+import { getYear } from 'date-fns';
 import { translate } from '../../helpers/l10n';
 
 export default function GlobalFooterSonarCloud() {
   return (
-    <div id="footer" className="page-footer page-container">
+    <div className="page-footer page-container" id="footer">
       <div>
-        © 2008-2018, SonarCloud by{' '}
+        {`© 2008-${getYear(new Date())}, SonarCloud by `}
         <a href="http://www.sonarsource.com" title="SonarSource SA">
           SonarSource SA
         </a>
index a41b84066c4d30b0c9180adc0888f5519ecf1a8a..27ba87d8e898747d8390317efb18e0aa20599a31 100644 (file)
@@ -21,6 +21,10 @@ import * as React from 'react';
 import { shallow } from 'enzyme';
 import GlobalFooterSonarCloud from '../GlobalFooterSonarCloud';
 
+jest.mock('date-fns', () => ({
+  getYear: jest.fn(() => 2018)
+}));
+
 it('should render correctly', () => {
   expect(shallow(<GlobalFooterSonarCloud />)).toMatchSnapshot();
 });
index 7af6f907dfc2e16fe6770690d13a4bf0e5ebfe04..71c3ddf2c7505327fb4766189137b8c0e28d0ded 100644 (file)
@@ -6,8 +6,7 @@ exports[`should render correctly 1`] = `
   id="footer"
 >
   <div>
-    © 2008-2018, SonarCloud by
-     
+    © 2008-2018, SonarCloud by 
     <a
       href="http://www.sonarsource.com"
       title="SonarSource SA"