@capillarytech/creatives-library 7.14.2 → 7.14.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -120,7 +120,7 @@ export class Creatives extends React.Component {
|
|
|
120
120
|
this.resetStep();
|
|
121
121
|
};
|
|
122
122
|
onChannelChange = (channel) => {
|
|
123
|
-
this.setState({currentChannel: channel});
|
|
123
|
+
this.setState({currentChannel: channel, templateData: null});
|
|
124
124
|
}
|
|
125
125
|
onCreateNextStep = () => {
|
|
126
126
|
this.setState((prevState) => {
|
|
@@ -104,6 +104,25 @@ describe('Test SlideBoxContent container', () => {
|
|
|
104
104
|
expect(getCreativesData).toHaveBeenCalledTimes(2);
|
|
105
105
|
});
|
|
106
106
|
|
|
107
|
+
it.only('It should clear templateData, on channel change.', async () => {
|
|
108
|
+
renderFunction(
|
|
109
|
+
'WHATSAPP',
|
|
110
|
+
'editTemplate',
|
|
111
|
+
whatsappTemplates,
|
|
112
|
+
whatsappGetCreativeData1,
|
|
113
|
+
);
|
|
114
|
+
renderedComponent.instance().onEditTemplate();
|
|
115
|
+
renderedComponent
|
|
116
|
+
.find('CapSlideBox')
|
|
117
|
+
.props()
|
|
118
|
+
.content.props.getFormData(whatsappGetCreativeData1);
|
|
119
|
+
|
|
120
|
+
const componentInstance = renderedComponent.instance()
|
|
121
|
+
expect(componentInstance.state.templateData).toBeDefined();
|
|
122
|
+
expect(componentInstance.onChannelChange("MOBILEPUSH"));
|
|
123
|
+
expect(componentInstance.state.templateData).not.toBeDefined();
|
|
124
|
+
});
|
|
125
|
+
|
|
107
126
|
it('campaign message, add creative click rcs', () => {
|
|
108
127
|
renderFunction('RCS', 'createTemplate', rcsTemplates, { mode: 'create' });
|
|
109
128
|
expect(renderedComponent).toMatchSnapshot();
|
|
@@ -854,7 +854,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
854
854
|
/>
|
|
855
855
|
);
|
|
856
856
|
|
|
857
|
-
getTemplateDataForGrid = ({templates, handlers, filterContent, channel, isLoading, loadingTip}) => {
|
|
857
|
+
getTemplateDataForGrid = ({templates=[], handlers, filterContent, channel, isLoading, loadingTip}) => {
|
|
858
858
|
const currentChannel = channel.toUpperCase();
|
|
859
859
|
const {channel: stateChannel} = this.state;
|
|
860
860
|
const channelLowerCase = stateChannel.toLowerCase();
|