-
Notifications
You must be signed in to change notification settings - Fork 680
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: disabled download button for certain versions on darwin arm64 #1019
Conversation
Co-authored-by: Erick Zhao <erick@hotmail.ca>
Thanks for taking this up @Ayman161803. I was actually referring to the download buttons under preferences when I made that issue, but you're right, the ones in the version select also have the same problem. 😄 Unfortunately I think this needs to be changed a bit. The changes to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's also cover the download buttons in the Electron section in preferences.
Hey @dsanders11! I have made recommended changes to this PR i.e. |
Before adding unit tests, you also need to update the |
Co-authored-by: Black-Hole <158blackhole@gmail.com>
Hey @BlackHole1! I have committed recommended changes. I am pretty new to writing unit tests. Please recommend changes, if any. Also, I tried updating snapshots as well but it doesn't look like they are getting updated. |
Component unit tests e.g. @@ -0,0 +1,42 @@
diff --git a/tests/renderer/components/version-select-spec.tsx b/tests/renderer/components/version-select-spec.tsx
index 3a6bab6..16bdb50 100644
--- a/tests/renderer/components/version-select-spec.tsx
+++ b/tests/renderer/components/version-select-spec.tsx
@@ -14,12 +14,15 @@ import {
renderItem,
VersionSelect,
} from '../../../src/renderer/components/version-select';
+import { disableDownload } from '../../../src/utils/disable-download';
import { StateMock, VersionsMock } from '../../mocks/mocks';
const { downloading, ready, unknown, unzipping } = VersionState;
const { remote, local } = VersionSource;
+jest.mock('../../../src/utils/disable-download.ts');
+
describe('VersionSelect component', () => {
let store: StateMock;
@@ -85,6 +88,21 @@ describe('VersionSelect component', () => {
expect(item).toBe(null);
});
+
+ it('xxxxx', () => {
+ (disableDownload as any).mockReturnValueOnce(true);
+
+ const item = renderItem(mockVersion1, {
+ handleClick: () => ({}),
+ index: 0,
+ modifiers: { active: true, disabled: false, matchesPredicate: true },
+ query: '',
+ })!;
+
+ const ItemWrapper = shallow(item);
+
+ expect(ItemWrapper.find('.disabled-menu-tooltip')).toHaveLength(1);
+ });
});
describe('getItemLabel()', () => {
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
cc: @dsanders11
Done🚀. All unit test pass 🎉 |
Ping @dsanders11 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
Sorry it took so long to circle back around on this @Ayman161803. Thanks for implementing it!
Heyy! Thanks for having this merged. |
Fixes #1017
I have disabled the download button for certain versions on darwin-arm64 as suggested by @dsanders11. I used the semver package to compare versions and added necessary stylings to
commands.less
. I have tested the changes made with results as given below.The sample pic above is when condition
process.platform==="linux" && process.arch==="x64" && semver.lt(item.version,"15.0.0")
is applied to disable buttons