mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Fixing tests
Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>
This commit is contained in:
parent
daf7a89e3c
commit
eab854b58c
@ -88,9 +88,13 @@ describe("Extensions", () => {
|
||||
ExtensionDiscovery.getInstance().isLoaded = true;
|
||||
|
||||
const res = render(<><Extensions /><ConfirmDialog /></>);
|
||||
const table = res.getByTestId("extensions-table");
|
||||
const menuTrigger = table.querySelector("div[role=row]:first-of-type .actions .Icon");
|
||||
|
||||
expect(res.getByText("Disable").closest("button")).not.toBeDisabled();
|
||||
expect(res.getByText("Uninstall").closest("button")).not.toBeDisabled();
|
||||
fireEvent.click(menuTrigger);
|
||||
|
||||
expect(res.getByText("Disable")).toHaveAttribute("aria-disabled", "false");
|
||||
expect(res.getByText("Uninstall")).toHaveAttribute("aria-disabled", "false");
|
||||
|
||||
fireEvent.click(res.getByText("Uninstall"));
|
||||
|
||||
@ -99,8 +103,9 @@ describe("Extensions", () => {
|
||||
|
||||
await waitFor(() => {
|
||||
expect(ExtensionDiscovery.getInstance().uninstallExtension).toHaveBeenCalled();
|
||||
expect(res.getByText("Disable").closest("button")).toBeDisabled();
|
||||
expect(res.getByText("Uninstall").closest("button")).toBeDisabled();
|
||||
fireEvent.click(menuTrigger);
|
||||
expect(res.getByText("Disable")).toHaveAttribute("aria-disabled", "true");
|
||||
expect(res.getByText("Uninstall")).toHaveAttribute("aria-disabled", "true");
|
||||
}, {
|
||||
timeout: 30000,
|
||||
});
|
||||
@ -111,7 +116,7 @@ describe("Extensions", () => {
|
||||
|
||||
(fse.unlink as jest.MockedFunction<typeof fse.unlink>).mockReturnValue(Promise.resolve() as any);
|
||||
|
||||
fireEvent.change(res.getByPlaceholderText("Path or URL to an extension package", {
|
||||
fireEvent.change(res.getByPlaceholderText("File path or URL", {
|
||||
exact: false
|
||||
}), {
|
||||
target: {
|
||||
@ -134,8 +139,6 @@ describe("Extensions", () => {
|
||||
ExtensionDiscovery.getInstance().isLoaded = true;
|
||||
const { container } = render(<Extensions />);
|
||||
|
||||
waitFor(() =>
|
||||
expect(container.querySelector(".Spinner")).not.toBeInTheDocument()
|
||||
);
|
||||
expect(container.querySelector(".Spinner")).not.toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
|
||||
@ -209,6 +209,13 @@ export class ExtensionInstallationStateStore {
|
||||
return ExtensionInstallationStateStore.InstallingExtensions.size;
|
||||
}
|
||||
|
||||
/**
|
||||
* The current number of extensions uninstalling
|
||||
*/
|
||||
@computed static get uninstalling(): number {
|
||||
return ExtensionInstallationStateStore.UninstallingExtensions.size;
|
||||
}
|
||||
|
||||
/**
|
||||
* If there is at least one extension currently installing
|
||||
*/
|
||||
@ -216,6 +223,13 @@ export class ExtensionInstallationStateStore {
|
||||
return ExtensionInstallationStateStore.installing > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* If there is at least one extension currently ininstalling
|
||||
*/
|
||||
@computed static get anyUninstalling(): boolean {
|
||||
return ExtensionInstallationStateStore.uninstalling > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* The current number of extensions preinstalling
|
||||
*/
|
||||
|
||||
@ -109,7 +109,7 @@ export const InstalledExtensions = observer(({ extensions, uninstall, enable, di
|
||||
|
||||
return {
|
||||
extension: (
|
||||
<div className={cssNames("flex items-start", { [styles.frozenRow]: isUninstalling })}>
|
||||
<div className={"flex items-start"}>
|
||||
<div>
|
||||
<div className={styles.extensionName}>{name}</div>
|
||||
<div className={styles.extensionDescription}>{description}</div>
|
||||
@ -130,7 +130,7 @@ export const InstalledExtensions = observer(({ extensions, uninstall, enable, di
|
||||
onClick={() => disable(id)}
|
||||
>
|
||||
<Icon material="unpublished"/>
|
||||
<span className="title">Disable</span>
|
||||
<span className="title" aria-disabled={isUninstalling}>Disable</span>
|
||||
</MenuItem>
|
||||
) : (
|
||||
<MenuItem
|
||||
@ -138,7 +138,7 @@ export const InstalledExtensions = observer(({ extensions, uninstall, enable, di
|
||||
onClick={() => enable(id)}
|
||||
>
|
||||
<Icon material="check_circle"/>
|
||||
<span className="title">Enable</span>
|
||||
<span className="title" aria-disabled={isUninstalling}>Enable</span>
|
||||
</MenuItem>
|
||||
)}
|
||||
<MenuItem
|
||||
@ -146,17 +146,17 @@ export const InstalledExtensions = observer(({ extensions, uninstall, enable, di
|
||||
onClick={() => uninstall(extension)}
|
||||
>
|
||||
<Icon material="delete"/>
|
||||
<span className="title">Uninstall</span>
|
||||
<span className="title" aria-disabled={isUninstalling}>Uninstall</span>
|
||||
</MenuItem>
|
||||
</MenuActions>
|
||||
)
|
||||
};
|
||||
});
|
||||
}, [extensions]
|
||||
}, [extensions, ExtensionInstallationStateStore.anyUninstalling]
|
||||
);
|
||||
|
||||
return (
|
||||
<section>
|
||||
<section data-testid="extensions-table">
|
||||
<List
|
||||
title={<h2 className={styles.title}>Installed extensions</h2>}
|
||||
columns={columns}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user