diff --git a/.eslintignore b/.eslintignore index fdeda6d..8726ca5 100755 --- a/.eslintignore +++ b/.eslintignore @@ -5,3 +5,6 @@ assets/js/shared/vendor gulp-tasks/ webpack.config.babel.js gulpfile.babel.js +node_modules +tests/* +vendor/* diff --git a/.github/workflows/cypress.yml b/.github/workflows/cypress.yml index 446064f..843c0f3 100644 --- a/.github/workflows/cypress.yml +++ b/.github/workflows/cypress.yml @@ -20,7 +20,7 @@ jobs: matrix: core: - {name: 'WP latest', version: 'latest'} - - {name: 'WP minimum', version: 'WordPress/WordPress#6.4'} + - {name: 'WP minimum', version: 'WordPress/WordPress#6.5'} - {name: 'WP trunk', version: 'WordPress/WordPress#master'} steps: diff --git a/README.md b/README.md index 191148a..a7e0319 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,7 @@ Twenty Twenty One default theme | Newspack base theme ## Requirements * PHP Requires: 7.4+ -* WordPress Requires at least: 6.4+ +* WordPress Requires at least: 6.5+ ## Theme Compatibility diff --git a/package.json b/package.json index 749d6ef..5e28923 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,8 @@ "watch": "10up-toolkit watch", "build": "10up-toolkit build", "format-js": "10up-toolkit format-js", - "lint-js": "10up-toolkit lint-js", + "lint-js": "10up-toolkit lint-js ./assets ./includes", + "lint-js-fix": "10up-toolkit lint-js ./assets ./includes --fix", "lint-style": "10up-toolkit lint-style", "test": "10up-toolkit test-unit-jest", "wp-env": "wp-env", diff --git a/publisher-media-kit.php b/publisher-media-kit.php index 9a06811..c47fcb6 100755 --- a/publisher-media-kit.php +++ b/publisher-media-kit.php @@ -4,7 +4,7 @@ * Plugin URI: https://github.com/10up/publisher-media-kit * Description: Pre-configured Media Kit Page using Gutenberg Block Patterns. * Version: 1.3.5 - * Requires at least: 6.4 + * Requires at least: 6.5 * Requires PHP: 7.4 * Author: 10up * Author URI: https://10up.com diff --git a/readme.txt b/readme.txt index 2657147..ef40e8b 100644 --- a/readme.txt +++ b/readme.txt @@ -1,7 +1,7 @@ === Publisher Media Kit === Contributors: 10up, jeffpaul, faisal03 Tags: media kit, audience profiles, digital ad specs, ad rates -Tested up to: 6.6 +Tested up to: 6.7 Stable tag: 1.3.5 License: GPLv2 or later License URI: https://www.gnu.org/licenses/gpl-2.0.html diff --git a/tests/cypress/integration/pmk-block-patterns.test.js b/tests/cypress/integration/pmk-block-patterns.test.js index fcd6d64..28d1fea 100644 --- a/tests/cypress/integration/pmk-block-patterns.test.js +++ b/tests/cypress/integration/pmk-block-patterns.test.js @@ -1,23 +1,31 @@ describe('Check if Media Kit Block Pattern is available for use', () => { - it('Can insert the block pattern', () => { - cy.visitAdminPage('post-new.php'); - cy.closeWelcomeGuide(); - cy.get('#post-title-0, h1.editor-post-title__input').click( { force: true } ).type('Test Block Pattern'); - cy.get('.edit-post-header-toolbar__inserter-toggle, .editor-document-tools__inserter-toggle').click(); - cy.get('.components-tab-panel__tabs button, .block-editor-inserter__tabs button').contains( 'Patterns' ).click(); + it('Can insert the block pattern', () => { + cy.visitAdminPage('post-new.php'); + cy.closeWelcomeGuide(); + cy.get('#post-title-0, h1.editor-post-title__input') + .click({ force: true }) + .type('Test Block Pattern'); + cy.get( + '.edit-post-header-toolbar__inserter-toggle, .editor-document-tools__inserter-toggle', + ).click(); + cy.get( + '.components-tab-panel__tabs button, .block-editor-inserter__tabs button, .block-editor-tabbed-sidebar__tablist button', + ) + .contains('Patterns') + .click(); - // (add version) If dropdown is available. (After WP 5.?) - cy.get('body').then(($body) => { - if ($body.find('.components-select-control__input').length > 0) { - cy.get('.components-select-control__input').select('publisher-media-kit', { - force: true, - }); - } else if ($body.find( '[aria-label="Publisher Media Kit"]' ).length > 0) { - cy.get('[aria-label="Publisher Media Kit"]').click(); - } + // (add version) If dropdown is available. (After WP 5.?) + cy.get('body').then(($body) => { + if ($body.find('.components-select-control__input').length > 0) { + cy.get('.components-select-control__input').select('publisher-media-kit', { + force: true, + }); + } else if ($body.find('[aria-label="Publisher Media Kit"]').length > 0) { + cy.get('[aria-label="Publisher Media Kit"]').click(); + } - // Check if cover patter exist in the list - cy.get('[aria-label="Publisher Media Kit - Cover"]').should('exist'); - }); - }); + // Check if cover patter exist in the list + cy.get('[aria-label="Publisher Media Kit - Cover"]').should('exist'); + }); + }); }); diff --git a/tests/cypress/integration/pmk-media-kit-page-creation.test.js b/tests/cypress/integration/pmk-media-kit-page-creation.test.js index 02fa466..e8ce856 100644 --- a/tests/cypress/integration/pmk-media-kit-page-creation.test.js +++ b/tests/cypress/integration/pmk-media-kit-page-creation.test.js @@ -1,45 +1,44 @@ -describe( 'Check if Media Kit page is created on plugin activation', () => { - before( () => { - cy - .visitAdminPage( 'edit.php?post_type=page' ) - .get( '#post-search-input' ) - .clear() - .type( 'Media Kit' ) - .get( '#search-submit' ).click(); - } ); +describe('Check if Media Kit page is created on plugin activation', () => { + before(() => { + cy.visitAdminPage('edit.php?post_type=page') + .get('#post-search-input') + .clear() + .type('Media Kit') + .get('#search-submit') + .click(); + }); - it( 'Activate Media Kit Plugin', () => { - cy.get( 'body' ).then( ( $body ) => { - if ( $body.find('[aria-label="Move “Media Kit” to the Trash"]' ).length > 0 ) { - cy.get( '[aria-label="Move “Media Kit” to the Trash"]' ).click({ force: true }); - } - }); + it('Activate Media Kit Plugin', () => { + cy.get('body').then(($body) => { + if ($body.find('[aria-label="Move “Media Kit” to the Trash"]').length > 0) { + cy.get('[aria-label="Move “Media Kit” to the Trash"]').click({ force: true }); + } + }); - cy. - visitAdminPage( 'plugins.php' ) - .get( '#deactivate-publisher-media-kit' ).click() - .get( '#activate-publisher-media-kit' ).click() - .get( '#deactivate-publisher-media-kit' ).should( 'be.visible' ); + cy.visitAdminPage('plugins.php') + .get('#deactivate-publisher-media-kit') + .click() + .get('#activate-publisher-media-kit') + .click() + .get('#deactivate-publisher-media-kit') + .should('be.visible'); - cy - .get( '.updated.notice a' ) - .invoke('attr', 'href') - .then(href => { - cy - .request( href ) - .its('status') - .should('eq', 200); + cy.get('.updated.notice a') + .invoke('attr', 'href') + .then((href) => { + cy.request(href).its('status').should('eq', 200); + }); + }); - }); - } ); + it('Ensure image URLs display correctly', () => { + cy.visitAdminPage('edit.php?post_type=page'); - it( 'Ensure image URLs display correctly', () => { - cy.visitAdminPage( 'edit.php?post_type=page' ); - - cy.get( '#post-search-input' ).clear().type( 'Media Kit{Enter}' ); - cy.get( 'a.row-title' ).first().click(); - cy.get( '.wp-block img[src^="' + Cypress.config( 'baseUrl' ) + '"]' ).first().each( ( $img ) => { - cy.request( $img.attr( 'src' ) ).its( 'status' ).should( 'eq', 200 ); - } ); - } ); -} ); + cy.get('#post-search-input').clear().type('Media Kit{Enter}'); + cy.get('a.row-title').first().click(); + cy.get(`.wp-block img[src^="${Cypress.config('baseUrl')}"]`) + .first() + .each(($img) => { + cy.request($img.attr('src')).its('status').should('eq', 200); + }); + }); +}); diff --git a/tests/cypress/integration/pmk-plugin-activation.test.js b/tests/cypress/integration/pmk-plugin-activation.test.js index 93c9a98..0e2c832 100644 --- a/tests/cypress/integration/pmk-plugin-activation.test.js +++ b/tests/cypress/integration/pmk-plugin-activation.test.js @@ -1,9 +1,11 @@ -describe( 'Admin can login and make sure plugin is activated', () => { - it( 'Can activate plugin if it is deactivated', () => { - cy. - visitAdminPage( 'plugins.php' ) - .get( '#deactivate-publisher-media-kit' ).click() - .get( '#activate-publisher-media-kit' ).click() - .get( '#deactivate-publisher-media-kit' ).should( 'be.visible' ); - } ); -} ); \ No newline at end of file +describe('Admin can login and make sure plugin is activated', () => { + it('Can activate plugin if it is deactivated', () => { + cy.visitAdminPage('plugins.php') + .get('#deactivate-publisher-media-kit') + .click() + .get('#activate-publisher-media-kit') + .click() + .get('#deactivate-publisher-media-kit') + .should('be.visible'); + }); +});