You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by GitBox <gi...@apache.org> on 2020/05/19 05:35:22 UTC

[GitHub] [incubator-superset] graceguo-supercat commented on a change in pull request #9817: fix: [explore view] inline edit slice name should not overwrite

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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org