mirror of
https://github.com/apache/superset.git
synced 2026-04-26 19:44:58 +00:00
feat(fe): upgrade superset-frontend to Typescript v5 (#31979)
Signed-off-by: hainenber <dotronghai96@gmail.com> Co-authored-by: Michael S. Molina <70410625+michael-s-molina@users.noreply.github.com>
This commit is contained in:
@@ -17,7 +17,7 @@
|
||||
* under the License.
|
||||
*/
|
||||
import { fireEvent, render } from 'spec/helpers/testing-library';
|
||||
import KeyboardShortcutButton, { KEY_MAP } from '.';
|
||||
import KeyboardShortcutButton, { KEY_MAP, KeyboardShortcut } from '.';
|
||||
|
||||
test('renders shortcut description', () => {
|
||||
const { getByText, getByRole } = render(
|
||||
@@ -26,7 +26,7 @@ test('renders shortcut description', () => {
|
||||
fireEvent.click(getByRole('button'));
|
||||
expect(getByText('Keyboard shortcuts')).toBeInTheDocument();
|
||||
Object.keys(KEY_MAP)
|
||||
.filter(key => Boolean(KEY_MAP[key]))
|
||||
.filter(key => Boolean(KEY_MAP[key as KeyboardShortcut]))
|
||||
.forEach(key => {
|
||||
expect(getByText(key)).toBeInTheDocument();
|
||||
});
|
||||
|
||||
@@ -42,7 +42,7 @@ export enum KeyboardShortcut {
|
||||
CtrlRight = 'ctrl+]',
|
||||
}
|
||||
|
||||
export const KEY_MAP = {
|
||||
export const KEY_MAP: Record<KeyboardShortcut, string | undefined> = {
|
||||
[KeyboardShortcut.CtrlR]: t('Run query'),
|
||||
[KeyboardShortcut.CtrlEnter]: t('Run query'),
|
||||
[KeyboardShortcut.AltEnter]: t('Run query'),
|
||||
@@ -62,15 +62,14 @@ export const KEY_MAP = {
|
||||
[KeyboardShortcut.CtrlH]: userOS !== 'MacOS' ? t('Replace') : undefined,
|
||||
};
|
||||
|
||||
const KeyMapByCommand = Object.entries(KEY_MAP).reduce(
|
||||
(acc, [shortcut, command]) => {
|
||||
if (command) {
|
||||
acc[command] = [...(acc[command] || []), shortcut];
|
||||
}
|
||||
return acc;
|
||||
},
|
||||
{} as Record<string, string[]>,
|
||||
);
|
||||
const KeyMapByCommand = Object.entries(KEY_MAP).reduce<
|
||||
Record<string, string[]>
|
||||
>((acc, [shortcut, command]) => {
|
||||
if (command) {
|
||||
acc[command] = [...(acc[command] || []), shortcut];
|
||||
}
|
||||
return acc;
|
||||
}, {});
|
||||
|
||||
const ShortcutDescription = styled.span`
|
||||
font-size: ${({ theme }) => theme.typography.sizes.m}px;
|
||||
|
||||
Reference in New Issue
Block a user