forked from getredash/redash
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix: showing current settings tab broken in MULTI_ORG. (getredash#4855)
* Fix: showing current settings tab broken in MULTI_ORG. * Revert "Fix: showing current settings tab broken in MULTI_ORG." This reverts commit a88defd. * Add test for SettingsMenu#isActive * Use stripBase to remove slug from url
- Loading branch information
Showing
2 changed files
with
36 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import settingsMenu from "./settingsMenu"; | ||
|
||
const dataSourcesItem = { | ||
permission: "admin", | ||
title: "Data Sources", | ||
path: "data_sources", | ||
}; | ||
|
||
const usersItem = { | ||
title: "Users", | ||
path: "users", | ||
}; | ||
|
||
settingsMenu.add(dataSourcesItem); | ||
settingsMenu.add(usersItem); | ||
|
||
describe("SettingsMenu", () => { | ||
describe("isActive", () => { | ||
test("works with non multi org paths", () => { | ||
expect(settingsMenu.getActiveItem("/data_sources/").title).toBe(dataSourcesItem.title); | ||
}); | ||
|
||
test("works with multi org paths", () => { | ||
// Set base href: | ||
const base = document.createElement("base"); | ||
base.setAttribute("href", "http://localhost/acme/"); | ||
document.head.appendChild(base); | ||
|
||
expect(settingsMenu.getActiveItem("/acme/data_sources/")).toBeTruthy(); | ||
expect(settingsMenu.getActiveItem("/acme/data_sources/").title).toBe(dataSourcesItem.title); | ||
}); | ||
}); | ||
}); |