Skip to content

Commit

Permalink
Merge branch 'master' into chris/FAL-3989-video-transcripts
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisChV committed Jan 29, 2025
2 parents 73c4bda + b7241a1 commit 729780e
Show file tree
Hide file tree
Showing 21 changed files with 339 additions and 77 deletions.
1 change: 1 addition & 0 deletions catalog-info.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ metadata:
icon: "Web"
annotations:
openedx.org/arch-interest-groups: ""
openedx.org/release: "master"
spec:
owner: group:2u-tnl
type: 'website'
Expand Down
11 changes: 0 additions & 11 deletions openedx.yaml

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,188 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`SettingsWidget isLibrary snapshot: renders Settings widget for Advanced Problem with correct widgets 1`] = `
<div
className="settingsWidget ml-4"
>
<div
className="mb-3"
>
<TypeCard
problemType="stringresponse"
/>
</div>
<div
className="mt-3"
>
<HintsCard
images={{}}
isLibrary={true}
learningContextId="course+org+run"
problemType="stringresponse"
/>
</div>
<Fragment />
<div>
<Advanced
open={false}
>
<Body
className="collapsible-body small"
>
<Button
className="my-3 px-0 text-info-500"
size="inline"
variant="link"
>
<FormattedMessage
defaultMessage="Show advanced settings"
description="Button text to show advanced settings"
id="authoring.problemeditor.settings.showAdvancedButton"
/>
</Button>
</Body>
</Advanced>
</div>
<Advanced
open={true}
>
<Body
className="collapsible-body"
>
<div
className="my-3"
>
<SwitchToAdvancedEditorCard
problemType="stringresponse"
/>
</div>
</Body>
</Advanced>
</div>
`;

exports[`SettingsWidget isLibrary snapshot: renders Settings widget page 1`] = `
<div
className="settingsWidget ml-4"
>
<div
className="mb-3"
>
<TypeCard
problemType="stringresponse"
/>
</div>
<div
className="mt-3"
>
<HintsCard
images={{}}
isLibrary={true}
learningContextId="course+org+run"
problemType="stringresponse"
/>
</div>
<Fragment />
<div>
<Advanced
open={true}
>
<Body
className="collapsible-body small"
>
<Button
className="my-3 px-0 text-info-500"
size="inline"
variant="link"
>
<FormattedMessage
defaultMessage="Show advanced settings"
description="Button text to show advanced settings"
id="authoring.problemeditor.settings.showAdvancedButton"
/>
</Button>
</Body>
</Advanced>
</div>
<Advanced
open={false}
>
<Body
className="collapsible-body"
>
<div
className="my-3"
>
<SwitchToAdvancedEditorCard
problemType="stringresponse"
/>
</div>
</Body>
</Advanced>
</div>
`;

exports[`SettingsWidget isLibrary snapshot: renders Settings widget page advanced settings visible 1`] = `
<div
className="settingsWidget ml-4"
>
<div
className="mb-3"
>
<TypeCard
problemType="stringresponse"
/>
</div>
<div
className="mt-3"
>
<HintsCard
images={{}}
isLibrary={true}
learningContextId="course+org+run"
problemType="stringresponse"
/>
</div>
<Fragment />
<div>
<Advanced
open={false}
>
<Body
className="collapsible-body small"
>
<Button
className="my-3 px-0 text-info-500"
size="inline"
variant="link"
>
<FormattedMessage
defaultMessage="Show advanced settings"
description="Button text to show advanced settings"
id="authoring.problemeditor.settings.showAdvancedButton"
/>
</Button>
</Body>
</Advanced>
</div>
<Advanced
open={true}
>
<Body
className="collapsible-body"
>
<div
className="my-3"
>
<SwitchToAdvancedEditorCard
problemType="stringresponse"
/>
</div>
</Body>
</Advanced>
</div>
`;

