mirror of
https://github.com/apache/superset.git
synced 2026-07-13 18:25:58 +00:00
refactor(frontend): centralize subdirectory URL prefixing behind nav helpers (#39925)
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com> Co-authored-by: Evan <evan@preset.io>
This commit is contained in:
@@ -26,6 +26,9 @@ const PERMALINK_PAYLOAD = {
|
||||
key: '123',
|
||||
url: 'http://fakeurl.com/123',
|
||||
};
|
||||
// rewritePermalinkOrigin substitutes window.location.origin (jsdom: http://localhost)
|
||||
// for the permalink's origin while preserving the path. See urlUtils.ts.
|
||||
const REWRITTEN_URL = `${window.location.origin}/123`;
|
||||
const FILTER_STATE_PAYLOAD = {
|
||||
value: '{}',
|
||||
};
|
||||
@@ -58,9 +61,7 @@ test('renders overlay on click', async () => {
|
||||
test('obtains short url', async () => {
|
||||
render(<URLShortLinkButton {...props} />, { useRedux: true });
|
||||
userEvent.click(screen.getByRole('button'));
|
||||
expect(await screen.findByRole('tooltip')).toHaveTextContent(
|
||||
PERMALINK_PAYLOAD.url,
|
||||
);
|
||||
expect(await screen.findByRole('tooltip')).toHaveTextContent(REWRITTEN_URL);
|
||||
});
|
||||
|
||||
test('creates email anchor', async () => {
|
||||
@@ -78,7 +79,7 @@ test('creates email anchor', async () => {
|
||||
},
|
||||
);
|
||||
|
||||
const href = `mailto:?Subject=${subject}%20&Body=${content}${PERMALINK_PAYLOAD.url}`;
|
||||
const href = `mailto:?Subject=${subject}%20&Body=${content}${REWRITTEN_URL}`;
|
||||
userEvent.click(screen.getByRole('button'));
|
||||
expect(await screen.findByRole('link')).toHaveAttribute('href', href);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user