Skip to content
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: fixes and refactorings after rebase #237

Merged
merged 2 commits into from
Apr 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/course-outline/CourseOutline.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,12 @@ import HighlightsModal from './highlights-modal/HighlightsModal';
import EmptyPlaceholder from './empty-placeholder/EmptyPlaceholder';
import PublishModal from './publish-modal/PublishModal';
import PageAlerts from './page-alerts/PageAlerts';
import DraggableList from './drag-helper/DraggableList';
import DraggableList from '../generic/drag-helper/DraggableList';
import {
canMoveSection,
possibleUnitMoves,
possibleSubsectionMoves,
} from './drag-helper/utils';
} from '../generic/drag-helper/utils';
import { useCourseOutline } from './hooks';
import messages from './messages';

Expand Down
2 changes: 1 addition & 1 deletion src/course-outline/CourseOutline.scss
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
@import "./empty-placeholder/EmptyPlaceholder";
@import "./highlights-modal/HighlightsModal";
@import "./publish-modal/PublishModal";
@import "./drag-helper/SortableItem";
@import "../generic/drag-helper/SortableItem";
@import "./xblock-status/XBlockStatus";

div.row:has(> div > div.highlight) {
Expand Down
2 changes: 1 addition & 1 deletion src/course-outline/CourseOutline.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ import {
moveUnitOver,
moveSubsection,
moveUnit,
} from './drag-helper/utils';
} from '../generic/drag-helper/utils';

