graceguo-supercat commented on a change in pull request #9817:
URL:
https://github.com/apache/incubator-superset/pull/9817#discussion_r427040230
##########
File path:
superset-frontend/spec/javascripts/explore/components/ExploreChartHeader_spec.jsx
##########
@@ -65,24 +65,9 @@ describe('ExploreChartHeader', () => {
expect(wrapper.find(ExploreActionButtons)).toHaveLength(1);
});
- it('should updateChartTitleOrSaveSlice for existed slice', () => {
+ it('should update title but not save', () => {
const newTitle = 'New Chart Title';
- wrapper.instance().updateChartTitleOrSaveSlice(newTitle);
- expect(stub.call).toHaveLength(1);
- expect(stub).toHaveBeenCalledWith(mockProps.slice.form_data, {
- action: 'overwrite',
- slice_name: newTitle,
- });
- });
-
- it('should updateChartTitleOrSaveSlice for new slice', () => {
- const newTitle = 'New Chart Title';
- wrapper.setProps({ slice: undefined });
- wrapper.instance().updateChartTitleOrSaveSlice(newTitle);
- expect(stub.call).toHaveLength(1);
- expect(stub).toHaveBeenCalledWith(mockProps.form_data, {
- action: 'saveas',
- slice_name: newTitle,
- });
+ const editableTitle = wrapper.find(EditableTitle);
+ expect(editableTitle.props().onSaveTitle).toBe(updateChartTitleStub);
Review comment:
this line is to make sure child component EditableTitle will call
updateChartTitle for after title is changed.
In the old code, it was to make sure `saveSlice` was called by callback
function. In the new implementation, `updateChartTitle` is callback function.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]