This commit is contained in:
Baptiste Clarey Sjostrand 2023-06-15 16:17:54 +02:00 committed by Salah Benmoussati
parent 57a88706a1
commit 8c0ae96edc
3 changed files with 13 additions and 4 deletions

View File

@ -32,6 +32,7 @@ exports[`screen picker should render correctly 1`] = `
</div>
<div
className="ScreenPicker-error-content"
key="spec"
>
<span
className="error-message"

View File

@ -9,6 +9,10 @@ describe('basic auth', () => {
const passwordTargetMock: object = {
target: { id: 'password', value: '123456' },
};
const defaultState: object = {
hostname: 'unknown',
isValidCredentials: true,
};
const basicAuthMock: object = {
hostname: 'example',
isValidCredentials: true,
@ -27,9 +31,13 @@ describe('basic auth', () => {
const spy: jest.SpyInstance = jest.spyOn(BasicAuth.prototype, 'setState');
const wrapper: ShallowWrapper = shallow(React.createElement(BasicAuth));
wrapper.find('#username').simulate('change', usernameTargetMock);
expect(spy).lastCalledWith(usernameMock);
expect(spy).lastCalledWith({ ...defaultState, ...usernameMock });
wrapper.find('#password').simulate('change', passwordTargetMock);
expect(spy).lastCalledWith(passwordMock);
expect(spy).lastCalledWith({
...defaultState,
...usernameMock,
...passwordMock,
});
});
it('should call submit login', () => {

View File

@ -205,7 +205,7 @@ export default class ScreenPicker extends React.Component<{}, IState> {
this.isApplicationsAvailable = applications.length > 0;
if (!this.isScreensAvailable && !this.isApplicationsAvailable) {
return (
<div className='ScreenPicker-error-content'>
<div className='ScreenPicker-error-content' key='spec'>
<span className='error-message'>
{i18n.t(
'No screens or applications are currently available.',
@ -217,7 +217,7 @@ export default class ScreenPicker extends React.Component<{}, IState> {
}
return (
<div className='ScreenPicker-main-content'>
<div className='ScreenPicker-main-content' key='spmc'>
{this.renderTabTitles()}
<section id='screen-contents'>{screens}</section>
<section id='application-contents'> {applications}</section>