Combobox patch to prevent the suggestion list being left open after browser autocomplete (https://github.com/woocommerce/woocommerce-blocks/pull/4590)
* Combobox patch * Update a package to invalidate CI cache * Update cache handling * revert eslint package change
This commit is contained in:
parent
71851f25a5
commit
717465ed99
|
@ -1,79 +1,76 @@
|
||||||
name: JavaScript and CSS Linting
|
name: JavaScript and CSS Linting
|
||||||
|
|
||||||
on:
|
on:
|
||||||
pull_request:
|
pull_request:
|
||||||
push:
|
push:
|
||||||
branches: [trunk]
|
branches: [trunk]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
Setup:
|
Setup:
|
||||||
name: Setup for Jobs
|
name: Setup for Jobs
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
- name: Cache node modules
|
- name: Cache node modules
|
||||||
uses: actions/cache@v2
|
uses: actions/cache@v2
|
||||||
with:
|
with:
|
||||||
path: node_modules
|
path: node_modules
|
||||||
key: ${{ runner.OS }}-build-${{ hashFiles('**/package-lock.json') }}
|
key: ${{ runner.OS }}-build-${{ secrets.CACHE_VERSION }}-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
|
||||||
restore-keys: |
|
restore-keys: |
|
||||||
${{ runner.OS }}-build-${{ env.cache-name }}-
|
${{ runner.OS }}-build-${{ secrets.CACHE_VERSION }}-${{ env.cache-name }}-
|
||||||
${{ runner.OS }}-build-
|
${{ runner.OS }}-build-${{ secrets.CACHE_VERSION }}-
|
||||||
${{ runner.OS }}-
|
- name: Install Node Dependencies
|
||||||
- name: Install Node Dependencies
|
run: npm install
|
||||||
run: npm install
|
|
||||||
|
|
||||||
JSLintingCheck:
|
JSLintingCheck:
|
||||||
name: Lint JavaScript
|
name: Lint JavaScript
|
||||||
needs: Setup
|
needs: Setup
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
- name: Cache node modules
|
- name: Cache node modules
|
||||||
uses: actions/cache@v2
|
uses: actions/cache@v2
|
||||||
with:
|
with:
|
||||||
path: node_modules
|
path: node_modules
|
||||||
key: ${{ runner.OS }}-build-${{ hashFiles('**/package-lock.json') }}
|
key: ${{ runner.OS }}-build-${{ secrets.CACHE_VERSION }}-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
|
||||||
restore-keys: |
|
restore-keys: |
|
||||||
${{ runner.OS }}-build-${{ env.cache-name }}-
|
${{ runner.OS }}-build-${{ secrets.CACHE_VERSION }}-${{ env.cache-name }}-
|
||||||
${{ runner.OS }}-build-
|
${{ runner.OS }}-build-${{ secrets.CACHE_VERSION }}-
|
||||||
${{ runner.OS }}-
|
- name: Install Node Dependencies
|
||||||
- name: Install Node Dependencies
|
run: npm install
|
||||||
run: npm install
|
- name: Save Code Linting Report JSON
|
||||||
- name: Save Code Linting Report JSON
|
run: npm run lint:js:report
|
||||||
run: npm run lint:js:report
|
# Continue to the next step even if this fails
|
||||||
# Continue to the next step even if this fails
|
continue-on-error: true
|
||||||
continue-on-error: true
|
- name: Upload ESLint report
|
||||||
- name: Upload ESLint report
|
uses: actions/upload-artifact@v2
|
||||||
uses: actions/upload-artifact@v2
|
with:
|
||||||
with:
|
name: eslint_report.json
|
||||||
name: eslint_report.json
|
path: eslint_report.json
|
||||||
path: eslint_report.json
|
- name: Annotate Code Linting Results
|
||||||
- name: Annotate Code Linting Results
|
uses: ataylorme/eslint-annotate-action@1.2.0
|
||||||
uses: ataylorme/eslint-annotate-action@1.2.0
|
with:
|
||||||
with:
|
repo-token: '${{ secrets.GITHUB_TOKEN }}'
|
||||||
repo-token: "${{ secrets.GITHUB_TOKEN }}"
|
report-json: 'eslint_report.json'
|
||||||
report-json: "eslint_report.json"
|
|
||||||
|
|
||||||
CSSLintingCheck:
|
CSSLintingCheck:
|
||||||
name: Lint CSS
|
name: Lint CSS
|
||||||
needs: Setup
|
needs: Setup
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
- name: Cache node modules
|
- name: Cache node modules
|
||||||
uses: actions/cache@v2
|
uses: actions/cache@v2
|
||||||
with:
|
with:
|
||||||
path: node_modules
|
path: node_modules
|
||||||
key: ${{ runner.OS }}-build-${{ hashFiles('**/package-lock.json') }}
|
key: ${{ runner.OS }}-build-${{ secrets.CACHE_VERSION }}-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
|
||||||
restore-keys: |
|
restore-keys: |
|
||||||
${{ runner.OS }}-build-${{ env.cache-name }}-
|
${{ runner.OS }}-build-${{ secrets.CACHE_VERSION }}-${{ env.cache-name }}-
|
||||||
${{ runner.OS }}-build-
|
${{ runner.OS }}-build-${{ secrets.CACHE_VERSION }}-
|
||||||
${{ runner.OS }}-
|
- name: Install Node Dependencies
|
||||||
- name: Install Node Dependencies
|
run: npm install
|
||||||
run: npm install
|
- name: Lint CSS
|
||||||
- name: Lint CSS
|
run: npm run lint:css
|
||||||
run: npm run lint:css
|
|
||||||
|
|
|
@ -1,188 +1,184 @@
|
||||||
name: E2E tests
|
name: E2E tests
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: [trunk]
|
branches: [trunk]
|
||||||
pull_request:
|
pull_request:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
Setup:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
name: Setup
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
|
||||||
Setup:
|
- name: Cache node modules
|
||||||
runs-on: ubuntu-latest
|
uses: actions/cache@v2
|
||||||
name: Setup
|
env:
|
||||||
steps:
|
cache-name: cache-node-modules
|
||||||
- uses: actions/checkout@v2
|
with:
|
||||||
|
# npm cache files are stored in `~/.npm` on Linux/macOS
|
||||||
|
path: ~/.npm
|
||||||
|
key: ${{ runner.OS }}-build-${{ secrets.CACHE_VERSION }}-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
|
||||||
|
restore-keys: |
|
||||||
|
${{ runner.OS }}-build-${{ secrets.CACHE_VERSION }}-${{ env.cache-name }}-
|
||||||
|
${{ runner.OS }}-build-${{ secrets.CACHE_VERSION }}-
|
||||||
|
|
||||||
- name: Cache node modules
|
- name: Use Node.js 14.x
|
||||||
uses: actions/cache@v2
|
uses: actions/setup-node@v1
|
||||||
env:
|
with:
|
||||||
cache-name: cache-node-modules
|
node-version: 14.x
|
||||||
with:
|
|
||||||
# npm cache files are stored in `~/.npm` on Linux/macOS
|
|
||||||
path: ~/.npm
|
|
||||||
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
|
|
||||||
restore-keys: |
|
|
||||||
${{ runner.os }}-build-${{ env.cache-name }}-
|
|
||||||
${{ runner.os }}-build-
|
|
||||||
${{ runner.os }}-
|
|
||||||
|
|
||||||
- name: Use Node.js 14.x
|
- name: Npm install and build
|
||||||
uses: actions/setup-node@v1
|
run: |
|
||||||
with:
|
npm ci
|
||||||
node-version: 14.x
|
FORCE_REDUCED_MOTION=true npm run build:e2e-test
|
||||||
|
|
||||||
- name: Npm install and build
|
- name: Get Composer Cache Directory
|
||||||
run: |
|
id: composer-cache
|
||||||
npm ci
|
run: |
|
||||||
FORCE_REDUCED_MOTION=true npm run build:e2e-test
|
echo "::set-output name=dir::$(composer config cache-files-dir)"
|
||||||
|
- uses: actions/cache@v2
|
||||||
|
with:
|
||||||
|
path: ${{ steps.composer-cache.outputs.dir }}
|
||||||
|
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
||||||
|
restore-keys: |
|
||||||
|
${{ runner.os }}-composer-
|
||||||
|
|
||||||
- name: Get Composer Cache Directory
|
- name: Set up PHP
|
||||||
id: composer-cache
|
uses: shivammathur/setup-php@v2
|
||||||
run: |
|
with:
|
||||||
echo "::set-output name=dir::$(composer config cache-files-dir)"
|
php-version: 7.4
|
||||||
- uses: actions/cache@v2
|
coverage: none
|
||||||
with:
|
tools: composer
|
||||||
path: ${{ steps.composer-cache.outputs.dir }}
|
|
||||||
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
|
||||||
restore-keys: |
|
|
||||||
${{ runner.os }}-composer-
|
|
||||||
|
|
||||||
- name: Set up PHP
|
- name: Composer install
|
||||||
uses: shivammathur/setup-php@v2
|
run: |
|
||||||
with:
|
composer install
|
||||||
php-version: 7.4
|
|
||||||
coverage: none
|
|
||||||
tools: composer
|
|
||||||
|
|
||||||
- name: Composer install
|
JSE2EWithGutenberg:
|
||||||
run: |
|
name: JavaScript E2E Tests (WP latest with Gutenberg plugin)
|
||||||
composer install
|
needs: Setup
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
|
||||||
JSE2EWithGutenberg:
|
- name: Cache node modules
|
||||||
name: JavaScript E2E Tests (WP latest with Gutenberg plugin)
|
uses: actions/cache@v2
|
||||||
needs: Setup
|
env:
|
||||||
runs-on: ubuntu-latest
|
cache-name: cache-node-modules
|
||||||
steps:
|
with:
|
||||||
- uses: actions/checkout@v2
|
# npm cache files are stored in `~/.npm` on Linux/macOS
|
||||||
|
path: ~/.npm
|
||||||
|
key: ${{ runner.OS }}-build-${{ secrets.CACHE_VERSION }}-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
|
||||||
|
restore-keys: |
|
||||||
|
${{ runner.OS }}-build-${{ secrets.CACHE_VERSION }}-${{ env.cache-name }}-
|
||||||
|
${{ runner.OS }}-build-${{ secrets.CACHE_VERSION }}-
|
||||||
|
|
||||||
- name: Cache node modules
|
- name: Use Node.js 14.x
|
||||||
uses: actions/cache@v2
|
uses: actions/setup-node@v1
|
||||||
env:
|
with:
|
||||||
cache-name: cache-node-modules
|
node-version: 14.x
|
||||||
with:
|
|
||||||
# npm cache files are stored in `~/.npm` on Linux/macOS
|
|
||||||
path: ~/.npm
|
|
||||||
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
|
|
||||||
restore-keys: |
|
|
||||||
${{ runner.os }}-build-${{ env.cache-name }}-
|
|
||||||
${{ runner.os }}-build-
|
|
||||||
${{ runner.os }}-
|
|
||||||
|
|
||||||
- name: Use Node.js 14.x
|
- name: Npm install and build
|
||||||
uses: actions/setup-node@v1
|
run: |
|
||||||
with:
|
npm ci
|
||||||
node-version: 14.x
|
FORCE_REDUCED_MOTION=true npm run build:e2e-test
|
||||||
|
|
||||||
- name: Npm install and build
|
- name: blocks.ini setup
|
||||||
run: |
|
run: |
|
||||||
npm ci
|
echo -e 'woocommerce_blocks_phase = 3\nwoocommerce_blocks_env = tests' > blocks.ini
|
||||||
FORCE_REDUCED_MOTION=true npm run build:e2e-test
|
- name: Get Composer Cache Directory
|
||||||
|
id: composer-cache
|
||||||
|
run: |
|
||||||
|
echo "::set-output name=dir::$(composer config cache-files-dir)"
|
||||||
|
- uses: actions/cache@v2
|
||||||
|
with:
|
||||||
|
path: ${{ steps.composer-cache.outputs.dir }}
|
||||||
|
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
||||||
|
restore-keys: |
|
||||||
|
${{ runner.os }}-composer-
|
||||||
|
|
||||||
- name: blocks.ini setup
|
- name: Set up PHP
|
||||||
run: |
|
uses: shivammathur/setup-php@v2
|
||||||
echo -e 'woocommerce_blocks_phase = 3\nwoocommerce_blocks_env = tests' > blocks.ini
|
with:
|
||||||
- name: Get Composer Cache Directory
|
php-version: 7.4
|
||||||
id: composer-cache
|
coverage: none
|
||||||
run: |
|
tools: composer
|
||||||
echo "::set-output name=dir::$(composer config cache-files-dir)"
|
|
||||||
- uses: actions/cache@v2
|
|
||||||
with:
|
|
||||||
path: ${{ steps.composer-cache.outputs.dir }}
|
|
||||||
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
|
||||||
restore-keys: |
|
|
||||||
${{ runner.os }}-composer-
|
|
||||||
|
|
||||||
- name: Set up PHP
|
- name: Composer install
|
||||||
uses: shivammathur/setup-php@v2
|
run: |
|
||||||
with:
|
composer install
|
||||||
php-version: 7.4
|
|
||||||
coverage: none
|
|
||||||
tools: composer
|
|
||||||
|
|
||||||
- name: Composer install
|
- name: E2E Tests (WP latest with Gutenberg plugin)
|
||||||
run: |
|
env:
|
||||||
composer install
|
WOOCOMMERCE_BLOCKS_PHASE: 3
|
||||||
|
run: |
|
||||||
|
chmod -R 767 ./ #needed for permissions issues
|
||||||
|
JSON='{"plugins": ["https://downloads.wordpress.org/plugin/woocommerce.latest-stable.zip","https://github.com/WP-API/Basic-Auth/archive/master.zip","https://downloads.wordpress.org/plugin/gutenberg.latest-stable.zip", "."] }'
|
||||||
|
echo $JSON > .wp-env.override.json
|
||||||
|
npm run wp-env start
|
||||||
|
npm run wp-env clean all
|
||||||
|
npm run test:e2e
|
||||||
|
|
||||||
- name: E2E Tests (WP latest with Gutenberg plugin)
|
JSE2ETests:
|
||||||
env:
|
name: JavaScript E2E Tests (latest)
|
||||||
WOOCOMMERCE_BLOCKS_PHASE: 3
|
needs: Setup
|
||||||
run: |
|
runs-on: ubuntu-latest
|
||||||
chmod -R 767 ./ #needed for permissions issues
|
steps:
|
||||||
JSON='{"plugins": ["https://downloads.wordpress.org/plugin/woocommerce.latest-stable.zip","https://github.com/WP-API/Basic-Auth/archive/master.zip","https://downloads.wordpress.org/plugin/gutenberg.latest-stable.zip", "."] }'
|
- uses: actions/checkout@v2
|
||||||
echo $JSON > .wp-env.override.json
|
|
||||||
npm run wp-env start
|
|
||||||
npm run wp-env clean all
|
|
||||||
npm run test:e2e
|
|
||||||
|
|
||||||
JSE2ETests:
|
- name: Cache node modules
|
||||||
name: JavaScript E2E Tests (latest)
|
uses: actions/cache@v2
|
||||||
needs: Setup
|
env:
|
||||||
runs-on: ubuntu-latest
|
cache-name: cache-node-modules
|
||||||
steps:
|
with:
|
||||||
- uses: actions/checkout@v2
|
# npm cache files are stored in `~/.npm` on Linux/macOS
|
||||||
|
path: ~/.npm
|
||||||
|
key: ${{ runner.OS }}-build-${{ secrets.CACHE_VERSION }}-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
|
||||||
|
restore-keys: |
|
||||||
|
${{ runner.OS }}-build-${{ secrets.CACHE_VERSION }}-${{ env.cache-name }}-
|
||||||
|
${{ runner.OS }}-build-${{ secrets.CACHE_VERSION }}-
|
||||||
|
|
||||||
- name: Cache node modules
|
- name: Use Node.js 14.x
|
||||||
uses: actions/cache@v2
|
uses: actions/setup-node@v1
|
||||||
env:
|
with:
|
||||||
cache-name: cache-node-modules
|
node-version: 14.x
|
||||||
with:
|
|
||||||
# npm cache files are stored in `~/.npm` on Linux/macOS
|
|
||||||
path: ~/.npm
|
|
||||||
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
|
|
||||||
restore-keys: |
|
|
||||||
${{ runner.os }}-build-${{ env.cache-name }}-
|
|
||||||
${{ runner.os }}-build-
|
|
||||||
${{ runner.os }}-
|
|
||||||
|
|
||||||
- name: Use Node.js 14.x
|
- name: Npm install and build
|
||||||
uses: actions/setup-node@v1
|
run: |
|
||||||
with:
|
npm ci
|
||||||
node-version: 14.x
|
FORCE_REDUCED_MOTION=true npm run build:e2e-test
|
||||||
|
|
||||||
- name: Npm install and build
|
- name: blocks.ini setup
|
||||||
run: |
|
run: |
|
||||||
npm ci
|
echo -e 'woocommerce_blocks_phase = 3\nwoocommerce_blocks_env = tests' > blocks.ini
|
||||||
FORCE_REDUCED_MOTION=true npm run build:e2e-test
|
- name: Get Composer Cache Directory
|
||||||
|
id: composer-cache
|
||||||
|
run: |
|
||||||
|
echo "::set-output name=dir::$(composer config cache-files-dir)"
|
||||||
|
- uses: actions/cache@v2
|
||||||
|
with:
|
||||||
|
path: ${{ steps.composer-cache.outputs.dir }}
|
||||||
|
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
||||||
|
restore-keys: |
|
||||||
|
${{ runner.os }}-composer-
|
||||||
|
|
||||||
- name: blocks.ini setup
|
- name: Set up PHP
|
||||||
run: |
|
uses: shivammathur/setup-php@v2
|
||||||
echo -e 'woocommerce_blocks_phase = 3\nwoocommerce_blocks_env = tests' > blocks.ini
|
with:
|
||||||
- name: Get Composer Cache Directory
|
php-version: 7.4
|
||||||
id: composer-cache
|
coverage: none
|
||||||
run: |
|
tools: composer
|
||||||
echo "::set-output name=dir::$(composer config cache-files-dir)"
|
|
||||||
- uses: actions/cache@v2
|
|
||||||
with:
|
|
||||||
path: ${{ steps.composer-cache.outputs.dir }}
|
|
||||||
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
|
||||||
restore-keys: |
|
|
||||||
${{ runner.os }}-composer-
|
|
||||||
|
|
||||||
- name: Set up PHP
|
- name: Composer install
|
||||||
uses: shivammathur/setup-php@v2
|
run: |
|
||||||
with:
|
composer install
|
||||||
php-version: 7.4
|
|
||||||
coverage: none
|
|
||||||
tools: composer
|
|
||||||
|
|
||||||
- name: Composer install
|
- name: E2E Tests (WP latest)
|
||||||
run: |
|
env:
|
||||||
composer install
|
WOOCOMMERCE_BLOCKS_PHASE: 3
|
||||||
|
run: |
|
||||||
- name: E2E Tests (WP latest)
|
npm run wp-env start
|
||||||
env:
|
npm run wp-env clean all
|
||||||
WOOCOMMERCE_BLOCKS_PHASE: 3
|
npm run test:e2e
|
||||||
run: |
|
|
||||||
npm run wp-env start
|
|
||||||
npm run wp-env clean all
|
|
||||||
npm run test:e2e
|
|
||||||
|
|
|
@ -1,138 +1,135 @@
|
||||||
name: Unit tests
|
name: Unit tests
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: [trunk]
|
branches: [trunk]
|
||||||
pull_request:
|
pull_request:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
Setup:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
name: Setup
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
|
||||||
Setup:
|
- name: Cache node modules
|
||||||
runs-on: ubuntu-latest
|
uses: actions/cache@v2
|
||||||
name: Setup
|
env:
|
||||||
steps:
|
cache-name: cache-node-modules
|
||||||
- uses: actions/checkout@v2
|
with:
|
||||||
|
# npm cache files are stored in `~/.npm` on Linux/macOS
|
||||||
|
path: ~/.npm
|
||||||
|
key: ${{ runner.OS }}-build-${{ secrets.CACHE_VERSION }}-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
|
||||||
|
restore-keys: |
|
||||||
|
${{ runner.OS }}-build-${{ secrets.CACHE_VERSION }}-${{ env.cache-name }}-
|
||||||
|
${{ runner.OS }}-build-${{ secrets.CACHE_VERSION }}-
|
||||||
|
|
||||||
- name: Cache node modules
|
- name: Use Node.js 14.x
|
||||||
uses: actions/cache@v2
|
uses: actions/setup-node@v1
|
||||||
env:
|
with:
|
||||||
cache-name: cache-node-modules
|
node-version: 14.x
|
||||||
with:
|
|
||||||
# npm cache files are stored in `~/.npm` on Linux/macOS
|
|
||||||
path: ~/.npm
|
|
||||||
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
|
|
||||||
restore-keys: |
|
|
||||||
${{ runner.os }}-build-${{ env.cache-name }}-
|
|
||||||
${{ runner.os }}-build-
|
|
||||||
${{ runner.os }}-
|
|
||||||
|
|
||||||
- name: Use Node.js 14.x
|
- name: Npm install and build
|
||||||
uses: actions/setup-node@v1
|
run: |
|
||||||
with:
|
npm ci
|
||||||
node-version: 14.x
|
FORCE_REDUCED_MOTION=true npm run build:e2e-test
|
||||||
|
|
||||||
- name: Npm install and build
|
- name: Get Composer Cache Directory
|
||||||
run: |
|
id: composer-cache
|
||||||
npm ci
|
run: |
|
||||||
FORCE_REDUCED_MOTION=true npm run build:e2e-test
|
echo "::set-output name=dir::$(composer config cache-files-dir)"
|
||||||
|
- uses: actions/cache@v2
|
||||||
|
with:
|
||||||
|
path: ${{ steps.composer-cache.outputs.dir }}
|
||||||
|
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
||||||
|
restore-keys: |
|
||||||
|
${{ runner.os }}-composer-
|
||||||
|
|
||||||
- name: Get Composer Cache Directory
|
- name: Set up PHP
|
||||||
id: composer-cache
|
uses: shivammathur/setup-php@v2
|
||||||
run: |
|
with:
|
||||||
echo "::set-output name=dir::$(composer config cache-files-dir)"
|
php-version: 7.4
|
||||||
- uses: actions/cache@v2
|
coverage: none
|
||||||
with:
|
tools: composer
|
||||||
path: ${{ steps.composer-cache.outputs.dir }}
|
|
||||||
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
|
||||||
restore-keys: |
|
|
||||||
${{ runner.os }}-composer-
|
|
||||||
|
|
||||||
- name: Set up PHP
|
- name: Composer install
|
||||||
uses: shivammathur/setup-php@v2
|
run: |
|
||||||
with:
|
composer install
|
||||||
php-version: 7.4
|
|
||||||
coverage: none
|
|
||||||
tools: composer
|
|
||||||
|
|
||||||
- name: Composer install
|
PHPUnitTests:
|
||||||
run: |
|
name: PHP Unit Tests
|
||||||
composer install
|
needs: Setup
|
||||||
|
|
||||||
PHPUnitTests:
|
runs-on: ubuntu-latest
|
||||||
name: PHP Unit Tests
|
|
||||||
needs: Setup
|
|
||||||
|
|
||||||
runs-on: ubuntu-latest
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
|
||||||
steps:
|
- name: Get Composer Cache Directory
|
||||||
- uses: actions/checkout@v2
|
id: composer-cache
|
||||||
|
run: |
|
||||||
|
echo "::set-output name=dir::$(composer config cache-files-dir)"
|
||||||
|
- uses: actions/cache@v2
|
||||||
|
with:
|
||||||
|
path: ${{ steps.composer-cache.outputs.dir }}
|
||||||
|
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
||||||
|
restore-keys: |
|
||||||
|
${{ runner.os }}-composer-
|
||||||
|
|
||||||
- name: Get Composer Cache Directory
|
- name: Set up PHP
|
||||||
id: composer-cache
|
uses: shivammathur/setup-php@v2
|
||||||
run: |
|
with:
|
||||||
echo "::set-output name=dir::$(composer config cache-files-dir)"
|
php-version: 7.4
|
||||||
- uses: actions/cache@v2
|
coverage: none
|
||||||
with:
|
tools: composer
|
||||||
path: ${{ steps.composer-cache.outputs.dir }}
|
|
||||||
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
|
||||||
restore-keys: |
|
|
||||||
${{ runner.os }}-composer-
|
|
||||||
|
|
||||||
- name: Set up PHP
|
- name: Composer install
|
||||||
uses: shivammathur/setup-php@v2
|
run: |
|
||||||
with:
|
composer install
|
||||||
php-version: 7.4
|
|
||||||
coverage: none
|
|
||||||
tools: composer
|
|
||||||
|
|
||||||
- name: Composer install
|
- name: blocks.ini setup
|
||||||
run: |
|
run: |
|
||||||
composer install
|
echo -e 'woocommerce_blocks_phase = 3\nwoocommerce_blocks_env = tests' > blocks.ini
|
||||||
|
|
||||||
- name: blocks.ini setup
|
- name: Run PHP Unit tests
|
||||||
run: |
|
run: |
|
||||||
echo -e 'woocommerce_blocks_phase = 3\nwoocommerce_blocks_env = tests' > blocks.ini
|
npm run phpunit
|
||||||
|
|
||||||
- name: Run PHP Unit tests
|
JSUnitTests:
|
||||||
run: |
|
name: JS Unit Tests
|
||||||
npm run phpunit
|
needs: Setup
|
||||||
|
|
||||||
JSUnitTests:
|
runs-on: ubuntu-latest
|
||||||
name: JS Unit Tests
|
|
||||||
needs: Setup
|
|
||||||
|
|
||||||
runs-on: ubuntu-latest
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
|
||||||
steps:
|
- name: Cache node modules
|
||||||
- uses: actions/checkout@v2
|
uses: actions/cache@v2
|
||||||
|
env:
|
||||||
|
cache-name: cache-node-modules
|
||||||
|
with:
|
||||||
|
# npm cache files are stored in `~/.npm` on Linux/macOS
|
||||||
|
path: ~/.npm
|
||||||
|
key: ${{ runner.OS }}-build-${{ secrets.CACHE_VERSION }}-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
|
||||||
|
restore-keys: |
|
||||||
|
${{ runner.OS }}-build-${{ secrets.CACHE_VERSION }}-${{ env.cache-name }}-
|
||||||
|
${{ runner.OS }}-build-${{ secrets.CACHE_VERSION }}-
|
||||||
|
|
||||||
- name: Cache node modules
|
- name: Use Node.js 14.x
|
||||||
uses: actions/cache@v2
|
uses: actions/setup-node@v1
|
||||||
env:
|
with:
|
||||||
cache-name: cache-node-modules
|
node-version: 14.x
|
||||||
with:
|
|
||||||
# npm cache files are stored in `~/.npm` on Linux/macOS
|
|
||||||
path: ~/.npm
|
|
||||||
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
|
|
||||||
restore-keys: |
|
|
||||||
${{ runner.os }}-build-${{ env.cache-name }}-
|
|
||||||
${{ runner.os }}-build-
|
|
||||||
${{ runner.os }}-
|
|
||||||
|
|
||||||
- name: Use Node.js 14.x
|
- name: Npm install and build
|
||||||
uses: actions/setup-node@v1
|
run: |
|
||||||
with:
|
npm ci
|
||||||
node-version: 14.x
|
FORCE_REDUCED_MOTION=true npm run build:e2e-test
|
||||||
|
|
||||||
- name: Npm install and build
|
- name: blocks.ini setup
|
||||||
run: |
|
run: |
|
||||||
npm ci
|
echo -e 'woocommerce_blocks_phase = 3\nwoocommerce_blocks_env = tests' > blocks.ini
|
||||||
FORCE_REDUCED_MOTION=true npm run build:e2e-test
|
|
||||||
|
|
||||||
- name: blocks.ini setup
|
- name: Run JavaScript Unit tests
|
||||||
run: |
|
run: |
|
||||||
echo -e 'woocommerce_blocks_phase = 3\nwoocommerce_blocks_env = tests' > blocks.ini
|
npm run test
|
||||||
|
|
||||||
- name: Run JavaScript Unit tests
|
|
||||||
run: |
|
|
||||||
npm run test
|
|
||||||
|
|
|
@ -94,6 +94,7 @@ const Combobox = ( {
|
||||||
] );
|
] );
|
||||||
|
|
||||||
// @todo Remove patch for ComboboxControl once https://github.com/WordPress/gutenberg/pull/33928 is released
|
// @todo Remove patch for ComboboxControl once https://github.com/WordPress/gutenberg/pull/33928 is released
|
||||||
|
// Also see https://github.com/WordPress/gutenberg/pull/34090
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
id={ controlId }
|
id={ controlId }
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
diff --git a/node_modules/wordpress-components/build-module/combobox-control/index.js b/node_modules/wordpress-components/build-module/combobox-control/index.js
|
diff --git a/node_modules/wordpress-components/build-module/combobox-control/index.js b/node_modules/wordpress-components/build-module/combobox-control/index.js
|
||||||
index 51c59c1..61bda14 100644
|
index 51c59c1..a4b58ab 100644
|
||||||
--- a/node_modules/wordpress-components/build-module/combobox-control/index.js
|
--- a/node_modules/wordpress-components/build-module/combobox-control/index.js
|
||||||
+++ b/node_modules/wordpress-components/build-module/combobox-control/index.js
|
+++ b/node_modules/wordpress-components/build-module/combobox-control/index.js
|
||||||
@@ -1,19 +1,10 @@
|
@@ -1,19 +1,10 @@
|
||||||
|
@ -23,7 +23,7 @@ index 51c59c1..61bda14 100644
|
||||||
/**
|
/**
|
||||||
* WordPress dependencies
|
* WordPress dependencies
|
||||||
*/
|
*/
|
||||||
@@ -34,77 +25,46 @@ import BaseControl from '../base-control';
|
@@ -34,77 +25,47 @@ import BaseControl from '../base-control';
|
||||||
import Button from '../button';
|
import Button from '../button';
|
||||||
import { Flex, FlexBlock, FlexItem } from '../flex';
|
import { Flex, FlexBlock, FlexItem } from '../flex';
|
||||||
import withFocusOutside from '../higher-order/with-focus-outside';
|
import withFocusOutside from '../higher-order/with-focus-outside';
|
||||||
|
@ -125,6 +125,7 @@ index 51c59c1..61bda14 100644
|
||||||
+ const instanceId = useInstanceId(ComboboxControl);
|
+ const instanceId = useInstanceId(ComboboxControl);
|
||||||
+ const [selectedSuggestion, setSelectedSuggestion] = useState(currentOption || null);
|
+ const [selectedSuggestion, setSelectedSuggestion] = useState(currentOption || null);
|
||||||
+ const [isExpanded, setIsExpanded] = useState(false);
|
+ const [isExpanded, setIsExpanded] = useState(false);
|
||||||
|
+ const [inputHasFocus, setInputHasFocus] = useState(false);
|
||||||
+ const [inputValue, setInputValue] = useState('');
|
+ const [inputValue, setInputValue] = useState('');
|
||||||
+ const inputContainer = useRef();
|
+ const inputContainer = useRef();
|
||||||
+ const matchingSuggestions = useMemo(() => {
|
+ const matchingSuggestions = useMemo(() => {
|
||||||
|
@ -136,7 +137,7 @@ index 51c59c1..61bda14 100644
|
||||||
|
|
||||||
if (index === 0) {
|
if (index === 0) {
|
||||||
startsWithMatch.push(option);
|
startsWithMatch.push(option);
|
||||||
@@ -115,7 +75,7 @@ function ComboboxControl(_ref) {
|
@@ -115,7 +76,7 @@ function ComboboxControl(_ref) {
|
||||||
return startsWithMatch.concat(containsMatch);
|
return startsWithMatch.concat(containsMatch);
|
||||||
}, [inputValue, options, value]);
|
}, [inputValue, options, value]);
|
||||||
|
|
||||||
|
@ -145,7 +146,7 @@ index 51c59c1..61bda14 100644
|
||||||
onChange(newSelectedSuggestion.value);
|
onChange(newSelectedSuggestion.value);
|
||||||
speak(messages.selected, 'assertive');
|
speak(messages.selected, 'assertive');
|
||||||
setSelectedSuggestion(newSelectedSuggestion);
|
setSelectedSuggestion(newSelectedSuggestion);
|
||||||
@@ -123,10 +83,9 @@ function ComboboxControl(_ref) {
|
@@ -123,10 +84,9 @@ function ComboboxControl(_ref) {
|
||||||
setIsExpanded(false);
|
setIsExpanded(false);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -159,7 +160,7 @@ index 51c59c1..61bda14 100644
|
||||||
|
|
||||||
if (nextIndex < 0) {
|
if (nextIndex < 0) {
|
||||||
nextIndex = matchingSuggestions.length - 1;
|
nextIndex = matchingSuggestions.length - 1;
|
||||||
@@ -138,8 +97,12 @@ function ComboboxControl(_ref) {
|
@@ -138,8 +98,12 @@ function ComboboxControl(_ref) {
|
||||||
setIsExpanded(true);
|
setIsExpanded(true);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -174,7 +175,7 @@ index 51c59c1..61bda14 100644
|
||||||
|
|
||||||
switch (event.keyCode) {
|
switch (event.keyCode) {
|
||||||
case ENTER:
|
case ENTER:
|
||||||
@@ -164,7 +127,6 @@ function ComboboxControl(_ref) {
|
@@ -164,7 +128,6 @@ function ComboboxControl(_ref) {
|
||||||
setIsExpanded(false);
|
setIsExpanded(false);
|
||||||
setSelectedSuggestion(null);
|
setSelectedSuggestion(null);
|
||||||
preventDefault = true;
|
preventDefault = true;
|
||||||
|
@ -182,12 +183,17 @@ index 51c59c1..61bda14 100644
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@@ -176,34 +138,44 @@ function ComboboxControl(_ref) {
|
@@ -176,34 +139,52 @@ function ComboboxControl(_ref) {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
- var onFocus = function onFocus() {
|
- var onFocus = function onFocus() {
|
||||||
|
+ const onBlur = () => {
|
||||||
|
+ setInputHasFocus(false);
|
||||||
|
+ };
|
||||||
|
+
|
||||||
+ const onFocus = () => {
|
+ const onFocus = () => {
|
||||||
|
+ setInputHasFocus(true);
|
||||||
setIsExpanded(true);
|
setIsExpanded(true);
|
||||||
onFilterValueChange('');
|
onFilterValueChange('');
|
||||||
setInputValue('');
|
setInputValue('');
|
||||||
|
@ -204,7 +210,11 @@ index 51c59c1..61bda14 100644
|
||||||
+ const text = event.value;
|
+ const text = event.value;
|
||||||
setInputValue(text);
|
setInputValue(text);
|
||||||
onFilterValueChange(text);
|
onFilterValueChange(text);
|
||||||
setIsExpanded(true);
|
- setIsExpanded(true);
|
||||||
|
+
|
||||||
|
+ if (inputHasFocus) {
|
||||||
|
+ setIsExpanded(true);
|
||||||
|
+ }
|
||||||
};
|
};
|
||||||
|
|
||||||
- var handleOnReset = function handleOnReset() {
|
- var handleOnReset = function handleOnReset() {
|
||||||
|
@ -213,14 +223,14 @@ index 51c59c1..61bda14 100644
|
||||||
inputContainer.current.input.focus();
|
inputContainer.current.input.focus();
|
||||||
- }; // Announcements
|
- }; // Announcements
|
||||||
+ }; // Update current selections when the filter input changes.
|
+ }; // Update current selections when the filter input changes.
|
||||||
|
+
|
||||||
|
|
||||||
|
|
||||||
- useEffect(function () {
|
|
||||||
- var hasMatchingSuggestions = matchingSuggestions.length > 0;
|
|
||||||
+ useEffect(() => {
|
+ useEffect(() => {
|
||||||
+ const hasMatchingSuggestions = matchingSuggestions.length > 0;
|
+ const hasMatchingSuggestions = matchingSuggestions.length > 0;
|
||||||
+ const hasSelectedMatchingSuggestions = matchingSuggestions.indexOf(selectedSuggestion) > 0;
|
+ const hasSelectedMatchingSuggestions = matchingSuggestions.indexOf(selectedSuggestion) > 0;
|
||||||
+
|
|
||||||
|
- useEffect(function () {
|
||||||
|
- var hasMatchingSuggestions = matchingSuggestions.length > 0;
|
||||||
+ if (hasMatchingSuggestions && !hasSelectedMatchingSuggestions) {
|
+ if (hasMatchingSuggestions && !hasSelectedMatchingSuggestions) {
|
||||||
+ // If the current selection isn't present in the list of suggestions, then automatically select the first item from the list of suggestions.
|
+ // If the current selection isn't present in the list of suggestions, then automatically select the first item from the list of suggestions.
|
||||||
+ setSelectedSuggestion(matchingSuggestions[0]);
|
+ setSelectedSuggestion(matchingSuggestions[0]);
|
||||||
|
@ -236,7 +246,7 @@ index 51c59c1..61bda14 100644
|
||||||
/* translators: %d: number of results. */
|
/* translators: %d: number of results. */
|
||||||
_n('%d result found, use up and down arrow keys to navigate.', '%d results found, use up and down arrow keys to navigate.', matchingSuggestions.length), matchingSuggestions.length) : __('No results.');
|
_n('%d result found, use up and down arrow keys to navigate.', '%d results found, use up and down arrow keys to navigate.', matchingSuggestions.length), matchingSuggestions.length) : __('No results.');
|
||||||
speak(message, 'polite');
|
speak(message, 'polite');
|
||||||
@@ -220,7 +192,7 @@ function ComboboxControl(_ref) {
|
@@ -220,7 +201,7 @@ function ComboboxControl(_ref) {
|
||||||
className: classnames(className, 'components-combobox-control'),
|
className: classnames(className, 'components-combobox-control'),
|
||||||
tabIndex: "-1",
|
tabIndex: "-1",
|
||||||
label: label,
|
label: label,
|
||||||
|
@ -245,16 +255,18 @@ index 51c59c1..61bda14 100644
|
||||||
hideLabelFromVision: hideLabelFromVision,
|
hideLabelFromVision: hideLabelFromVision,
|
||||||
help: help
|
help: help
|
||||||
}, createElement("div", {
|
}, createElement("div", {
|
||||||
@@ -232,7 +204,7 @@ function ComboboxControl(_ref) {
|
@@ -232,8 +213,9 @@ function ComboboxControl(_ref) {
|
||||||
instanceId: instanceId,
|
instanceId: instanceId,
|
||||||
ref: inputContainer,
|
ref: inputContainer,
|
||||||
value: isExpanded ? inputValue : currentLabel,
|
value: isExpanded ? inputValue : currentLabel,
|
||||||
- "aria-label": currentLabel ? "".concat(currentLabel, ", ").concat(label) : null,
|
- "aria-label": currentLabel ? "".concat(currentLabel, ", ").concat(label) : null,
|
||||||
+ "aria-label": currentLabel ? `${currentLabel}, ${label}` : null,
|
+ "aria-label": currentLabel ? `${currentLabel}, ${label}` : null,
|
||||||
onFocus: onFocus,
|
onFocus: onFocus,
|
||||||
|
+ onBlur: onBlur,
|
||||||
isExpanded: isExpanded,
|
isExpanded: isExpanded,
|
||||||
selectedSuggestionIndex: matchingSuggestions.indexOf(selectedSuggestion),
|
selectedSuggestionIndex: matchingSuggestions.indexOf(selectedSuggestion),
|
||||||
@@ -248,9 +220,7 @@ function ComboboxControl(_ref) {
|
onChange: onInputChange
|
||||||
|
@@ -248,9 +230,7 @@ function ComboboxControl(_ref) {
|
||||||
match: {
|
match: {
|
||||||
label: inputValue
|
label: inputValue
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue