-
Notifications
You must be signed in to change notification settings - Fork 295
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enhance/#6932 - GA4 dashboard prompt banner notification #7026
Enhance/#6932 - GA4 dashboard prompt banner notification #7026
Conversation
Size Change: +2.34 kB (0%) Total Size: 1.31 MB
ℹ️ View Unchanged
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @hussain-t, this is working well in my testing but we should avoid disabling the complexity rule, so I'm sending back your way for a bit of refactoring.
@@ -84,6 +85,7 @@ async function submitGA4Changes( { select, dispatch } ) { | |||
return await dispatch( MODULES_ANALYTICS_4 ).submitChanges(); | |||
} | |||
|
|||
// eslint-disable-next-line complexity |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@hussain-t, I really don't think we should be disabling this rule in any new scenarios. By disabling the rule it means we can keep adding more complexity to this function without any warning or check on it, which is a bit of a step backward.
Please can you instead refactor this function a bit, extracting some of it into new functions if needs be.
@@ -621,6 +627,132 @@ describe( 'modules/analytics settings', () => { | |||
} ); | |||
} ); | |||
|
|||
describe( 'dismiss switch ga4 dashboard view notification', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should capitalise the initials in GA4 when using it in a sentence... I'd also make the following minor grammatical tweak:
describe( 'dismiss switch ga4 dashboard view notification', () => { | |
describe( 'dismiss the switch to GA4 dashboard view notification', () => { |
'^/google-site-kit/v1/core/user/data/dismiss-item' | ||
); | ||
|
||
it( 'should not dismiss the switch ga4 dashboard view notification if it is a UA dashboard view', async () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As above:
it( 'should not dismiss the switch ga4 dashboard view notification if it is a UA dashboard view', async () => { | |
it( 'should not dismiss the switch to GA4 dashboard view notification when setting the dashboard view to UA', async () => { |
).toBe( false ); | ||
} ); | ||
|
||
it( 'should not dismiss the switch ga4 dashboard view notification if it is already dismissed', async () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As above:
it( 'should not dismiss the switch ga4 dashboard view notification if it is already dismissed', async () => { | |
it( 'should not dismiss the switch to GA4 dashboard view notification if it is already dismissed', async () => { |
); | ||
} ); | ||
|
||
it( 'should dismiss the switch ga4 dashboard view notification if it has not been dismissed yet', async () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As above:
it( 'should dismiss the switch ga4 dashboard view notification if it has not been dismissed yet', async () => { | |
it( 'should dismiss the switch to GA4 dashboard view notification if it has not been dismissed yet when setting the dashboard view to GA4', async () => { |
await registry | ||
.dispatch( MODULES_ANALYTICS ) | ||
.submitChanges(); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seeing as we have to wait for resolvers to run in the successful test case below, we should probably add it here too, to ensure this test isn't giving us a false positive.
// Wait for resolvers to run. | |
await waitForDefaultTimeouts(); | |
await registry | ||
.dispatch( MODULES_ANALYTICS ) | ||
.submitChanges(); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As above:
// Wait for resolvers to run. | |
await waitForDefaultTimeouts(); | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, nice one @hussain-t & @kuasha420!
Although the E2E test suite is failing, this isn't due to this PR and will be addressed via #7050, so this is good to go.
Summary
Addresses issue:
Relevant technical choices
submitChanges
action to ensure the correct functionality of the changes made.PR Author Checklist
Do not alter or remove anything below. The following sections will be managed by moderators only.
Code Reviewer Checklist
Merge Reviewer Checklist