feat: The X Button in the Top Right Doesn't do anything. (#66)
* fix: tests * fix: onClose test case
This commit is contained in:
@@ -12,7 +12,13 @@ exports[`EditorContainer component render snapshot: initialized. enable save and
|
||||
>
|
||||
<IconButton
|
||||
iconAs="Icon"
|
||||
onClick={[MockFunction props.onClose]}
|
||||
onClick={
|
||||
Object {
|
||||
"handleCancelClicked": Object {
|
||||
"onClose": [MockFunction props.onClose],
|
||||
},
|
||||
}
|
||||
}
|
||||
src={[MockFunction icons.Close]}
|
||||
/>
|
||||
</div>
|
||||
@@ -54,7 +60,13 @@ exports[`EditorContainer component render snapshot: not initialized. disable sav
|
||||
>
|
||||
<IconButton
|
||||
iconAs="Icon"
|
||||
onClick={[MockFunction props.onClose]}
|
||||
onClick={
|
||||
Object {
|
||||
"handleCancelClicked": Object {
|
||||
"onClose": [MockFunction props.onClose],
|
||||
},
|
||||
}
|
||||
}
|
||||
src={[MockFunction icons.Close]}
|
||||
/>
|
||||
</div>
|
||||
|
||||
@@ -27,7 +27,7 @@ export const EditorContainer = ({
|
||||
<IconButton
|
||||
src={Close}
|
||||
iconAs={Icon}
|
||||
onClick={onClose}
|
||||
onClick={handleCancelClicked}
|
||||
/>
|
||||
</div>
|
||||
</ModalDialog.Title>
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { IconButton } from '@edx/paragon';
|
||||
import { shallow } from 'enzyme';
|
||||
import { useDispatch } from 'react-redux';
|
||||
|
||||
@@ -36,16 +37,23 @@ describe('EditorContainer component', () => {
|
||||
beforeEach(() => {
|
||||
el = shallow(<EditorContainer {...props}>{testContent}</EditorContainer>);
|
||||
});
|
||||
test('close behavior is linked to modal onClose and footer onCancel', () => {
|
||||
test('close behavior is linked to modal onClose', () => {
|
||||
const expected = hooks.handleCancelClicked({ onClose: props.onClose });
|
||||
expect(el.children().at(2).props().onCancel).toEqual(expected);
|
||||
expect(el.find(IconButton)
|
||||
.props().onClick).toEqual(expected);
|
||||
});
|
||||
test('close behavior is linked to footer onCancel', () => {
|
||||
const expected = hooks.handleCancelClicked({ onClose: props.onClose });
|
||||
expect(el.children().at(2)
|
||||
.props().onCancel).toEqual(expected);
|
||||
});
|
||||
test('save behavior is linked to footer onSave', () => {
|
||||
const expected = hooks.handleSaveClicked({
|
||||
getContent: props.getContent,
|
||||
dispatch: useDispatch(),
|
||||
});
|
||||
expect(el.children().at(2).props().onSave).toEqual(expected);
|
||||
expect(el.children().at(2)
|
||||
.props().onSave).toEqual(expected);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user