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

Fix incorrect usage of publicize config in subscribe block #40355

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: bugfix

Fixed block error when editing Subscribe block
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { numberFormat } from '@automattic/jetpack-components';
import { usePublicizeConfig } from '@automattic/jetpack-publicize-components';
import { isSimpleSite } from '@automattic/jetpack-shared-extension-utils';
import { isSimpleSite, useModuleStatus } from '@automattic/jetpack-shared-extension-utils';
import {
ContrastChecker,
PanelColorSettings,
Expand Down Expand Up @@ -56,7 +55,7 @@ export default function SubscriptionControls( {
subscribePlaceholder = DEFAULT_SUBSCRIBE_PLACEHOLDER,
successMessage = DEFAULT_SUCCESS_MESSAGE,
} ) {
const { isPublicizeEnabled } = usePublicizeConfig();
const { isModuleActive: isPublicizeEnabled } = useModuleStatus( 'publicize' );

return (
<>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,17 @@ afterAll( () => {

jest.mock( '@wordpress/notices', () => {}, { virtual: true } );

jest.mock( '@automattic/jetpack-shared-extension-utils', () => ( {
__esModule: true,
...jest.requireActual( '@automattic/jetpack-shared-extension-utils' ),
useModuleStatus: jest.fn().mockReturnValue( {
isModuleActive: true,
isLoadingModules: false,
isChangingStatus: false,
changeStatus: jest.fn(),
} ),
} ) );

const setButtonBackgroundColor = jest.fn();
const setGradient = jest.fn();
const setTextColor = jest.fn();
Expand Down Expand Up @@ -74,13 +85,6 @@ beforeEach( () => {
} );

describe( 'Inspector controls', () => {
beforeEach( () => {
window.JetpackScriptData = {
social: {
urls: {},
},
};
} );
describe( 'Gradient settings panel', () => {
test( 'displays gradient settings control panel', () => {
render( <SubscriptionsInspectorControls { ...defaultProps } /> );
Expand Down
Loading