Skip to content

Commit ede5ce1

Browse files
committed
Add a Storybook story for the new-property row.
Show the Advanced data breakdowns row with the Enable button disabled during new property setup, and add a Backstop scenario for it.
1 parent 25051f3 commit ede5ce1

1 file changed

Lines changed: 56 additions & 20 deletions

File tree

assets/js/modules/analytics-4/components/settings/SettingsForm.stories.js

Lines changed: 56 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,11 @@ import { CORE_SITE } from '@/js/googlesitekit/datastore/site/constants';
2828
import { Cell, Grid, Row } from '@/js/material-components';
2929
import { MODULE_SLUG_ANALYTICS_4 } from '@/js/modules/analytics-4/constants';
3030
import * as fixtures from '@/js/modules/analytics-4/datastore/__fixtures__';
31-
import { MODULES_ANALYTICS_4 } from '@/js/modules/analytics-4/datastore/constants';
31+
import {
32+
MODULES_ANALYTICS_4,
33+
PROPERTY_CREATE,
34+
WEBDATASTREAM_CREATE,
35+
} from '@/js/modules/analytics-4/datastore/constants';
3236
import { provideModules } from '@tests/js/utils';
3337
import WithRegistrySetup from '@tests/js/WithRegistrySetup';
3438
import SettingsForm from './SettingsForm';
@@ -321,8 +325,11 @@ WithSiteGoalsBreakdownsRow.decorators = [
321325
registry
322326
.dispatch( MODULES_ANALYTICS_4 )
323327
.receiveGetAdvancedDataBreakdownsSettings( {
324-
enabled: false,
328+
[ propertyID ]: false,
325329
} );
330+
registry
331+
.dispatch( MODULES_ANALYTICS_4 )
332+
.receiveGetCustomDimensions( [], { propertyID } );
326333
}
327334

328335
return (
@@ -346,25 +353,21 @@ WithSiteGoalsBreakdownsRowEnabled.decorators = [
346353
registry
347354
.dispatch( MODULES_ANALYTICS_4 )
348355
.receiveGetAdvancedDataBreakdownsSettings( {
349-
enabled: true,
356+
[ propertyID ]: true,
350357
} );
351-
registry.dispatch( MODULES_ANALYTICS_4 ).setSettings( {
352-
accountID,
353-
propertyID,
354-
webDataStreamID,
355-
measurementID,
356-
useSnippet: true,
357-
anonymizeIP: true,
358-
trackingDisabled: [ 'loggedinUsers' ],
359-
availableCustomDimensions: [
360-
'googlesitekit_post_date',
361-
'googlesitekit_post_author',
362-
'googlesitekit_post_categories',
363-
'googlesitekit_post_type',
364-
'googlesitekit_event_provider',
365-
'googlesitekit_form_id',
366-
],
367-
} );
358+
registry
359+
.dispatch( MODULES_ANALYTICS_4 )
360+
.receiveGetCustomDimensions(
361+
[
362+
'googlesitekit_post_date',
363+
'googlesitekit_post_author',
364+
'googlesitekit_post_categories',
365+
'googlesitekit_post_type',
366+
'googlesitekit_event_provider',
367+
'googlesitekit_form_id',
368+
],
369+
{ propertyID }
370+
);
368371
}
369372

370373
return (
@@ -376,6 +379,39 @@ WithSiteGoalsBreakdownsRowEnabled.decorators = [
376379
];
377380
WithSiteGoalsBreakdownsRowEnabled.scenario = {};
378381

382+
export const WithSiteGoalsBreakdownsRowNewProperty = Template.bind( null );
383+
WithSiteGoalsBreakdownsRowNewProperty.storyName =
384+
'With Site Goals custom dimensions row and a new property';
385+
WithSiteGoalsBreakdownsRowNewProperty.parameters = {
386+
features: [ 'siteGoals' ],
387+
};
388+
WithSiteGoalsBreakdownsRowNewProperty.decorators = [
389+
( Story ) => {
390+
function setupRegistry( registry ) {
391+
registry
392+
.dispatch( MODULES_ANALYTICS_4 )
393+
.receiveGetAdvancedDataBreakdownsSettings( {
394+
[ propertyID ]: true,
395+
} );
396+
// Select "Set up a new property", which disables the Enable
397+
// button in the Advanced data breakdowns row.
398+
registry
399+
.dispatch( MODULES_ANALYTICS_4 )
400+
.setPropertyID( PROPERTY_CREATE );
401+
registry
402+
.dispatch( MODULES_ANALYTICS_4 )
403+
.setWebDataStreamID( WEBDATASTREAM_CREATE );
404+
}
405+
406+
return (
407+
<WithRegistrySetup func={ setupRegistry }>
408+
<Story />
409+
</WithRegistrySetup>
410+
);
411+
},
412+
];
413+
WithSiteGoalsBreakdownsRowNewProperty.scenario = {};
414+
379415
export default {
380416
title: 'Modules/Analytics4/Settings/SettingsEdit',
381417
decorators: [

0 commit comments

Comments
 (0)