From be7f076bb07635f51fc2a756b38b7f05ccd8364d Mon Sep 17 00:00:00 2001 From: Zak Burke Date: Fri, 17 May 2024 13:21:51 -0400 Subject: [PATCH 1/3] STCOR-776 use correct logout-timeout translation IDs (#1473) Whoops, missed this in #1463 Refs STCOR-776 --- src/components/LogoutTimeout/LogoutTimeout.js | 4 ++-- src/components/LogoutTimeout/LogoutTimeout.test.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/components/LogoutTimeout/LogoutTimeout.js b/src/components/LogoutTimeout/LogoutTimeout.js index af9467329..2eda11421 100644 --- a/src/components/LogoutTimeout/LogoutTimeout.js +++ b/src/components/LogoutTimeout/LogoutTimeout.js @@ -44,12 +44,12 @@ const LogoutTimeout = () => { - + - + diff --git a/src/components/LogoutTimeout/LogoutTimeout.test.js b/src/components/LogoutTimeout/LogoutTimeout.test.js index 068285092..55c9c9b5b 100644 --- a/src/components/LogoutTimeout/LogoutTimeout.test.js +++ b/src/components/LogoutTimeout/LogoutTimeout.test.js @@ -16,7 +16,7 @@ describe('LogoutTimeout', () => { mockUseStripes.mockReturnValue({ okapi: { isAuthenticated: false } }); render(); - screen.getByText('rtr.idleSession.sessionExpiredSoSad'); + screen.getByText('stripes-core.rtr.idleSession.sessionExpiredSoSad'); }); it('if authenticated, renders a redirect', async () => { From 142ff27b0d34a6816e6b7ef8deb54079b7afd750 Mon Sep 17 00:00:00 2001 From: Manvendra <105021655+manvendra-s-rathore@users.noreply.github.com> Date: Sat, 18 May 2024 16:54:21 +0530 Subject: [PATCH 2/3] STCOR-741 - Display error message when user does not enter a password in Login Page (#1465) * STCOR-741 - err message on no password * remove describe.only * update changeLog * resolve review comments * STCOR-741 add required property to password input field --- CHANGELOG.md | 1 + src/components/Login/Login.js | 1 + test/bigtest/tests/login-test.js | 27 +++++++++++++++++++++++++++ 3 files changed, 29 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index da7d98f89..dfa7df10a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ * Turn on ``; ignore it with `stripes.config.js` `disableStrictMode: true`. Refs STCOR-841. * Make branding optional. Refs STCOR-847. * Idle-session timeout and "Keep working?" modal. Refs STCOR-776. +* Implement password validation for Login Page. Refs STCOR-741. ## [10.1.0](https://github.com/folio-org/stripes-core/tree/v10.1.0) (2024-03-12) [Full Changelog](https://github.com/folio-org/stripes-core/compare/v10.0.0...v10.1.0) diff --git a/src/components/Login/Login.js b/src/components/Login/Login.js index b2f6e3960..63e91b612 100644 --- a/src/components/Login/Login.js +++ b/src/components/Login/Login.js @@ -160,6 +160,7 @@ class Login extends Component { validationEnabled={false} hasClearIcon={false} autoComplete="current-password" + required /> diff --git a/test/bigtest/tests/login-test.js b/test/bigtest/tests/login-test.js index 126c6d829..89e28bd88 100644 --- a/test/bigtest/tests/login-test.js +++ b/test/bigtest/tests/login-test.js @@ -149,6 +149,33 @@ describe('Login', () => { }); }); + describe('error for the empty password field', () => { + setupApplication({ + disableAuth: false, + scenarios: ['emptyPasswordField'], + }); + + beforeEach(async function () { + const { username, password, submit } = login; + + await username.fill('username'); + await password.fill(''); + await submit.click(); + }); + + it.always('username should not be reset upon failed submit', () => { + expect(login.username.value).to.equal('username'); + }); + + it('should have submit button', () => { + expect(login.submit.isPresent).to.be.true; + }); + + it.always('error message should not be present', () => { + expect(login.message.isPresent).to.be.false; + }); + }); + describe('error for the server error', () => { setupApplication({ disableAuth: false, From 05badf9c5eb8f4fb58988f32c03bcd4d360880d5 Mon Sep 17 00:00:00 2001 From: Zak Burke Date: Wed, 22 May 2024 10:31:55 -0400 Subject: [PATCH 3/3] STCOM-1291 avoid defaultProps in functional components (#1469) `defaultProps` for functional components will be deprecated in React v19 in favor of ES6 default parameters. Refs STCOR-844 --- CHANGELOG.md | 1 + src/components/AppIcon/AppIcon.js | 18 +++++------------- src/components/MainNav/NavButton/NavButton.js | 7 +------ .../RouteErrorBoundary/RouteErrorBoundary.js | 6 +----- 4 files changed, 8 insertions(+), 24 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index dfa7df10a..4e3b4f004 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ * Make branding optional. Refs STCOR-847. * Idle-session timeout and "Keep working?" modal. Refs STCOR-776. * Implement password validation for Login Page. Refs STCOR-741. +* Avoid deprecated `defaultProps` for functional components. Refs STCOR-844.. ## [10.1.0](https://github.com/folio-org/stripes-core/tree/v10.1.0) (2024-03-12) [Full Changelog](https://github.com/folio-org/stripes-core/compare/v10.0.0...v10.1.0) diff --git a/src/components/AppIcon/AppIcon.js b/src/components/AppIcon/AppIcon.js index f861a9936..e646dd63a 100644 --- a/src/components/AppIcon/AppIcon.js +++ b/src/components/AppIcon/AppIcon.js @@ -12,18 +12,18 @@ import { withStripes } from '../../StripesContext'; import css from './AppIcon.css'; const AppIcon = ({ - iconAlignment, - iconAriaHidden, - size, + iconAlignment = 'center', + iconAriaHidden = true, + size = 'medium', icon, alt, src, style, children, className, - tag, + tag = 'span', app, - iconKey, + iconKey = 'app', iconClassName, stripes, }) => { @@ -137,12 +137,4 @@ AppIcon.propTypes = { tag: PropTypes.string, }; -AppIcon.defaultProps = { - iconAlignment: 'center', - iconAriaHidden: true, - iconKey: 'app', - size: 'medium', - tag: 'span', -}; - export default withStripes(AppIcon); diff --git a/src/components/MainNav/NavButton/NavButton.js b/src/components/MainNav/NavButton/NavButton.js index 2c80dd262..df3fbc05e 100644 --- a/src/components/MainNav/NavButton/NavButton.js +++ b/src/components/MainNav/NavButton/NavButton.js @@ -34,10 +34,6 @@ const propTypes = { to: PropTypes.string, }; -const defaultProps = { - noSelectedBar: false, -}; - const NavButton = React.forwardRef(({ ariaLabel, badge, @@ -50,7 +46,7 @@ const NavButton = React.forwardRef(({ innerClassName, label, labelClassName, - noSelectedBar, + noSelectedBar = false, onClick, open, selected, @@ -137,6 +133,5 @@ const NavButton = React.forwardRef(({ }); NavButton.propTypes = propTypes; -NavButton.defaultProps = defaultProps; export default NavButton; diff --git a/src/components/RouteErrorBoundary/RouteErrorBoundary.js b/src/components/RouteErrorBoundary/RouteErrorBoundary.js index f339f848f..8fa59f047 100644 --- a/src/components/RouteErrorBoundary/RouteErrorBoundary.js +++ b/src/components/RouteErrorBoundary/RouteErrorBoundary.js @@ -11,7 +11,7 @@ import { getEventHandlers } from '../../handlerService'; import { ModulesContext } from '../../ModulesContext'; import { StripesContext } from '../../StripesContext'; -const RouteErrorBoundary = ({ children, escapeRoute, moduleName, isSettings }) => { +const RouteErrorBoundary = ({ children, escapeRoute = '/', moduleName, isSettings }) => { const intl = useIntl(); let buttonLabelId; @@ -64,8 +64,4 @@ RouteErrorBoundary.propTypes = { isSettings: PropTypes.bool, }; -RouteErrorBoundary.defaultProps = { - escapeRoute: '/' -}; - export default RouteErrorBoundary;