fix: remove reset widget from advnaced editor

This commit is contained in:
connorhaugh
2023-03-02 10:20:22 -05:00
parent 7a8a182d5a
commit 77f030c3fe
3 changed files with 102 additions and 3 deletions

View File

@@ -1,5 +1,92 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`SettingsWidget snapshot 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="my-3"
>
<ScoringCard />
</div>
<div
className="mt-3"
>
<HintsCard
problemType="stringresponse"
/>
</div>
<div
className="mt-3"
>
<GroupFeedback />
</div>
<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"
>
<ShowAnswerCard />
</div>
<div
className="my-3"
>
<ResetCard />
</div>
<div
className="my-3"
>
<TimerCard />
</div>
<div
className="my-3"
>
<MatlabCard />
</div>
<div
className="my-3"
>
<SwitchToAdvancedEditorCard
problemType="stringresponse"
/>
</div>
</Body>
</Advanced>
</div>
`;
exports[`SettingsWidget snapshot snapshot: renders Settings widget page 1`] = `
<div
className="settingsWidget ml-4"

View File

@@ -107,9 +107,13 @@ export const SettingsWidget = ({
solutionExplanation={settings.solutionExplanation}
/>
</div>
<div className="my-3">
<ResetCard showResetButton={settings.showResetButton} updateSettings={updateSettings} />
</div>
{
problemType !== ProblemTypeKeys.ADVANCED && (
<div className="my-3">
<ResetCard showResetButton={settings.showResetButton} updateSettings={updateSettings} />
</div>
)
}
{
problemType === ProblemTypeKeys.ADVANCED && (
<div className="my-3">

View File

@@ -56,6 +56,14 @@ describe('SettingsWidget', () => {
showAdvancedSettingsCards.mockReturnValue(showAdvancedSettingsCardsProps);
expect(shallow(<SettingsWidget {...props} />)).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} {...props} />)).toMatchSnapshot();
});
});
describe('mapDispatchToProps', () => {