Skip to content
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
12 changes: 11 additions & 1 deletion includes/blocks/class-convertkit-block-form-builder.php
Original file line number Diff line number Diff line change
Expand Up @@ -401,8 +401,18 @@ public function get_overview() {
),
),

// Help descriptions, displayed when no Access Token / resources exist and this block/shortcode is added.
'no_access_token' => array(
'notice' => __( 'Not connected to Kit.', 'convertkit' ),
'link' => convertkit_get_setup_wizard_plugin_link(),
'link_text' => __( 'Click here to connect your Kit account.', 'convertkit' ),
'instruction_text' => __( 'Connect your Kit account at Settings > Kit, and then refresh this page to configure this block.', 'convertkit' ),
),

'has_access_token' => $settings->has_access_and_refresh_token(),
'has_resources' => $convertkit_forms->exist(),

// This block works without resources, so we don't need to check if resources exist.
'has_resources' => true,
);

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,40 @@ public function _before(EndToEndTester $I)
$I->activateKitPlugin($I);
}

/**
* Test the Form Builder block displays a message with a link that opens
* a popup window with the Plugin's Setup Wizard, when the Plugin has
* Not connected to Kit.
*
* @since 3.4.0
*
* @param EndToEndTester $I Tester.
*/
public function testFormBuilderBlockWhenNoCredentials(EndToEndTester $I)
{
// Add a Page using the Gutenberg editor.
$I->addGutenbergPage(
$I,
title: 'Kit: Page: Form Builder: Block: No Credentials'
);

// Add block to Page.
$I->addGutenbergBlock(
$I,
blockName: 'Kit Form Builder',
blockProgrammaticName: 'convertkit-form-builder'
);

// Test that the popup window works.
$I->testBlockNoCredentialsPopupWindow(
$I,
blockName: 'convertkit-form-builder'
);

// Save page to avoid a browser alert when _passed() runs to deactivate the Plugin.
$I->publishGutenbergPage($I);
}

/**
* Test the Form Builder block's conditional fields work.
*
Expand Down