let axiosMock;
let store;
Expand Down
4 changes: 2 additions & 2 deletions src/course-outline/section-card/SectionCard.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ import classNames from 'classnames';
import { setCurrentItem, setCurrentSection } from '../data/slice';
import { RequestStatus } from '../../data/constants';
import CardHeader from '../card-header/CardHeader';
import SortableItem from '../drag-helper/SortableItem';
import { DragContext } from '../drag-helper/DragContextProvider';
import SortableItem from '../../generic/drag-helper/SortableItem';
import { DragContext } from '../../generic/drag-helper/DragContextProvider';
import TitleButton from '../card-header/TitleButton';
import XBlockStatus from '../xblock-status/XBlockStatus';
import { getItemStatus, getItemStatusBorder, scrollToElement } from '../utils';
Expand Down
4 changes: 2 additions & 2 deletions src/course-outline/subsection-card/SubsectionCard.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ import { isEmpty } from 'lodash';
import { setCurrentItem, setCurrentSection, setCurrentSubsection } from '../data/slice';
import { RequestStatus } from '../../data/constants';
import CardHeader from '../card-header/CardHeader';
import SortableItem from '../drag-helper/SortableItem';
import { DragContext } from '../drag-helper/DragContextProvider';
import SortableItem from '../../generic/drag-helper/SortableItem';
import { DragContext } from '../../generic/drag-helper/DragContextProvider';
import { useCopyToClipboard, PasteComponent } from '../../generic/clipboard';
import TitleButton from '../card-header/TitleButton';
import XBlockStatus from '../xblock-status/XBlockStatus';
Expand Down
2 changes: 1 addition & 1 deletion src/course-outline/unit-card/UnitCard.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { useSearchParams } from 'react-router-dom';
import { setCurrentItem, setCurrentSection, setCurrentSubsection } from '../data/slice';
import { RequestStatus } from '../../data/constants';
import CardHeader from '../card-header/CardHeader';
import SortableItem from '../drag-helper/SortableItem';
import SortableItem from '../../generic/drag-helper/SortableItem';
import TitleLink from '../card-header/TitleLink';
import XBlockStatus from '../xblock-status/XBlockStatus';
import { getItemStatus, getItemStatusBorder, scrollToElement } from '../utils';
Expand Down
15 changes: 10 additions & 5 deletions src/course-unit/CourseUnit.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -597,6 +597,14 @@ describe('<CourseUnit />', () => {
name: 'New Cloned XBlock',
block_id: '1234567890',
block_type: 'drag-and-drop-v2',
actions: {
canCopy: true,
canDuplicate: true,
canMove: true,
canManageAccess: true,
canManageTags: true,
canDelete: true,
},
user_partition_info: {},
},
],
Expand Down Expand Up @@ -990,10 +998,7 @@ describe('<CourseUnit />', () => {
children: [
{
...courseVerticalChildrenMock.children[0],
actions: {
...courseVerticalChildrenMock.children[0].actions,
updatedXBlockActions,
},
actions: updatedXBlockActions,
},
],
});
Expand All @@ -1009,7 +1014,7 @@ describe('<CourseUnit />', () => {
const moveBtn = queryByRole('button', { name: courseXBlockMessages.blockLabelButtonMove.defaultMessage });
const copyToClipboardBtn = queryByRole('button', { name: courseXBlockMessages.blockLabelButtonCopyToClipboard.defaultMessage });
const manageAccessBtn = queryByRole('button', { name: courseXBlockMessages.blockLabelButtonManageAccess.defaultMessage });
const manageTagsBtn = queryByRole('button', { name: courseXBlockMessages.blockLabelButtonManageTags.defaultMessage });
const manageTagsBtn = queryByRole('link', { name: courseXBlockMessages.blockLabelButtonManageTags.defaultMessage });

expect(deleteBtn).not.toBeInTheDocument();
expect(duplicateBtn).not.toBeInTheDocument();
Expand Down
5 changes: 0 additions & 5 deletions src/course-unit/course-xblock/CourseXBlock.scss
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,6 @@
font-size: $font-size-sm;
}

.pgn__card-header-subtitle-md {
margin-top: 0;
font-size: 1rem;
}

.pgn__card-header-title-md {
font: 700 1.375rem/1.75rem $font-family-sans-serif;
color: $black;
Expand Down
8 changes: 0 additions & 8 deletions src/course-unit/course-xblock/messages.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,6 @@ const messages = defineMessages({
id: 'course-authoring.course-unit.xblock.button.manageTags.label',
defaultMessage: 'Manage tags',
},
visibilityMessage: {
id: 'course-authoring.course-unit.xblock.visibility.message',
defaultMessage: 'Access restricted to: {selectedGroupsLabel}',
},
validationSummary: {
id: 'course-authoring.course-unit.xblock.validation.summary',
defaultMessage: 'This component has validation issues.',
},
expandTooltip: {
id: 'course-authoring.course-unit.xblock.expandTooltip',
defaultMessage: 'Collapse/Expand this block',
Expand Down
2 changes: 1 addition & 1 deletion src/course-unit/header-title/HeaderTitle.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ const HeaderTitle = ({

return (
<>
<div className="d-flex align-items-center lead">
<div className="d-flex align-items-center lead" data-testid="unit-header-title">
{isTitleEditFormOpen ? (
<Form.Group className="m-0">
<Form.Control
Expand Down
8 changes: 0 additions & 8 deletions src/course-unit/header-title/messages.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,6 @@ const messages = defineMessages({
defaultMessage: 'Access to some content in this unit is restricted to specific groups of learners.',
description: 'The label text of some content restriction in this unit',
},
definedVisibilityMessage: {
id: 'course-authoring.course-unit.heading.visibility.defined.message',
defaultMessage: 'Access to this unit is restricted to: {selectedGroupsLabel}',
},
commonVisibilityMessage: {
id: 'course-authoring.course-unit.heading.visibility.common.message',
defaultMessage: 'Access to some content in this unit is restricted to specific groups of learners.',
},
});

export default messages;
2 changes: 1 addition & 1 deletion src/generic/drag-helper/DraggableList.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import {
import { restrictToVerticalAxis } from '@dnd-kit/modifiers';

import DragContextProvider from './DragContextProvider';
import { COURSE_BLOCK_NAMES } from '../constants';
import { COURSE_BLOCK_NAMES } from '../../constants';
import {
moveSubsectionOver,
moveUnitOver,
Expand Down
8 changes: 4 additions & 4 deletions src/generic/modal-dropzone/ModalDropzone.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -138,13 +138,13 @@ describe('<ModalDropzone />', () => {
const { getByText, getByRole } = render(<RootWrapper {...props} maxSize={maxSizeInBytes} />);
const dropzoneInput = getByRole('presentation', { hidden: true });

const file = new File(
const imageFile = new File(
[new ArrayBuffer(maxSizeInBytes + 1)],
'test-file.png',
{ type: 'image/png' },
);

userEvent.upload(dropzoneInput.firstChild, file);
userEvent.upload(dropzoneInput.firstChild, imageFile);

await waitFor(() => {
// Assert that the error message is displayed
Expand All @@ -164,13 +164,13 @@ describe('<ModalDropzone />', () => {
);
const dropzoneInput = getByRole('presentation', { hidden: true });

const file = new File(
const imageFile = new File(
[new ArrayBuffer(maxSizeInBytes + 1)],
'test-file.png',
{ type: 'image/png' },
);

userEvent.upload(dropzoneInput.firstChild, file);
userEvent.upload(dropzoneInput.firstChild, imageFile);

await waitFor(() => {
expect(getByText(expectedErrorMessage)).toBeInTheDocument();
Expand Down
Loading