mirror of
https://github.com/jupyterhub/jupyterhub.git
synced 2025-10-15 14:03:02 +00:00
fix spawn page link
This commit is contained in:
@@ -30,7 +30,7 @@ const AccessServerButton = ({ url }) => (
|
|||||||
);
|
);
|
||||||
|
|
||||||
const ServerDashboard = (props) => {
|
const ServerDashboard = (props) => {
|
||||||
let base_url = window.base_url;
|
let base_url = window.base_url || "/";
|
||||||
// sort methods
|
// sort methods
|
||||||
var usernameDesc = (e) => e.sort((a, b) => (a.name > b.name ? 1 : -1)),
|
var usernameDesc = (e) => e.sort((a, b) => (a.name > b.name ? 1 : -1)),
|
||||||
usernameAsc = (e) => e.sort((a, b) => (a.name < b.name ? 1 : -1)),
|
usernameAsc = (e) => e.sort((a, b) => (a.name < b.name ? 1 : -1)),
|
||||||
@@ -277,7 +277,7 @@ const ServerDashboard = (props) => {
|
|||||||
/>
|
/>
|
||||||
<a
|
<a
|
||||||
href={`${base_url}spawn/${user.name}${
|
href={`${base_url}spawn/${user.name}${
|
||||||
server.name && "/" + server.name
|
server.name ? "/" + server.name : ""
|
||||||
}`}
|
}`}
|
||||||
>
|
>
|
||||||
<button
|
<button
|
||||||
|
@@ -98,6 +98,18 @@ test("Renders correctly the status of a single-user server", async () => {
|
|||||||
expect(stop).toBeVisible();
|
expect(stop).toBeVisible();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test("Renders spawn page link", async () => {
|
||||||
|
let callbackSpy = mockAsync();
|
||||||
|
|
||||||
|
await act(async () => {
|
||||||
|
render(serverDashboardJsx(callbackSpy));
|
||||||
|
});
|
||||||
|
|
||||||
|
let link = screen.getByText("Spawn Page").closest("a");
|
||||||
|
let url = new URL(link.href);
|
||||||
|
expect(url.pathname).toEqual("/spawn/bar");
|
||||||
|
});
|
||||||
|
|
||||||
test("Invokes the startServer event on button click", async () => {
|
test("Invokes the startServer event on button click", async () => {
|
||||||
let callbackSpy = mockAsync();
|
let callbackSpy = mockAsync();
|
||||||
|
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
export const jhapiRequest = (endpoint, method, data) => {
|
export const jhapiRequest = (endpoint, method, data) => {
|
||||||
let base_url = window.base_url,
|
let base_url = window.base_url || "/",
|
||||||
api_url = `${base_url}hub/api`;
|
api_url = `${base_url}hub/api`;
|
||||||
return fetch(api_url + endpoint, {
|
return fetch(api_url + endpoint, {
|
||||||
method: method,
|
method: method,
|
||||||
|
Reference in New Issue
Block a user