mirror of
https://github.com/n8n-io/n8n.git
synced 2025-02-21 02:56:40 -08:00
fix(editor): Hide version control main menu component if no feature flag (#6419)
* fix(editor): Hide version control main menu component if no feature flag * fix(editor): Update unit tes * test(editor): Test for feature flag
This commit is contained in:
parent
d041602754
commit
75c0ab03f8
|
@ -25,7 +25,7 @@ const tooltipOpenDelay = ref(300);
|
|||
const currentBranch = computed(() => {
|
||||
return versionControlStore.preferences.branchName;
|
||||
});
|
||||
|
||||
const featureEnabled = computed(() => window.localStorage.getItem('version-control'));
|
||||
const setupButtonTooltipPlacement = computed(() => (props.isCollapsed ? 'right' : 'top'));
|
||||
|
||||
async function pushWorkfolder() {
|
||||
|
@ -80,6 +80,7 @@ const goToVersionControlSetup = async () => {
|
|||
|
||||
<template>
|
||||
<div
|
||||
v-if="featureEnabled"
|
||||
:class="{
|
||||
[$style.sync]: true,
|
||||
[$style.collapsed]: isCollapsed,
|
||||
|
|
|
@ -28,7 +28,10 @@ const renderComponent = (renderOptions: Parameters<typeof render>[1] = {}) => {
|
|||
};
|
||||
|
||||
describe('MainSidebarVersionControl', () => {
|
||||
const getItemSpy = vi.spyOn(Storage.prototype, 'getItem');
|
||||
|
||||
beforeEach(() => {
|
||||
getItemSpy.mockReturnValue('true');
|
||||
pinia = createTestingPinia({
|
||||
initialState: {
|
||||
[STORES.SETTINGS]: {
|
||||
|
@ -41,6 +44,12 @@ describe('MainSidebarVersionControl', () => {
|
|||
usersStore = useUsersStore();
|
||||
});
|
||||
|
||||
it('should render nothing', async () => {
|
||||
getItemSpy.mockReturnValue(null);
|
||||
const { container } = renderComponent({ props: { isCollapsed: false } });
|
||||
expect(container).toBeEmptyDOMElement();
|
||||
});
|
||||
|
||||
it('should render empty content', async () => {
|
||||
const { getByTestId } = renderComponent({ props: { isCollapsed: false } });
|
||||
expect(getByTestId('main-sidebar-version-control')).toBeInTheDocument();
|
||||
|
|
Loading…
Reference in a new issue