diff --git a/.dev/config/webpack.config.js b/.dev/config/webpack.config.js index 4a77e58e9c1..512e495420d 100644 --- a/.dev/config/webpack.config.js +++ b/.dev/config/webpack.config.js @@ -14,7 +14,6 @@ const scripts = [ 'coblocks-accordion-polyfill', 'coblocks-animation', 'coblocks-checkbox-required', - 'coblocks-datepicker', 'coblocks-events', 'coblocks-fromEntries', 'coblocks-google-maps', diff --git a/.dev/performance/tests/config/setup-performance-test.js b/.dev/performance/tests/config/setup-performance-test.js index eee3e81083f..97da132f250 100644 --- a/.dev/performance/tests/config/setup-performance-test.js +++ b/.dev/performance/tests/config/setup-performance-test.js @@ -13,10 +13,9 @@ import { * * @type {string|undefined} */ -const PUPPETEER_TIMEOUT = process.env.PUPPETEER_TIMEOUT; // The Jest timeout is increased because these tests are a bit slow -jest.setTimeout( PUPPETEER_TIMEOUT || 100000 ); +jest.setTimeout( 1000000 ); async function setupBrowser() { await clearLocalStorage(); diff --git a/.dev/performance/tests/config/setup-test-framework.js b/.dev/performance/tests/config/setup-test-framework.js index ee38e2ff226..96cc39a29d3 100644 --- a/.dev/performance/tests/config/setup-test-framework.js +++ b/.dev/performance/tests/config/setup-test-framework.js @@ -16,13 +16,6 @@ import { trashAllPosts, } from '@wordpress/e2e-test-utils'; -/** - * Timeout, in seconds, that the test should be allowed to run. - * - * @type {string|undefined} - */ -const PUPPETEER_TIMEOUT = process.env.PUPPETEER_TIMEOUT; - /** * CPU slowdown factor, as a numeric multiplier. * @@ -65,7 +58,7 @@ const OBSERVED_CONSOLE_MESSAGE_TYPES = { const pageEvents = []; // The Jest timeout is increased because these tests are a bit slow -jest.setTimeout( PUPPETEER_TIMEOUT || 100000 ); +jest.setTimeout( 1000000 ); async function setupBrowser() { await clearLocalStorage(); diff --git a/.dev/tests/phpunit/includes/test-coblocks-form.php b/.dev/tests/phpunit/includes/test-coblocks-form.php index 237fd43a16d..7cc16dd8fa2 100644 --- a/.dev/tests/phpunit/includes/test-coblocks-form.php +++ b/.dev/tests/phpunit/includes/test-coblocks-form.php @@ -325,25 +325,12 @@ public function test_render_field_textarea() { } - /** - * Test the datepicker script is enqueued - */ - public function test_field_date_scripts() { - - $this->coblocks_form->render_field_date( [], '' ); - - global $wp_scripts; - - $this->assertArrayHasKey( 'coblocks-datepicker', $wp_scripts->registered ); - - } - /** * Test the date field markup is as expected */ public function test_render_field_date() { - $this->expectOutputRegex( '//' ); + $this->expectOutputRegex( '//' ); echo $this->coblocks_form->render_field_date( [], '' ); diff --git a/.dev/tests/phpunit/test-class-coblocks.php b/.dev/tests/phpunit/test-class-coblocks.php index 4228a53d75c..d5dbb5d0fb5 100644 --- a/.dev/tests/phpunit/test-class-coblocks.php +++ b/.dev/tests/phpunit/test-class-coblocks.php @@ -185,7 +185,6 @@ public function test_final_build_assets_exist() { 'dist/coblocks-1.js', 'dist/js/coblocks-accordion-polyfill.js', 'dist/js/coblocks-checkbox-required.js', - 'dist/js/coblocks-datepicker.js', 'dist/js/coblocks-fromEntries.js', 'dist/js/coblocks-google-maps.js', 'dist/js/coblocks-google-recaptcha.js', @@ -197,7 +196,6 @@ public function test_final_build_assets_exist() { 'dist/js/vendors/slick.js', 'src/js/coblocks-accordion-polyfill.js', 'src/js/coblocks-checkbox-required.js', - 'src/js/coblocks-datepicker.js', 'src/js/coblocks-fromEntries.js', 'src/js/coblocks-google-maps.js', 'src/js/coblocks-google-recaptcha.js', diff --git a/includes/class-coblocks-form.php b/includes/class-coblocks-form.php index 5cf73144a1b..4e6c7d000ce 100644 --- a/includes/class-coblocks-form.php +++ b/includes/class-coblocks-form.php @@ -410,16 +410,6 @@ public function render_field_date( $atts ) { static $date_count = 1; - wp_enqueue_script( - 'coblocks-datepicker', - CoBlocks()->asset_source( 'js' ) . 'coblocks-datepicker.js', - array( 'jquery', 'jquery-ui-datepicker' ), - COBLOCKS_VERSION, - true - ); - - wp_localize_jquery_ui_datepicker(); - $label = isset( $atts['label'] ) ? $atts['label'] : __( 'Date', 'coblocks' ); $label_slug = $date_count > 1 ? sanitize_title( $label . '-' . $date_count ) : sanitize_title( $label ); $required_attr = ( isset( $atts['required'] ) && $atts['required'] ) ? 'required' : ''; @@ -430,7 +420,7 @@ public function render_field_date( $atts ) { ?> - /> + /> ); diff --git a/src/js/coblocks-datepicker.js b/src/js/coblocks-datepicker.js deleted file mode 100644 index bab329333ba..00000000000 --- a/src/js/coblocks-datepicker.js +++ /dev/null @@ -1,9 +0,0 @@ -import jQuery from 'jquery'; - -jQuery( function( $ ) { - $( '.coblocks-form input.coblocks-field--date' ).datepicker( { - beforeShow() { - $( '#ui-datepicker-div' ).addClass( 'coblocks' ); - }, - } ); -} ); diff --git a/src/styles/style.scss b/src/styles/style.scss index 2be90085c72..e690c8f43f0 100644 --- a/src/styles/style.scss +++ b/src/styles/style.scss @@ -9,7 +9,6 @@ @import "style/has-margin"; @import "style/shadow"; @import "style/tooltips"; -@import "style/datepicker"; // @import "../components/**/style.scss"; @import "../components/background/styles/style.scss"; diff --git a/src/styles/style/datepicker.scss b/src/styles/style/datepicker.scss deleted file mode 100644 index c117243e4eb..00000000000 --- a/src/styles/style/datepicker.scss +++ /dev/null @@ -1,156 +0,0 @@ -.ui-datepicker.coblocks { - background-color: $white; - border: 1px solid #dfdfdf; - border-radius: 0; - border-top: none; - box-shadow: 0 3px 6px rgba(0, 0, 0, 0.075); - margin: 0; - padding: 0; - width: auto; - - * { - border-radius: 0; - padding: 0; - } - - table { - border: none; - border-collapse: collapse; - margin: 0; - width: auto; - } - - .ui-widget-header, - .ui-datepicker-header { - background-image: none; - border: none; - font-weight: 400; - } - - .ui-datepicker-header .ui-state-hover { - background: transparent; - border-color: transparent; - cursor: pointer; - } - - .ui-datepicker-title { - font-size: 14px; - line-height: 14px; - margin: 0; - padding: 10px 0; - text-align: center; - } - - .ui-datepicker-prev, - .ui-datepicker-next { - height: 34px; - position: relative; - top: 0; - width: 34px; - } - - .ui-datepicker-prev, - .ui-datepicker-prev-hover { - left: 0; - } - - .ui-datepicker-next, - .ui-datepicker-next-hover { - right: 0; - } - - .ui-datepicker-next span, - .ui-datepicker-prev span { - display: none; - } - - .ui-state-hover { - - .ui-datepicker-prev, - .ui-datepicker-next { - border: none; - } - } - - .ui-datepicker-prev { - float: left; - } - - .ui-datepicker-next { - float: right; - } - - .ui-datepicker-prev::before, - .ui-datepicker-next::before { - font: 400 20px/34px "dashicons"; // stylelint-disable-line font-family-no-missing-generic-family-keyword, font-family-name-quotes - height: 34px; - padding-left: 7px; - speak: none; - width: 34px; - } - - .ui-datepicker-prev::before { - content: "\f341"; - } - - .ui-datepicker-next::before { - content: "\f345"; - } - - .ui-datepicker-prev-hover::before, - .ui-datepicker-next-hover::before { - opacity: 0.7; - } - - select.ui-datepicker-month, - select.ui-datepicker-year { - width: 33%; - } - - thead { - font-weight: 600; - } - - th { - border-width: 1px; - padding: 10px; - } - - td { - border: 1px solid #f4f4f4; - padding: 0; - } - - td.ui-datepicker-other-month { - border: transparent; - } - - td.ui-datepicker-week-end { - background-color: #f4f4f4; - border: 1px solid #f4f4f4; - } - - td.ui-datepicker-today { - background-color: #f0f0c0; - } - - td.ui-datepicker-current-day { - background: #bd8; - } - - td .ui-state-default { - background: transparent; - border: none; - color: #444; - display: block; - font-weight: 400; - padding: 5px 10px; - text-align: center; - text-decoration: none; - width: auto; - } - - td.ui-state-disabled .ui-state-default { - opacity: 0.5; - } -}