-
Notifications
You must be signed in to change notification settings - Fork 5.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add customization options for the login page #5633
Changes from all commits
1dcfee2
c8cfcab
28330e4
4e80591
01f8060
e5c630b
8c96c60
6483adb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -92,5 +92,51 @@ describe("login", () => { | |||||
|
||||||
expect(htmlContent).toContain("Incorrect password") | ||||||
}) | ||||||
|
||||||
it("should return correct app-name", async () => { | ||||||
process.env.PASSWORD = previousEnvPassword | ||||||
const appName = "testnäme" | ||||||
const codeServer = await integration.setup([`--app-name=${appName}`], "") | ||||||
const resp = await codeServer.fetch("/login", { method: "GET" }) | ||||||
|
||||||
const htmlContent = await resp.text() | ||||||
expect(resp.status).toBe(200) | ||||||
expect(htmlContent).toContain(`${appName}</h1>`) | ||||||
expect(htmlContent).toContain(`<title>${appName} login</title>`) | ||||||
}) | ||||||
|
||||||
it("should return correct app-name when unset", async () => { | ||||||
process.env.PASSWORD = previousEnvPassword | ||||||
const appName = "code-server" | ||||||
const codeServer = await integration.setup([], "") | ||||||
const resp = await codeServer.fetch("/login", { method: "GET" }) | ||||||
|
||||||
const htmlContent = await resp.text() | ||||||
expect(resp.status).toBe(200) | ||||||
expect(htmlContent).toContain(`${appName}</h1>`) | ||||||
expect(htmlContent).toContain(`<title>${appName} login</title>`) | ||||||
}) | ||||||
|
||||||
it("should return correct welcome text", async () => { | ||||||
process.env.PASSWORD = previousEnvPassword | ||||||
const welcomeText = "Welcome to your code workspace! öäü🔐" | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: should we use characters without accent marks in case they're rendered differently on someone's machine?
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. my idea was to test if there are any implications when using unicode, but I don't know if that should be there There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think that could be tested separately if needed but I personally don't think we need to. thoughts @code-asher ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we can also merge now and i can fix later if needed. don't want to hold you back :) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yeah I don't think it will do any harm, should be ready to merge. I would be glad if you could add the hacktoberfest-accepted label so it counts for https://hacktoberfest.com :) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Seems chill to me 👍 |
||||||
const codeServer = await integration.setup([`--welcome-text=${welcomeText}`], "") | ||||||
const resp = await codeServer.fetch("/login", { method: "GET" }) | ||||||
|
||||||
const htmlContent = await resp.text() | ||||||
expect(resp.status).toBe(200) | ||||||
expect(htmlContent).toContain(welcomeText) | ||||||
}) | ||||||
|
||||||
it("should return correct welcome text when none is set but app-name is", async () => { | ||||||
process.env.PASSWORD = previousEnvPassword | ||||||
const appName = "testnäme" | ||||||
const codeServer = await integration.setup([`--app-name=${appName}`], "") | ||||||
const resp = await codeServer.fetch("/login", { method: "GET" }) | ||||||
|
||||||
const htmlContent = await resp.text() | ||||||
expect(resp.status).toBe(200) | ||||||
expect(htmlContent).toContain(`Welcome to ${appName}`) | ||||||
}) | ||||||
}) | ||||||
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: same as here