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

Update package.json dependencies #113

Merged
merged 18 commits into from
Mar 2, 2022
Merged
Show file tree
Hide file tree
Changes from 17 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
3 changes: 0 additions & 3 deletions .babelrc

This file was deleted.

29 changes: 6 additions & 23 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
version: 2.1

orbs:
node: circleci/[email protected]
node: circleci/[email protected]
php: circleci/[email protected]

references:
PLUGIN_PATH: &PLUGIN_PATH
Expand All @@ -18,15 +19,6 @@ commands:
steps:
- run: composer remove --dev phpunit/phpunit && composer install && npm ci && npm run build

install-composer:
description: "Installing Composer"
steps:
- run:
command: |
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
EXPECTED_SIGNATURE=$(curl -s https://composer.github.io/installer.sig)
ACTUAL_SIGNATURE=$(php -r "echo hash_file('sha384', 'composer-setup.php');")
[[ "$EXPECTED_SIGNATURE" == "$ACTUAL_SIGNATURE" ]] && sudo php composer-setup.php --install-dir=/bin --filename=composer || exit 1
Copy link
Contributor Author

@kienstra kienstra Feb 22, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not related to this PR, just a simplification

nodegit-workaround:
description: "Ensure nodegit runs without error"
steps:
Expand All @@ -38,8 +30,7 @@ jobs:
name: php
steps:
- checkout
- node/install:
node-version: '14.18.1'
- node/install
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like the orb now finds the Node version from .nvmrc

- nodegit-workaround
- set-up-packages
- run: npm run lint
Expand All @@ -61,8 +52,7 @@ jobs:
MYSQL_ROOT_PASSWORD: wordpress
steps:
- checkout
- node/install:
node-version: '14.18.1'
- node/install
- nodegit-workaround
- run:
name: Installing WordPress and setting up tests
Expand All @@ -88,8 +78,7 @@ jobs:
executor: php
steps:
- checkout
- node/install:
node-version: '14.18.1'
- node/install
- nodegit-workaround
- run: HUSKY_SKIP_INSTALL=1 npm ci && npm run test:js -- --maxWorkers=2

Expand All @@ -99,16 +88,10 @@ jobs:
steps:
- checkout
- run: sudo apt-get update && sudo apt-get install php php-xml
- install-composer
- node/install:
node-version: '14.18.1'
- php/install-composer
- nodegit-workaround
- set-up-packages
- run: npm run wp-env start && npm run test:e2e
- run:
command: |
if [ -d artifacts ]; then cp -r artifacts /tmp/; fi;
when: on_fail
- store_artifacts:
path: /tmp/artifacts/

Expand Down
3 changes: 1 addition & 2 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
"plugin:import/recommended",
"plugin:eslint-comments/recommended",
"plugin:jsx-a11y/recommended",
"plugin:testing-library/recommended",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It sounds like this doesn't exist anymore

"plugin:jest-dom/recommended",
"plugin:react-hooks/recommended"
],
Expand Down Expand Up @@ -61,7 +60,7 @@
],
"rules": {
"jest/expect-expect": "off",
"jest/lowercase-name": [
"jest/prefer-lowercase-title": [
"error",
{
"ignore": [
Expand Down
1 change: 0 additions & 1 deletion .stylelintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
"at-rule-empty-line-before": null,
"at-rule-no-unknown": null,
"comment-empty-line-before": null,
"declaration-property-unit-whitelist": null,
"font-weight-notation": null,
"max-line-length": null,
"no-descending-specificity": null,
Expand Down
5 changes: 5 additions & 0 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module.exports = {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To replace .babelrc

presets: [
'@wordpress/default',
],
};
29 changes: 9 additions & 20 deletions css/src/_color.scss
Original file line number Diff line number Diff line change
@@ -1,35 +1,28 @@
/**
* Colors
*
* The variables below are taken from Gutenberg's styling in _colors.scss.
*
* @see https://github.com/WordPress/gutenberg/blob/master/assets/stylesheets/_colors.scss
*/
/* The variables below are taken from Gutenberg's styling in _colors.scss: https://github.com/WordPress/gutenberg/blob/master/assets/stylesheets/_colors.scss */

// Hugo's new WordPress shades of gray, from http://codepen.io/hugobaeta/pen/grJjVp.
/* Hugo's new WordPress shades of gray, from http://codepen.io/hugobaeta/pen/grJjVp. */
$black: #000;
$dark-gray-900: #191e23;
$dark-gray-800: #23282d;
$dark-gray-700: #32373c;
$dark-gray-600: #40464d;
$dark-gray-500: #555d66; // Use this most of the time for dark items.
$dark-gray-500: #555d66;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To address new linting rules. I'm not sure why this isn't allowed.

$dark-gray-400: #606a73;
$dark-gray-300: #6c7781; // Lightest gray that can be used for AA text contrast.
$dark-gray-300: #6c7781;
$dark-gray-200: #7e8993;
$dark-gray-150: #8d96a0; // Lightest gray that can be used for AA non-text contrast.
$dark-gray-150: #8d96a0;
$dark-gray-100: #8f98a1;
$light-gray-900: #a2aab2;
$light-gray-800: #b5bcc2;
$light-gray-700: #ccd0d4;
$light-gray-600: #d7dade;
$light-gray-500: #e2e4e7; // Good for "grayed" items and borders.
$light-gray-400: #e8eaeb; // Good for "readonly" input fields and special text selection.
$light-gray-500: #e2e4e7;
$light-gray-400: #e8eaeb;
$light-gray-300: #edeff0;
$light-gray-200: #f3f4f5;
$light-gray-100: #f8f9f9;
$white: #fff;

// Dark opacities, for use with light themes.
$dark-opacity-900: rgba(#000510, 0.9);
$dark-opacity-800: rgba(#00000a, 0.85);
$dark-opacity-700: rgba(#06060b, 0.8);
Expand All @@ -48,9 +41,8 @@ $dark-opacity-light-400: rgba(#95959c, 0.2);
$dark-opacity-light-300: rgba(#829493, 0.15);
$dark-opacity-light-200: rgba(#8b8b96, 0.1);
$dark-opacity-light-100: rgba(#747474, 0.05);
$dark-opacity-background-fill: rgba($dark-gray-700, 0.7); // Similar to $dark-opacity-light-200, but more opaque.
$dark-opacity-background-fill: rgba($dark-gray-700, 0.7);

// Light opacities, for use with dark themes.
$light-opacity-900: rgba($white, 1);
$light-opacity-800: rgba($white, 0.9);
$light-opacity-700: rgba($white, 0.85);
Expand All @@ -69,10 +61,8 @@ $light-opacity-light-400: rgba($white, 0.25);
$light-opacity-light-300: rgba($white, 0.2);
$light-opacity-light-200: rgba($white, 0.15);
$light-opacity-light-100: rgba($white, 0.1);
$light-opacity-background-fill: rgba($light-gray-300, 0.8); // Similar to $light-opacity-light-200, but more opaque.
$light-opacity-background-fill: rgba($light-gray-300, 0.8);

// Additional colors.
// Some are from https://make.wordpress.org/design/handbook/foundations/colors/.
$blue-wordpress-700: #00669b;
$blue-dark-900: #0071a1;

Expand All @@ -88,7 +78,6 @@ $blue-medium-100: #e5f5fa;
$blue-medium-highlight: #b3e7fe;
$blue-medium-focus: #007cba;

// Alert colors.
$alert-yellow: #f0b849;
$alert-red: #d94f4f;
$alert-green: #4ab866;
2 changes: 1 addition & 1 deletion css/src/editor.scss
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ div[class^="wp-block-genesis-custom-blocks-"],
}
}

// In the <ServerSideRender> display, correct an issue where <ul> and <ol> can appear outside (to the left) of their container.
/* In the <ServerSideRender> display, correct an issue where <ul> and <ol> can appear outside (to the left) of their container. */
.editor-styles-wrapper .genesis-custom-blocks-editor__ssr {
ul,
ol {
Expand Down
8 changes: 4 additions & 4 deletions js/src/block-editor/components/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ import { EDITOR_LOCATION } from '../../common/constants';
/**
* The editor component for the block.
*
* @param {Object} props The props of this component.
* @param {import('../../edit-block/hooks/useBlock').Block} props.block The block.
* @param {Object} props.blockProps The block's props.
* @param {Object} props The props of this component.
* @param {import('../../edit-block/hooks/useBlock').Block} props.block The block.
* @param {Object} props.blockProps The block's props.
* @return {React.ReactElement} The editor display.
*/
const Edit = ( { block, blockProps } ) => {
Expand All @@ -50,7 +50,7 @@ const Edit = ( { block, blockProps } ) => {
* Gets whether the passed block has a selected InnerBlock.
*
* @param {Object} blockCandidate The block to examine for InnerBlocks.
* @param {Object} selectedBlock The block that's selected in the editor.
* @param {Object} selectedBlock The block that's selected in the editor.
* @return {boolean} Whether the passed block has a selected InnerBlock.
*/
const hasSelectedInnerBlock = ( blockCandidate, selectedBlock ) =>
Expand Down
4 changes: 2 additions & 2 deletions js/src/block-editor/components/editor-form.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ import { getFieldsAsArray, getIconComponent } from '../../common/helpers';
/**
* The editor component for the block.
*
* @param {Object} props The props of this component.
* @param {Object} props.block The block.
* @param {Object} props The props of this component.
* @param {Object} props.block The block.
* @param {Object} props.blockProps The block's props.
* @return {React.ReactElement} The editor display.
*/
Expand Down
14 changes: 7 additions & 7 deletions js/src/block-editor/components/fields.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@ const getClassName = ( field ) => {

/**
* @typedef {Object} FieldsProps The component props.
* @property {Array} fields The fields to render.
* @property {Object} parentBlock The block where the fields are.
* @property {Array} fields The fields to render.
* @property {Object} parentBlock The block where the fields are.
* @property {Object} parentBlockProps The props to pass to the control function.
* @property {number} [rowIndex] The index of the repeater row, if this field is in one (optional).
* @property {string} [context] Where this will render, either in the GCB editor (edit-block) or the block editor.
* @property {number} [rowIndex] The index of the repeater row, if this field is in one (optional).
* @property {string} [context] Where this will render, either in the GCB editor (edit-block) or the block editor.
*/

/**
Expand Down Expand Up @@ -96,10 +96,10 @@ const Fields = ( { fields, parentBlock, parentBlockProps, rowIndex, context } )
*
* If this is in a repeater row, the value is appropriate for that.
*
* @param {Object} props The properties of the Control function.
* @param {Object} props.field The field.
* @param {Object} props The properties of the Control function.
* @param {Object} props.field The field.
* @param {Object} props.parentBlockProps The props of the parent block.
* @param {number} props.rowIndex The index of the repeater row (optional).
* @param {number} props.rowIndex The index of the repeater row (optional).
*/
const getValue = ( {
field: ownField,
Expand Down
4 changes: 2 additions & 2 deletions js/src/block-editor/components/gcb-inspector.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ import { getFieldsAsArray } from '../../common/helpers';
/**
* Gets the rendered controls for the Inspector Controls, based on the field values.
*
* @param {Object} props This component's props.
* @param {Object} props This component's props.
* @param {Object} props.blockProps The block's props.
* @param {Object} props.block The block.
* @param {Object} props.block The block.
* @return {React.ReactElement} The inspector controls.
*/
const GcbInspector = ( { blockProps, block } ) => (
Expand Down
6 changes: 3 additions & 3 deletions js/src/block-editor/components/repeater-rows.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ import { Fields } from './';
/**
* Gets the repeater rows.
*
* @param {Array} rows The repeater rows to render.
* @param {Array} fields The fields to render.
* @param {Array} rows The repeater rows to render.
* @param {Array} fields The fields to render.
* @param {Object} parentBlockProps The props to pass to the control function.
* @param {Object} parentBlock The block where the fields are.
* @param {Object} parentBlock The block where the fields are.
* @return {Array} fields The rendered fields.
*/
class RepeaterRows extends Component {
Expand Down
14 changes: 4 additions & 10 deletions js/src/block-editor/components/test/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,14 @@
*/
import '@testing-library/jest-dom/extend-expect';
import * as React from 'react';
import { render, screen } from '@testing-library/react';
import { act, render, screen } from '@testing-library/react';
import user from '@testing-library/user-event';

/**
* Internal dependencies
*/
import { Edit } from '../';

jest.mock( '@wordpress/api-fetch', () => {
return jest.fn( () => {
return Promise.resolve( {
json: () => Promise.resolve( {} ),
} );
} );
} );

jest.mock( '@wordpress/data/build/components/use-select', () =>
jest.fn( () => false )
);
Expand Down Expand Up @@ -100,7 +92,9 @@ describe( 'Edit', () => {
expect( screen.getByLabelText( /gcb block form/i ) ).toBeInTheDocument();
screen.getAllByText( getBlock().title );

user.click( screen.getByLabelText( /close dialog/i ) );
act( () => {
user.click( screen.getByLabelText( /close dialog/i ) );
} );

expect( screen.queryByLabelText( /gcb block form/i ) ).not.toBeInTheDocument();
expect( screen.queryByText( getBlock().title ) ).not.toBeInTheDocument();
Expand Down
2 changes: 1 addition & 1 deletion js/src/block-editor/components/test/fields.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ describe( 'Fields', () => {
/>
);

expect( screen.queryByText( helpText ) ).toBeNull();
expect( screen.queryByText( helpText ) ).not.toBeInTheDocument();
} );

it( 'displays a control that is supposed to be in the editor', () => {
Expand Down
2 changes: 1 addition & 1 deletion js/src/block-editor/controls/test/color.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ test( 'color control', async () => {
);
const input = getByRole( 'textbox' );

expect( input.value ).toBe( field.default );
expect( input ).toHaveValue( field.default );
await findByText( field.help );
await findByText( field.label );

Expand Down
2 changes: 1 addition & 1 deletion js/src/block-editor/controls/test/email.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ describe( 'email control', () => {
it( 'displays the default value if no value is entered', () => {
const props = getProps();
const { control } = setupControl( GcbEmailControl, props );
expect( control ).toHaveAttribute( 'value', props.field.default );
expect( control ).toHaveValue( props.field.default );
} );

it.each( [
Expand Down
2 changes: 1 addition & 1 deletion js/src/block-editor/controls/test/helpers/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { render } from '@testing-library/react';
* Renders a control, and gets utility methods to test it.
*
* @param {Function} Control The control to render.
* @param {Object} props The props for the control.
* @param {Object} props The props for the control.
* @return {Object} The control and testing utility functions.
*/
export const setupControl = ( Control, props ) => {
Expand Down
4 changes: 2 additions & 2 deletions js/src/block-editor/controls/test/number.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import { setupControl } from './helpers';
const getProps = () => ( {
field: {
label: 'This is a label for the number field',
default: '52344',
default: 52344,
placeholder: 'This is a placeholder for the number',
},
onChange: jest.fn(),
Expand All @@ -27,7 +27,7 @@ describe( 'number control', () => {
it( 'displays the default value if no value is entered', () => {
const props = getProps();
const { control } = setupControl( GcbNumberControl, props );
expect( control ).toHaveAttribute( 'value', props.field.default );
expect( control ).toHaveValue( props.field.default );
} );

it( 'has the placeholder', async () => {
Expand Down
2 changes: 1 addition & 1 deletion js/src/block-editor/controls/test/range.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ test( 'range control', () => {
getByText( field.help );

// This should have the default value as its value.
expect( control ).toHaveAttribute( 'value', field.default.toString() );
expect( control ).toHaveValue( field.default.toString() );

// Changing the value should call the onChange handler.
const newValue = 58;
Expand Down
2 changes: 1 addition & 1 deletion js/src/block-editor/controls/test/text.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ describe( 'text control', () => {
const props = getProps();
const { control } = setupControl( GcbTextControl, props );

expect( control ).toHaveAttribute( 'value', props.field.default );
expect( control ).toHaveValue( props.field.default );
} );

it.each( [
Expand Down
Loading