Skip to content
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

402 implement site kit setup flow #21978

Open
wants to merge 76 commits into
base: trunk
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 48 commits
Commits
Show all changes
76 commits
Select commit Hold shift + click to select a range
35e9827
stepper for ui-library
vraja-pro Jan 17, 2025
32e9938
implement the stepper and design
vraja-pro Jan 17, 2025
c8daeaa
implement stepper and gsk status
vraja-pro Jan 20, 2025
bce65d9
reduce complexity and add link params
vraja-pro Jan 20, 2025
0af104a
fix php cs
vraja-pro Jan 20, 2025
7e9e035
add the remove widget ui
vraja-pro Jan 20, 2025
442008b
fix stepper labels colors
vraja-pro Jan 20, 2025
e9150b2
fix link and current step
vraja-pro Jan 20, 2025
ace9438
fix padding in gsk widget
vraja-pro Jan 20, 2025
8a0c64e
dd todo comments for permanently dismissing the widget
vraja-pro Jan 20, 2025
2f3bf02
reduce eslint threshold and fix js lint
vraja-pro Jan 21, 2025
a952648
add tests and fix accessibility
vraja-pro Jan 21, 2025
d29b748
update svg
vraja-pro Jan 21, 2025
aacdf7e
fixed the links, buttons and isComplete
vraja-pro Jan 24, 2025
f82bd8c
rename props and fix isComplete variable
vraja-pro Jan 24, 2025
cc9cfa8
fix is complete
vraja-pro Jan 24, 2025
37e38ae
simplify step and add animation to progress bar
vraja-pro Jan 24, 2025
42ddef4
fix check icon size and animation
vraja-pro Jan 24, 2025
7bb273d
fix stepper animation
vraja-pro Jan 24, 2025
937da2c
fix stepper order of animation
vraja-pro Jan 27, 2025
ec0318b
fix stepper
vraja-pro Jan 27, 2025
412899c
added the dropdown menu
vraja-pro Jan 27, 2025
719f0c9
fix dropdown menu
vraja-pro Jan 28, 2025
1600141
implement dropdown menu
vraja-pro Jan 28, 2025
5dda8d5
Switch to camel case
vraja-pro Jan 28, 2025
45f936c
fix php cs
vraja-pro Jan 28, 2025
423398c
refactor step
vraja-pro Jan 28, 2025
53aaa0b
use ui library progress bar in stepper
vraja-pro Jan 28, 2025
7173c0c
fix js docs for stepper
vraja-pro Jan 28, 2025
8820a9c
Fix js doc comments
vraja-pro Jan 28, 2025
4eaa7de
renaming variables and cleaning Stepper
vraja-pro Jan 28, 2025
9116a18
Add comment about the positioning f the progress bar
vraja-pro Jan 28, 2025
1bd29d0
remove unused prop
vraja-pro Jan 28, 2025
ce56c25
implement component Stepper
vraja-pro Jan 28, 2025
4f201d3
fixing dropdown menu docs.
vraja-pro Jan 28, 2025
ebba34f
fix stepper story
vraja-pro Jan 28, 2025
cf63008
darken the icon when menu is open
vraja-pro Jan 29, 2025
b44e945
fix documentation for Dropdown Menu
vraja-pro Jan 29, 2025
1e26176
update widget tests
vraja-pro Jan 29, 2025
1fae71a
abstract the learn more link
vraja-pro Jan 29, 2025
372448a
renamed to google site kit set up widget
vraja-pro Jan 29, 2025
608e131
rename to site kit setup widget
vraja-pro Jan 30, 2025
1f5e8d3
Merge remote-tracking branch 'origin/trunk' into 402-implement-site-k…
vraja-pro Jan 31, 2025
ccf0c7f
fix renaming and implement site kit configuration data
vraja-pro Jan 31, 2025
6bffd65
fix renaming setup completed variable
vraja-pro Jan 31, 2025
fd3b96f
php fixed cs
vraja-pro Jan 31, 2025
9bb0d69
rename site kit integration
vraja-pro Feb 3, 2025
d7065dd
fix site kit configuration
vraja-pro Feb 3, 2025
df695a7
Update packages/ui-library/src/components/dropdown-menu/index.js
vraja-pro Feb 4, 2025
104e63b
spread props to menu
vraja-pro Feb 5, 2025
a61753f
finetune tests
vraja-pro Feb 5, 2025
303d30b
adds BEM id name
vraja-pro Feb 5, 2025
e13cb70
adds props to dropdown menu
vraja-pro Feb 5, 2025
2f95f47
fix styling and formatting
vraja-pro Feb 5, 2025
5c31075
adds missing class name docs
vraja-pro Feb 5, 2025
3d61b5a
fix tests for the menu item buttons
vraja-pro Feb 5, 2025
69a00a7
fix menu return docs
vraja-pro Feb 5, 2025
ad43745
format props for readability
vraja-pro Feb 5, 2025
5e9ead6
fix screen reader text
vraja-pro Feb 5, 2025
cca64f0
fix screen reader text and css
vraja-pro Feb 5, 2025
650c8dc
adds gap between buttons
vraja-pro Feb 5, 2025
a532bca
fix dropdown menu story docs
vraja-pro Feb 5, 2025
1a9e5ac
use gap instead of margin
vraja-pro Feb 5, 2025
1acc88b
fix docs for dropdown storybook
vraja-pro Feb 5, 2025
5368c5e
adds props spread to list
vraja-pro Feb 5, 2025
e22a6e4
Added screen reader prop as required
vraja-pro Feb 5, 2025
9d57dd2
fix doc for button item
vraja-pro Feb 5, 2025
c183c9d
moved styling outside the ui library
vraja-pro Feb 5, 2025
1cf1273
add the styling from the ui library
vraja-pro Feb 5, 2025
017ce91
move width outside ui library for flexability
vraja-pro Feb 5, 2025
83113ac
Adds default to stepper context and expose it
vraja-pro Feb 5, 2025
20e12dc
fix step props
vraja-pro Feb 5, 2025
c4abeb3
fix context
vraja-pro Feb 5, 2025
2c8ea36
remove number of steps
vraja-pro Feb 5, 2025
2332c7f
fix docs for stepper
vraja-pro Feb 5, 2025
2ab3a14
Merge remote-tracking branch 'origin/trunk' into 402-implement-site-k…
vraja-pro Feb 5, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
90 changes: 90 additions & 0 deletions packages/js/images/yoast-connect-google-site-kit.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
30 changes: 30 additions & 0 deletions packages/js/src/dashboard/components/dashboard.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
import { Scores } from "../scores/components/scores";
import { PageTitle } from "./page-title";
import { SiteKitSetupWidget } from "./site-kit-setup-widget";
import { get } from "lodash";
import { useCallback } from "@wordpress/element";
import { useToggleState } from "@yoast/ui-library";
import { useSelect } from "@wordpress/data";

