Skip to content

Commit

Permalink
Fixes #36106 - EditorNavbar PF4 Refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
LiorKGOW committed Jul 13, 2023
1 parent 414c1c6 commit 048c19c
Show file tree
Hide file tree
Showing 41 changed files with 1,246 additions and 2,212 deletions.
15 changes: 0 additions & 15 deletions app/assets/stylesheets/base.scss
Original file line number Diff line number Diff line change
Expand Up @@ -491,21 +491,6 @@ table {
line-height: 2;
}

.navbar-editor
> span
> .select2-container
.select2-choices
.select2-search-field
input,
.select2-container .select2-choice,
.select2-container .select2-choices .select2-chosen {
height: 24px;

.select2-search-choice-close {
top: 6px;
}
}

.select2-chosen,
.select2-choice > span:first-child,
.select2-container .select2-choices .select2-search-field input {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@ const DiffToggle = ({ stateView, changeState }) => {
isSelected && changeState(viewType);

return (
<ToggleGroup id="diff-toggle-buttons" aria-label="editor-diff-buttons">
<ToggleGroup
id="diff-toggle-buttons"
aria-label="editor-diff-buttons"
isCompact
>
<ToggleGroupItem
key={`${SPLIT}-btn`}
text={__('Split')}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ export const editor = {
autocompletion: true,
liveAutocompletion: false,
keyBinding: 'Default',
selectedView: 'input',
editorName: 'editor',
isMaximized: false,
isMasked: false,
Expand Down Expand Up @@ -68,7 +67,6 @@ export const editorOptions = {
changeDiffViewType: noop,
changeEditorValue: noop,
dismissErrorToast: noop,
changeTab: noop,
toggleMaskValue: noop,
changeSetting: noop,
toggleRenderView: noop,
Expand All @@ -87,3 +85,64 @@ export const hosts = [
{ id: '1', name: 'host1' },
{ id: '2', name: 'host2' },
];

// context values for EditorContext.Provider:
export const inputEditorContextValue = {
selectedView: 'input',
setSelectedView: jest.fn(),
};

export const diffEditorContextValue = {
selectedView: 'diff',
setSelectedView: jest.fn(),
};

export const previewEditorContextValue = {
selectedView: 'preview',
setSelectedView: jest.fn(),
};

// Editor Tabs render props:
export const editorTabsProps = {
isRendering: false,
toggleRenderView: jest.fn(),
showPreview: true,
selectedHost: { id: '', name: '' },
fetchAndPreview: jest.fn(),
selectedRenderPath: "is used only by the mock function fetchAndPreview",
templateKindId: "is used only by the mock function fetchAndPreview",
showHostSelector: false,
};

export const editorTabsWithoutDiff = {
...editorTabsProps,
isDiff: false,
};

export const editorTabsWithDiff = {
...editorTabsProps,
isDiff: true,
};

// classNames for EditorTabs:
export const PF_CURRENT = 'pf-m-current';
export const ARIA_SELECTED = 'aria-selected';

// EditorModal fixtures:
export const EditorModalfixtures = {
...editorOptions,
editorValue: '</>',
isMaximized: true,
changeDiffViewType: noop,
};

// EditorSettings fixtures:
export const editorSettingsFixtures = {
...dropdowns,
mode: 'Ruby',
theme: 'Github',
autocompletion: true,
liveAutocompletion: false,
keyBinding: 'Vim',
changeSetting: noop,
};
Loading

0 comments on commit 048c19c

Please sign in to comment.