Skip to content

Commit ef79c0a

Browse files
feat: add Skip button in chart creation
Add Skip button for second step of Chart Creation (#1135)
1 parent e04706a commit ef79c0a

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

classes/Visualizer/Module/Chart.php

+2
Original file line numberDiff line numberDiff line change
@@ -925,6 +925,8 @@ private function _handleDataAndSettingsPage() {
925925
: esc_html__( 'Create Chart', 'visualizer' );
926926
if ( filter_input( INPUT_GET, 'action' ) === Visualizer_Plugin::ACTION_EDIT_CHART ) {
927927
$render->cancel_button = esc_html__( 'Cancel', 'visualizer' );
928+
} else {
929+
$render->cancel_button = esc_html__( 'Skip', 'visualizer' );
928930
}
929931
} else {
930932
$render->button = esc_attr__( 'Insert Chart', 'visualizer' );

tests/e2e/specs/admin.spec.js

+15-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ const { test, expect } = require( '@wordpress/e2e-test-utils-playwright' );
66
/**
77
* Internal dependencies
88
*/
9-
const { createChartWithAdmin, deleteAllCharts, waitForLibraryToLoad, createAllFreeCharts } = require('../utils/common');
9+
const { createChartWithAdmin, deleteAllCharts, waitForLibraryToLoad, createAllFreeCharts, CHART_JS_LABELS, selectChartAdmin } = require('../utils/common');
1010

1111
test.describe( 'Chart Library', () => {
1212

@@ -125,6 +125,20 @@ test.describe( 'Chart Library', () => {
125125
await expect( page.locator(`#visualizer-${chartId}`).count() ).resolves.toBeGreaterThan( 0 );
126126
}
127127
} );
128+
129+
test( 'skip second step of chart creation', async ( { admin, page } ) => {
130+
await admin.visitAdminPage( 'admin.php?page=visualizer&vaction=addnew' );
131+
await page.waitForURL( '**/admin.php?page=visualizer&vaction=addnew' );
132+
await page.waitForSelector('h1:text("Visualizer")');
133+
134+
await selectChartAdmin( page.frameLocator('iframe'), CHART_JS_LABELS.table );
135+
136+
await page.frameLocator('iframe').getByRole('button', { name: 'Skip' }).click();
137+
await waitForLibraryToLoad( page );
138+
139+
// The Create Chart button should be not exists since we skipped the second step.
140+
expect( page.frameLocator('iframe').getByRole('button', { name: 'Create Chart' }) ).toBeHidden();
141+
} );
128142
} );
129143

130144
test.describe( 'Support', () => {

0 commit comments

Comments
 (0)