diff --git a/src/main/java/tech/jhipster/lite/generator/client/react/security/jwt/domain/ReactJwtModuleFactory.java b/src/main/java/tech/jhipster/lite/generator/client/react/security/jwt/domain/ReactJwtModuleFactory.java index 4dcabd348a1..51f0775c1d9 100644 --- a/src/main/java/tech/jhipster/lite/generator/client/react/security/jwt/domain/ReactJwtModuleFactory.java +++ b/src/main/java/tech/jhipster/lite/generator/client/react/security/jwt/domain/ReactJwtModuleFactory.java @@ -35,7 +35,7 @@ public class ReactJwtModuleFactory { -moz-osx-font-smoothing: grayscale; display: flex; flex-direction: column; - justify-content:center; + justify-content: center; align-items: center;\ """; @@ -88,7 +88,7 @@ public JHipsterModule buildModule(JHipsterModuleProperties properties) { .in(path("src/main/webapp/app/index.tsx")) .add(lineBeforeText("import { createRoot } from 'react-dom/client';"), "import { NextUIProvider } from '@nextui-org/react';") .add(lineBeforeText(APP), properties.indentation().times(2) + "") - .add(lineBeforeText(""), properties.indentation().times(2) + "") + .add(lineBeforeText(","), properties.indentation().times(2) + "") .add(text(APP), properties.indentation().times(1) + APP) .and() .in(path("src/main/webapp/app/index.css")) diff --git a/src/main/resources/generator/client/react/src/main/webapp/app/common/primary/app/App.css.mustache b/src/main/resources/generator/client/react/src/main/webapp/app/common/primary/app/App.css.mustache index ff420f70735..d7b8746ade6 100644 --- a/src/main/resources/generator/client/react/src/main/webapp/app/common/primary/app/App.css.mustache +++ b/src/main/resources/generator/client/react/src/main/webapp/app/common/primary/app/App.css.mustache @@ -8,7 +8,7 @@ } a { - color: #045F77; + color: #045f77; text-decoration: underline; } diff --git a/src/main/resources/generator/client/react/src/main/webapp/app/index.tsx.mustache b/src/main/resources/generator/client/react/src/main/webapp/app/index.tsx.mustache index 44a79759b02..af46811591d 100644 --- a/src/main/resources/generator/client/react/src/main/webapp/app/index.tsx.mustache +++ b/src/main/resources/generator/client/react/src/main/webapp/app/index.tsx.mustache @@ -8,5 +8,5 @@ const root = createRoot(container!); root.render( - + , ); diff --git a/src/main/resources/generator/client/react/src/main/webapp/app/login/primary/loginForm/index.tsx.mustache b/src/main/resources/generator/client/react/src/main/webapp/app/login/primary/loginForm/index.tsx.mustache index f3d72dcf18f..d52ed16bdf4 100644 --- a/src/main/resources/generator/client/react/src/main/webapp/app/login/primary/loginForm/index.tsx.mustache +++ b/src/main/resources/generator/client/react/src/main/webapp/app/login/primary/loginForm/index.tsx.mustache @@ -15,7 +15,7 @@ const LoginForm = () => { setUsername, setToken, }), - [] + [], ); const onPressLoginButton = useCallback(() => setOpen(true), []); @@ -26,24 +26,20 @@ const LoginForm = () => { return (
- {!token ? - ( - + ) : ( + <> +

+ Welcome {username}! +

+ - ) - : - ( - <> -

- Welcome {username}! -

- - - ) - } + + )} diff --git a/src/main/resources/generator/client/react/src/main/webapp/app/login/primary/loginModal/EyeFilledIcon.tsx.mustache b/src/main/resources/generator/client/react/src/main/webapp/app/login/primary/loginModal/EyeFilledIcon.tsx.mustache index efddd3886d2..f0a2a41c6fc 100644 --- a/src/main/resources/generator/client/react/src/main/webapp/app/login/primary/loginModal/EyeFilledIcon.tsx.mustache +++ b/src/main/resources/generator/client/react/src/main/webapp/app/login/primary/loginModal/EyeFilledIcon.tsx.mustache @@ -1,13 +1,5 @@ export const EyeFilledIcon = (props: { className: string }) => ( - Connect @@ -66,7 +66,7 @@ const LoginModal = ({ open, onClose }: LoginModalType) => { color="primary" size="lg" placeholder="Mot de passe" - type={isVisible ? "text" : "password"} + type={isVisible ? 'text' : 'password'} value={passwordForm} onValueChange={setPasswordForm} endContent={ diff --git a/src/main/resources/generator/client/react/src/main/webapp/index.html.mustache b/src/main/resources/generator/client/react/src/main/webapp/index.html.mustache index 6cfccbfc7da..2da7942eef5 100644 --- a/src/main/resources/generator/client/react/src/main/webapp/index.html.mustache +++ b/src/main/resources/generator/client/react/src/main/webapp/index.html.mustache @@ -1,4 +1,4 @@ - + diff --git a/src/main/resources/generator/client/react/src/test/javascript/spec/login/primary/loginForm/index.test.tsx.mustache b/src/main/resources/generator/client/react/src/test/javascript/spec/login/primary/loginForm/index.test.tsx.mustache index acc559ff0bb..862e959512a 100644 --- a/src/main/resources/generator/client/react/src/test/javascript/spec/login/primary/loginForm/index.test.tsx.mustache +++ b/src/main/resources/generator/client/react/src/test/javascript/spec/login/primary/loginForm/index.test.tsx.mustache @@ -11,31 +11,31 @@ const mockPost = () => { }; const login = async () => { - const { getByText, getByPlaceholderText, getByTestId } = render(); + const { getByText, getByPlaceholderText, getByTestId } = render(); const loginButton = getByText('Log in'); - fireEvent.click(loginButton); - await act(async () => { - fireEvent.change(getByPlaceholderText("Nom d'utilisateur"), { - target: {value: 'admin'}, - }); - fireEvent.change(getByPlaceholderText('Mot de passe'), { - target: {value: 'admin'}, - }); - const submitButton = getByTestId('submit-button'); - fireEvent.click(submitButton); + fireEvent.click(loginButton); + await act(async () => { + fireEvent.change(getByPlaceholderText("Nom d'utilisateur"), { + target: { value: 'admin' }, + }); + fireEvent.change(getByPlaceholderText('Mot de passe'), { + target: { value: 'admin' }, + }); + const submitButton = getByTestId('submit-button'); + fireEvent.click(submitButton); }); return { getByText, getByPlaceholderText, getByTestId }; }; describe('loginForm', () => { it('render button should contain "Log in"', () => { - const {getByText} = render(); + const { getByText } = render(); const loginButton = getByText('Log in'); expect(loginButton).toBeTruthy(); }); it('render the modal on login button click and close it', async () => { - const {getByText, getByTestId} = render(); + const { getByText, getByTestId } = render(); const loginButton = getByText('Log in'); fireEvent.click(loginButton); expect(getByText('Connect')).toBeTruthy(); diff --git a/src/main/resources/generator/client/react/src/test/javascript/spec/login/primary/loginModal/index.test.tsx.mustache b/src/main/resources/generator/client/react/src/test/javascript/spec/login/primary/loginModal/index.test.tsx.mustache index 0f051d44d30..8dcb3de2fb0 100644 --- a/src/main/resources/generator/client/react/src/test/javascript/spec/login/primary/loginModal/index.test.tsx.mustache +++ b/src/main/resources/generator/client/react/src/test/javascript/spec/login/primary/loginModal/index.test.tsx.mustache @@ -8,10 +8,12 @@ import { UserInfoContext } from '@/login/primary/loginForm'; const setUsername = vi.fn(); const setToken = vi.fn(); -const LoginModalRender = (open: boolean) => render( - - {}} /> -); +const LoginModalRender = (open: boolean) => + render( + + {}} /> + , + ); describe('test login modal', () => { it('should contain login title', () => { diff --git a/src/main/resources/generator/client/react/src/test/javascript/spec/login/services/login.test.ts.mustache b/src/main/resources/generator/client/react/src/test/javascript/spec/login/services/login.test.ts.mustache index 1033b82ab6a..90ad343384c 100644 --- a/src/main/resources/generator/client/react/src/test/javascript/spec/login/services/login.test.ts.mustache +++ b/src/main/resources/generator/client/react/src/test/javascript/spec/login/services/login.test.ts.mustache @@ -17,7 +17,7 @@ describe('login function', () => { spy.mockImplementationOnce(() => Promise.reject(new Error('error'))); const setUsername = vi.fn(); const setToken = vi.fn(); - expect(login({...data, setToken, setUsername})).toBeInstanceOf(Promise); + expect(login({ ...data, setToken, setUsername })).toBeInstanceOf(Promise); }); it('should set token and username', async () => { @@ -25,7 +25,7 @@ describe('login function', () => { spy.mockImplementationOnce((): Promise => Promise.resolve({ data: { id_token: idToken } })); const setUsername = vi.fn(); const setToken = vi.fn(); - await login({...data, setToken, setUsername}); + await login({ ...data, setToken, setUsername }); expect(setUsername).toHaveBeenCalledWith(data.username); expect(setToken).toHaveBeenCalledWith(idToken); }); diff --git a/src/test/java/tech/jhipster/lite/generator/client/react/security/jwt/domain/ReactJwtModuleFactoryTest.java b/src/test/java/tech/jhipster/lite/generator/client/react/security/jwt/domain/ReactJwtModuleFactoryTest.java index e06a80513de..447f973c0f8 100644 --- a/src/test/java/tech/jhipster/lite/generator/client/react/security/jwt/domain/ReactJwtModuleFactoryTest.java +++ b/src/test/java/tech/jhipster/lite/generator/client/react/security/jwt/domain/ReactJwtModuleFactoryTest.java @@ -30,7 +30,7 @@ void shouldBuildModule() { -moz-osx-font-smoothing: grayscale; display: flex; flex-direction: column; - justify-content:center; + justify-content: center; align-items: center; """ )