exports[`SettingsWidget snapshot snapshot: renders Settings widget for Advanced Problem with correct widgets 1`] = `
<div
className="settingsWidget ml-4"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,15 @@ const SettingsWidget = ({
/>
</div>
)}
<div className="my-3">
<ScoringCard
scoring={settings.scoring}
defaultValue={defaultSettings.maxAttempts}
updateSettings={updateSettings}
/>
</div>
{!isLibrary && (
<div className="my-3">
<ScoringCard
scoring={settings.scoring}
defaultValue={defaultSettings.maxAttempts}
updateSettings={updateSettings}
/>
</div>
)}
<div className="mt-3">
<HintsCard
problemType={problemType}
Expand Down Expand Up @@ -114,23 +116,26 @@ const SettingsWidget = ({
</Collapsible.Body>
</Collapsible.Advanced>
</div>

<Collapsible.Advanced open={isAdvancedCardsVisible}>
<Collapsible.Body className="collapsible-body">
<div className="my-3">
<ShowAnswerCard
showAnswer={settings.showAnswer}
defaultValue={defaultSettings.showanswer}
updateSettings={updateSettings}
/>
</div>
<div className="my-3">
<ResetCard
showResetButton={settings.showResetButton}
defaultValue={defaultSettings.showResetButton}
updateSettings={updateSettings}
/>
</div>
{!isLibrary && (
<div className="my-3">
<ShowAnswerCard
showAnswer={settings.showAnswer}
defaultValue={defaultSettings.showanswer}
updateSettings={updateSettings}
/>
</div>
)}
{!isLibrary && (
<div className="my-3">
<ResetCard
showResetButton={settings.showResetButton}
defaultValue={defaultSettings.showResetButton}
updateSettings={updateSettings}
/>
</div>
)}
{
problemType === ProblemTypeKeys.ADVANCED && (
<div className="my-3">
Expand All @@ -142,9 +147,11 @@ const SettingsWidget = ({
</div>
)
}
<div className="my-3">
<TimerCard timeBetween={settings.timeBetween} updateSettings={updateSettings} />
</div>
{!isLibrary && (
<div className="my-3">
<TimerCard timeBetween={settings.timeBetween} updateSettings={updateSettings} />
</div>
)}
<div className="my-3">
<SwitchToAdvancedEditorCard problemType={problemType} />
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,39 @@ describe('SettingsWidget', () => {
});
});

describe('isLibrary', () => {
const libraryProps = {
...props,
isLibrary: true,
};
test('snapshot: renders Settings widget page', () => {
const showAdvancedSettingsCardsProps = {
isAdvancedCardsVisible: false,
setResetTrue: jest.fn().mockName('showAdvancedSettingsCards.setResetTrue'),
};
showAdvancedSettingsCards.mockReturnValue(showAdvancedSettingsCardsProps);
expect(shallow(<SettingsWidget {...libraryProps} />).snapshot).toMatchSnapshot();
});
test('snapshot: renders Settings widget page advanced settings visible', () => {
const showAdvancedSettingsCardsProps = {
isAdvancedCardsVisible: true,
setResetTrue: jest.fn().mockName('showAdvancedSettingsCards.setResetTrue'),
};
showAdvancedSettingsCards.mockReturnValue(showAdvancedSettingsCardsProps);
expect(shallow(<SettingsWidget {...libraryProps} />).snapshot).toMatchSnapshot();
});
test('snapshot: renders Settings widget for Advanced Problem with correct widgets', () => {
const showAdvancedSettingsCardsProps = {
isAdvancedCardsVisible: true,
setResetTrue: jest.fn().mockName('showAdvancedSettingsCards.setResetTrue'),
};
showAdvancedSettingsCards.mockReturnValue(showAdvancedSettingsCardsProps);
expect(shallow(
<SettingsWidget problemType={ProblemTypeKeys.ADVANCED} {...libraryProps} />,
).snapshot).toMatchSnapshot();
});
});

describe('mapDispatchToProps', () => {
test('setBlockTitle from actions.app.setBlockTitle', () => {
expect(mapDispatchToProps.setBlockTitle).toEqual(actions.app.setBlockTitle);
Expand Down
10 changes: 3 additions & 7 deletions src/grading-settings/grading-scale/GradingScale.scss
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

.grading-scale-segments-and-ticks {
display: inline-block;
height: 3.125rem;
height: 3.5rem;
width: 100%;
border: 1px solid $black;
overflow: hidden;
Expand Down Expand Up @@ -70,13 +70,9 @@
}

.grading-scale-segment-btn-remove {
font: normal $font-weight-normal .6875rem/1 $font-family-base;
font-size: x-small;
display: none;
position: absolute;
top: -1.5625rem;
right: -.375rem;
padding: .375rem;
text-decoration: none;
margin: -2px -4px 0 0;
}

.grading-scale-segment-content {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,19 +66,19 @@ const GradingScaleSegment = ({
<span data-testid="grading-scale-segment-number" className="grading-scale-segment-content-number m-0">
{gradingSegments[idx === 0 ? 0 : idx - 1]?.previous} - {value === 100 ? value : value - 1}
</span>
{idx !== gradingSegments.length && idx - 1 !== 0 && (
<Button
variant="link"
size="inline"
className="grading-scale-segment-btn-remove"
data-testid="grading-scale-btn-remove"
type="button"
onClick={() => removeGradingSegment(idx)}
>
{intl.formatMessage(messages.removeSegmentButtonText)}
</Button>
)}
</div>
{idx !== gradingSegments.length && idx - 1 !== 0 && (
<Button
variant="link"
size="inline"
className="grading-scale-segment-btn-remove"
data-testid="grading-scale-btn-remove"
type="button"
onClick={() => removeGradingSegment(idx)}
>
{intl.formatMessage(messages.removeSegmentButtonText)}
</Button>
)}
</div>
);
};
Expand Down
Loading

0 comments on commit 729780e

Please sign in to comment.