Skip to content

Commit

Permalink
Merge branch 'master' into test-validators
Browse files Browse the repository at this point in the history
  • Loading branch information
zburke authored May 22, 2024
2 parents 529fde6 + 05badf9 commit 77a519d
Show file tree
Hide file tree
Showing 8 changed files with 40 additions and 27 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
* Turn on `<StrictMode>`; 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.
* 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)
Expand Down
18 changes: 5 additions & 13 deletions src/components/AppIcon/AppIcon.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}) => {
Expand Down Expand Up @@ -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);
1 change: 1 addition & 0 deletions src/components/Login/Login.js
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ class Login extends Component {
validationEnabled={false}
hasClearIcon={false}
autoComplete="current-password"
required
/>
</Col>
</Row>
Expand Down
4 changes: 2 additions & 2 deletions src/components/LogoutTimeout/LogoutTimeout.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,12 @@ const LogoutTimeout = () => {
</Row>
<Row center="xs">
<Col xs={12}>
<Headline size="large"><FormattedMessage id="rtr.idleSession.sessionExpiredSoSad" /></Headline>
<Headline size="large"><FormattedMessage id="stripes-core.rtr.idleSession.sessionExpiredSoSad" /></Headline>
</Col>
</Row>
<Row center="xs">
<Col xs={12}>
<Button to="/"><FormattedMessage id="rtr.idleSession.logInAgain" /></Button>
<Button to="/"><FormattedMessage id="stripes-core.rtr.idleSession.logInAgain" /></Button>
</Col>
</Row>
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/components/LogoutTimeout/LogoutTimeout.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ describe('LogoutTimeout', () => {
mockUseStripes.mockReturnValue({ okapi: { isAuthenticated: false } });

render(<LogoutTimeout />);
screen.getByText('rtr.idleSession.sessionExpiredSoSad');
screen.getByText('stripes-core.rtr.idleSession.sessionExpiredSoSad');
});

it('if authenticated, renders a redirect', async () => {
Expand Down
7 changes: 1 addition & 6 deletions src/components/MainNav/NavButton/NavButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,6 @@ const propTypes = {
to: PropTypes.string,
};

const defaultProps = {
noSelectedBar: false,
};

const NavButton = React.forwardRef(({
ariaLabel,
badge,
Expand All @@ -50,7 +46,7 @@ const NavButton = React.forwardRef(({
innerClassName,
label,
labelClassName,
noSelectedBar,
noSelectedBar = false,
onClick,
open,
selected,
Expand Down Expand Up @@ -137,6 +133,5 @@ const NavButton = React.forwardRef(({
});

NavButton.propTypes = propTypes;
NavButton.defaultProps = defaultProps;

export default NavButton;
6 changes: 1 addition & 5 deletions src/components/RouteErrorBoundary/RouteErrorBoundary.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -64,8 +64,4 @@ RouteErrorBoundary.propTypes = {
isSettings: PropTypes.bool,
};

RouteErrorBoundary.defaultProps = {
escapeRoute: '/'
};

export default RouteErrorBoundary;
27 changes: 27 additions & 0 deletions test/bigtest/tests/login-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 77a519d

Please sign in to comment.