/**
* @type {import("../index").ContentType} ContentType
Expand All @@ -15,13 +20,38 @@ import { PageTitle } from "./page-title";
* @param {Endpoints} endpoints The endpoints.
* @param {Object<string,string>} headers The headers for the score requests.
* @param {Links} links The links.
*
* @returns {JSX.Element} The element.
*/
// The complexity is cause by the google site kit feature flag which is temporary.
// eslint-disable-next-line complexity
export const Dashboard = ( { contentTypes, userName, features, endpoints, headers, links } ) => {
const siteKitConfiguration = get( window, "wpseoScriptData.dashboard.siteKitConfiguration", {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please answer: #21978 (comment)

isInstalled: false,
isActive: false,
isSetupCompleted: false,
isConnected: false,
installUrl: "",
activateUrl: "",
setupUrl: "",
isFeatureEnabled: false,
} );
const [ showGoogleSiteKit, , , , setRemoveGoogleSiteKit ] = useToggleState( true );
const learnMorelink = useSelect( select => select( "@yoast/general" ).selectLink( "https://yoa.st/google-site-kit-learn-more" ), [] );
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is tying the Dashboard to the @yoast/general store.

const handleRemovePermanently = useCallback( ()=>{
/* eslint-disable-next-line */
// TODO: Implement the remove permanently functionality.
setRemoveGoogleSiteKit();
}, [ setRemoveGoogleSiteKit ] );

return (
<>
<PageTitle userName={ userName } features={ features } links={ links } />
<div className="yst-flex yst-flex-col @7xl:yst-flex-row yst-gap-6 yst-my-6">
{ showGoogleSiteKit && siteKitConfiguration.isFeatureEnabled && <SiteKitSetupWidget
{ ...siteKitConfiguration } learnMoreLink={ learnMorelink }
onRemove={ setRemoveGoogleSiteKit } onRemovePermanently={ handleRemovePermanently }
/> }
vraja-pro marked this conversation as resolved.
Show resolved Hide resolved
{ features.indexables && features.seoAnalysis && (
<Scores analysisType="seo" contentTypes={ contentTypes } endpoint={ endpoints.seoScores } headers={ headers } />
) }
Expand Down
148 changes: 148 additions & 0 deletions packages/js/src/dashboard/components/site-kit-setup-widget.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@
import { Button, Paper, Stepper, Title, DropdownMenu } from "@yoast/ui-library";
import { ReactComponent as YoastConnectSiteKit } from "../../../images/yoast-connect-google-site-kit.svg";
import { __ } from "@wordpress/i18n";
import { CheckCircleIcon } from "@heroicons/react/solid";
import { ArrowRightIcon, XIcon, TrashIcon } from "@heroicons/react/outline";

/**
* Get the button and stepper props based on the current state.
*
* @param {boolean} isInstalled Whether the plugin is isInstalled.
* @param {boolean} isActive Whether the feature is active.
* @param {boolean} isSetupCompleted Whether the setup is complete.
* @param {boolean} isConnected Whether the connection is active.
* @param {string} installUrl The URL to install Site Kit.
* @param {string} activateUrl The URL to activate Site Kit.
* @param {string} setupUrl The URL to setup Site Kit.
*
* @returns {Object} The button and stepper props.
*/
const getButtonAndStepperProps = ( isInstalled, isActive, isSetupCompleted, isConnected, installUrl, activateUrl, setupUrl ) => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll point to my unanswered previous comment: #21978 (comment)

let buttonProps;
let currentStep;
let isComplete = false;

switch ( true ) {
case ( ! isInstalled ):
currentStep = 1;
buttonProps = {
children: __( "Install Site Kit by Google", "wordpress-seo" ),
as: "a",
href: installUrl,
};
break;
case ( ! isActive ):
currentStep = 2;
buttonProps = {
children: __( "Activate Site Kit by Google", "wordpress-seo" ),
as: "a",
href: activateUrl,
};
break;
case ( ! isSetupCompleted ):
currentStep = 3;
buttonProps = {
children: __( "Set up Site Kit by Google", "wordpress-seo" ),
as: "a",
href: setupUrl,
};
break;
case ( ! isConnected ):
currentStep = 4;
buttonProps = { children: __( "Connect Site Kit by Google", "wordpress-seo" ) };
break;
case isConnected:
isComplete = true;
currentStep = 4;
buttonProps = { children: "Take a quick tour" };
break;
}
return { buttonProps, currentStep, isComplete };
};

const steps = [
__( "INSTALL", "wordpress-seo" ),
__( "ACTIVATE", "wordpress-seo" ),
__( "SET UP", "wordpress-seo" ),
__( "CONNECT", "wordpress-seo" ),
];

/**
* The google site kit connection guide widget.
*
* @param {boolean} isInstalled Whether the plugin is installed.
* @param {boolean} isActive Whether the feature is active.
* @param {boolean} isSetupCompleted Whether the setup is complete.
* @param {boolean} isConnected Whether the connection is active.
* @param {string} installUrl The URL to install Site Kit.
* @param {string} activateUrl The URL to activate Site Kit.
* @param {string} setupUrl The URL to setup Site Kit.
* @param {function} onRemove The function to call when the widget is removed.
* @param {function} onRemovePermanently The function to call when the widget is removed permanently.
* @param {string} learnMorelink The URL to learn more about the feature.
*
* @returns {JSX.Element} The widget.
*/
export const SiteKitSetupWidget = ( {
installUrl,
activateUrl,
setupUrl,
isConnected,
isActive,
isSetupCompleted,
isInstalled,
onRemove,
onRemovePermanently,
learnMorelink,
} ) => {
const { buttonProps, currentStep, isComplete } = getButtonAndStepperProps(
isInstalled, isActive, isSetupCompleted, isConnected, installUrl, activateUrl, setupUrl );
return <Paper className="yst-@container yst-grow yst-max-w-screen-sm yst-p-8 yst-shadow-md yst-relative">
<DropdownMenu className="yst-absolute yst-top-4 yst-end-4">
vraja-pro marked this conversation as resolved.
Show resolved Hide resolved
<DropdownMenu.IconTrigger screenReaderTriggerLabel={ __( "Open menu", "wordpress-seo" ) } className="yst-absolute yst-top-0 yst-end-0" />
vraja-pro marked this conversation as resolved.
Show resolved Hide resolved
<DropdownMenu.List className="yst-absolute yst-top-5 yst-end-0">
vraja-pro marked this conversation as resolved.
Show resolved Hide resolved
<DropdownMenu.ButtonItem className="yst-text-slate-600" onClick={ onRemove }>
<XIcon className="yst-w-4 yst-text-slate-400" />
{ __( "Remove until next visit", "wordpress-seo" ) }
</DropdownMenu.ButtonItem>
<DropdownMenu.ButtonItem className="yst-text-red-500" onClick={ onRemovePermanently }>
<TrashIcon className="yst-w-4" />
{ __( "Remove permanently", "wordpress-seo" ) }
</DropdownMenu.ButtonItem>
</DropdownMenu.List>
</DropdownMenu>

<div className="yst-flex yst-justify-center yst-mb-6 yst-mt-4"><YoastConnectSiteKit /></div>
<Stepper steps={ steps } currentStep={ currentStep } numberOfSteps={ steps.length }>
{ steps.map( ( label, index ) => ( <Stepper.Step
key={ label }
label={ label }
isActive={ currentStep === index + 1 }
isComplete={ isComplete }
isStepComplete={ currentStep > index + 1 || isComplete }
/> ) ) }
</Stepper>
<hr className="yst-bg-slate-200 yst-my-6" />
<Title size="2">{ __( "Expand your dashboard with insights from Google!", "wordpress-seo" ) }</Title>
<p className="yst-my-4">{ __( "Bring together powerful tools like Google Analytics and Search Console for a complete overview of your website's performance, all in one seamless dashboard.", "wordpress-seo" ) }</p>

<span className="yst-text-slate-800 yst-font-medium">{ __( "What you'll get:", "wordpress-seo" ) }</span>
<ul>
<li className="yst-gap-2 yst-flex yst-mt-2"><CheckCircleIcon className="yst-w-5 yst-text-green-400" />
{ __( "Actionable insights into traffic, SEO, and user behavior to grow your audience.", "wordpress-seo" ) }</li>
<li className="yst-gap-2 yst-flex yst-mt-2"><CheckCircleIcon className="yst-w-5 yst-text-green-400" />
{ __( "Key performance metrics to fine-tune your website and optimize like a pro.", "wordpress-seo" ) }</li>
vraja-pro marked this conversation as resolved.
Show resolved Hide resolved
</ul>
<div className="yst-flex yst-gap-0.5 yst-mt-6 yst-items-center">
vraja-pro marked this conversation as resolved.
Show resolved Hide resolved
<Button { ...buttonProps } />

{ isConnected ? <Button>{ __( "Dismiss", "wordpress-seo" ) }</Button>
: <Button as="a" variant="tertiary" href={ learnMorelink }>{ __( "Learn more", "wordpress-seo" ) }
<ArrowRightIcon className="yst-w-3 yst-ml-2 yst-text-primary-500" />
vraja-pro marked this conversation as resolved.
Show resolved Hide resolved
vraja-pro marked this conversation as resolved.
Show resolved Hide resolved
vraja-pro marked this conversation as resolved.
Show resolved Hide resolved
</Button>
}
</div>
</Paper>;
};


14 changes: 7 additions & 7 deletions packages/js/src/integrations-page/recommended-integrations.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { __, sprintf } from "@wordpress/i18n";
import { get } from "lodash";
import { ReactComponent as SemrushLogo } from "../../images/semrush-logo.svg";
import { ReactComponent as WincherLogo } from "../../images/wincher-logo.svg";
import { GoogleSiteKitIntegration } from "./google-site-kit-integration";
import { SiteKitIntegration } from "./site-kit-integration";
import { getInitialState, getIsMultisiteAvailable, getIsNetworkControlEnabled, updateIntegrationState } from "./helper";

import { ToggleableIntegration } from "./toggleable-integration";
Expand Down Expand Up @@ -82,16 +82,16 @@ const RecommendedIntegrations = [
const siteKitProps = {
isInstalled: get( window, "wpseoIntegrationsData.site_kit_configuration.isInstalled", false ),
isActive: get( window, "wpseoIntegrationsData.site_kit_configuration.isActive", false ),
afterSetup: get( window, "wpseoIntegrationsData.site_kit_configuration.setup_completed", false ),
afterSetup: get( window, "wpseoIntegrationsData.site_kit_configuration.isSetupCompleted", false ),
isConnected: get( window, "wpseoIntegrationsData.site_kit_configuration.isConnected", false ),
installUrl: get( window, "wpseoIntegrationsData.site_kit_configuration.install_url", "" ),
activateUrl: get( window, "wpseoIntegrationsData.site_kit_configuration.activate_url", "" ),
setupUrl: get( window, "wpseoIntegrationsData.site_kit_configuration.setup_url", "" ),
installUrl: get( window, "wpseoIntegrationsData.site_kit_configuration.installUrl", "" ),
activateUrl: get( window, "wpseoIntegrationsData.site_kit_configuration.activateUrl", "" ),
setupUrl: get( window, "wpseoIntegrationsData.site_kit_configuration.setupUrl", "" ),
};

const isSiteKitFeatureEnabled = get( window, "wpseoIntegrationsData.site_kit_configuration.feature_enabled", false );
const isSiteKitFeatureEnabled = get( window, "wpseoIntegrationsData.site_kit_configuration.isFeatureEnabled", false );
if ( isSiteKitFeatureEnabled ) {
RecommendedIntegrations.push( <GoogleSiteKitIntegration key={ integrations.length } { ...siteKitProps } /> );
RecommendedIntegrations.push( <SiteKitIntegration key={ integrations.length } { ...siteKitProps } /> );
}

export { RecommendedIntegrations };
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ const SuccessfullyConnected = () => {
* The Site Kit integration component.
*
* @param {boolean} isActive Whether the integration is active.
* @param {boolean} afterSetup Whether the integration has been set up.
* @param {boolean} isSetupCompleted Whether the integration has been set up.
* @param {boolean} isInstalled Whether the integration is installed.
* @param {boolean} isConnected Whether the integration is connected.
* @param {string} installUrl The installation url.
Expand All @@ -58,7 +58,7 @@ const SuccessfullyConnected = () => {
*
* @returns {WPElement} The Site Kit integration component.
*/
export const GoogleSiteKitIntegration = ( { isActive, afterSetup, isInstalled, isConnected, installUrl, activateUrl, setupUrl } ) => {
export const SiteKitIntegration = ( { isActive, isSetupCompleted, isInstalled, isConnected, installUrl, activateUrl, setupUrl } ) => {
const [ isModalOpen, toggleModal ] = useToggleState( false );

const getButtonProps = useCallback( () => {
Expand All @@ -76,7 +76,7 @@ export const GoogleSiteKitIntegration = ( { isActive, afterSetup, isInstalled, i
href: activateUrl,
};
}
if ( ! afterSetup ) {
if ( ! isSetupCompleted ) {
return {
children: __( "Set up Site Kit by Google", "wordpress-seo" ),
as: "a",
Expand All @@ -96,10 +96,10 @@ export const GoogleSiteKitIntegration = ( { isActive, afterSetup, isInstalled, i
as: "button",
variant: "secondary",
};
}, [ isInstalled, isActive, afterSetup, isConnected, installUrl, activateUrl, toggleModal ] );
}, [ isInstalled, isActive, isSetupCompleted, isConnected, installUrl, activateUrl, toggleModal ] );


const successfullyConnected = isInstalled && isActive && afterSetup && isConnected;
const successfullyConnected = isInstalled && isActive && isSetupCompleted && isConnected;
return (
<>
<SimpleIntegration
Expand All @@ -108,17 +108,17 @@ export const GoogleSiteKitIntegration = ( { isActive, afterSetup, isInstalled, i
>
<span className="yst-flex yst-flex-col yst-flex-1">
{ successfullyConnected && <SuccessfullyConnected /> }
<Button className="yst-w-full" id="google-site-kit-button" { ...getButtonProps( isInstalled, isActive, afterSetup, isConnected ) } />
<Button className="yst-w-full" id="google-site-kit-button" { ...getButtonProps( isInstalled, isActive, isSetupCompleted, isConnected ) } />
vraja-pro marked this conversation as resolved.
Show resolved Hide resolved
</span>
</SimpleIntegration>
<SiteKitConsentModal isOpen={ isModalOpen } onClose={ toggleModal } />
</>
);
};

GoogleSiteKitIntegration.propTypes = {
SiteKitIntegration.propTypes = {
isActive: PropTypes.bool.isRequired,
afterSetup: PropTypes.bool.isRequired,
isSetupCompleted: PropTypes.bool.isRequired,
isInstalled: PropTypes.bool.isRequired,
isConnected: PropTypes.bool.isRequired,
installUrl: PropTypes.string.isRequired,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
import { render, screen, fireEvent } from "@testing-library/react";
import { SiteKitSetupWidget } from "../../../src/dashboard/components/site-kit-setup-widget";

describe( "SiteKitSetupWidget", () => {
const defaultProps = {
installUrl: "https://example.com/install",
activateUrl: "https://example.com/activate",
setupUrl: "https://example.com/isSetup",
isConnected: false,
isActive: false,
isSetupCompleted: false,
isInstalled: false,
onRemove: jest.fn(),
onRemovePermanently: jest.fn(),
learnMoreLink: "https://example.com/learn-more",
};

it( "renders the widget with install button", () => {
render( <SiteKitSetupWidget { ...defaultProps } /> );
expect( screen.getByText( "Install Site Kit by Google" ) ).toBeInTheDocument();
vraja-pro marked this conversation as resolved.
Show resolved Hide resolved
} );

it( "renders the widget with activate button", () => {
render( <SiteKitSetupWidget { ...defaultProps } isInstalled={ true } /> );
expect( screen.getByText( "Activate Site Kit by Google" ) ).toBeInTheDocument();
} );

it( "renders the widget with setup button", () => {
render( <SiteKitSetupWidget { ...defaultProps } isInstalled={ true } isActive={ true } /> );
expect( screen.getByText( "Set up Site Kit by Google" ) ).toBeInTheDocument();
} );

it( "renders the widget with connect button", () => {
render( <SiteKitSetupWidget { ...defaultProps } isInstalled={ true } isActive={ true } isSetupCompleted={ true } /> );
expect( screen.getByText( "Connect Site Kit by Google" ) ).toBeInTheDocument();
} );

it( "renders the widget with dismiss button when connected", () => {
render( <SiteKitSetupWidget { ...defaultProps } isInstalled={ true } isActive={ true } isSetupCompleted={ true } isConnected={ true } /> );
expect( screen.getByText( "Dismiss" ) ).toBeInTheDocument();
} );

it( "opens the menu and calls onRemove when 'Remove until next visit' is clicked", () => {
render( <SiteKitSetupWidget { ...defaultProps } /> );
fireEvent.click( screen.getByRole( "button", { name: /open menu/i } ) );
fireEvent.click( screen.getByText( "Remove until next visit" ) );
expect( defaultProps.onRemove ).toHaveBeenCalled();
} );

it( "opens the menu and calls onRemovePermanently when 'Remove permanently' is clicked", () => {
render( <SiteKitSetupWidget { ...defaultProps } /> );
fireEvent.click( screen.getByRole( "button", { name: /open menu/i } ) );
fireEvent.click( screen.getByText( "Remove permanently" ) );
vraja-pro marked this conversation as resolved.
Show resolved Hide resolved
expect( defaultProps.onRemovePermanently ).toHaveBeenCalled();
} );
} );
Loading