WP Manifestindependent plugin directory
manifest / editor / ucsc-gutenberg-blocks

UCSC Gutenberg Blocks

★ 2stars
88release downloads
v1.2.2latest · 3d ago

Install

Download ucsc-gutenberg-blocks.zip From the v1.2.2 release on GitHub, Oct 22, 2026

Upload it under Plugins → Add New Plugin → Upload Plugin, then activate.

Install straight from GitHub with WP-CLI:

wp plugin install https://github.com/ucsc/ucsc-gutenberg-blocks/releases/download/v1.2.2/ucsc-gutenberg-blocks.zip
No built-in updater. New versions won't appear under Dashboard → Updates. Install new releases yourself, or let Git Updater track the repository.

About The Plugin

A WordPress plugin providing UCSC custom Gutenberg blocks: class schedule, course catalog, and campus directory as seen at:

Development Setup Instructions

How To Contribute Code / Develop

  • From the wordpress root (by default wp-dev.ucsc): cd public/wp-content/plugins/ucsc-gutenberg-blocks
  • This is a separate repo that gets cloned to this directory during the initial setup setup.sh
  • Create Feature branch git checkout -b "feature/WPM-xxx_my_feature"
  • Write code, see Anatomy of a Custom Block
  • Commit and push your changes, then create a PR into the main branch on GitHub
  • Instructions for pushing to the development and production campus press servers

Basic Block Development

As a reference a commit to adding a demo block to this repo

This commit shows how to create a Dynamic Block vs a Static Block. There are many benefits to using Dynamic Blocks, here are some resources discussing the benefits:

Instructions

  • Create a file in src/classes to hold the PHP/Wordpress code.
    • Actions can be added
    • Blocks can be registered
    • Site and Network settings
  • Include the new file in the index.php file and instantiate the class
  • Create a js file in src/blocks/ directory
    • This file can import libs and components but is not a component itself
    • Create and export a function where you can register the block.
    • Make sure the name you are registering here matches the name you registered in PHP
  • In src/index.js import your function and call it so that the block gets registered.
  • If needed, add JS and CSS component code under src/components

Testing

Unit tests use Jest via @wordpress/scripts and @testing-library/react for rendering Gutenberg block edit components.

Running Tests

From the wp-dev.ucsc project root, run tests inside Docker:

docker compose -f docker-compose.yml -f docker-compose-start.yml run --rm \
  -w /var/www/html/wp-content/plugins/ucsc-gutenberg-blocks \
  plugin_npm_start npm test

Or to run a single test file:

docker compose -f docker-compose.yml -f docker-compose-start.yml run --rm \
  -w /var/www/html/wp-content/plugins/ucsc-gutenberg-blocks \
  plugin_npm_start npx wp-scripts test-unit-js --testPathPattern=ClassSchedule

Coverage

Run JavaScript coverage from the plugin directory:

npm run test:coverage

The report is written to:

coverage/coverage-summary.json
coverage/lcov.info
coverage/lcov-report/index.html

The equivalent Docker command, from the wp-dev.ucsc project root, is:

docker compose -f docker-compose.yml -f docker-compose-start.yml run --rm \
  -w /var/www/html/wp-content/plugins/ucsc-gutenberg-blocks \
  plugin_npm_start npm run test:coverage

Run PHP coverage from the plugin directory:

bash tests/php/run-php-coverage.sh

The PHP report is written to:

coverage/php/clover.xml
coverage/php/coverage-raw.json

The latest three-block assessment is:

Block JS statements JS branches JS functions JS lines
Campus Directory 100% 100% 100% 100%
Class Schedule 74.07% 33.33% 63.63% 74.07%
Course Catalog 100% 100% 100% 100%

Overall JavaScript coverage is 38.86% statements, 41.15% branches, 35.53% functions, and 38.83% lines because untouched components and legacy files are included. The JavaScript suite passed 72 tests across 5 suites.

PHP coverage reports 100% statement coverage (545/545), but the harness is not a clean passing baseline: 3 of 4 suites passed. The CampusDirectoryShortcodeTest.php suite contains four intentionally failing XSS assertions documenting existing escaping vulnerabilities.

The plugin's structural gap report is read-only and groups classes, templates, blocks, and components that are named by no test:

python3 /path/to/ucsc-wp-block-dev/skills/validate/scripts/coverage-report.py . --gaps

This structural report is a gap floor, not line or branch coverage. On systems where the script requires Python 3.10 or newer, use that interpreter; Python 3.9 cannot parse its union type syntax.

Writing Tests

Test files live in src/blocks/__tests__/ and follow the naming convention BlockName.test.js. Since WordPress packages like @wordpress/components are provided at runtime (not installed as dependencies), they must be mocked with { virtual: true }:

jest.mock('@wordpress/components', () => ({
  Panel: ({ children }) => <div>{children}</div>,
}), { virtual: true });

Child components (dropdowns, layouts, etc.) are also mocked so tests focus on the block's own logic rather than its children.

VScode/Xdebug setup

The PHP Debug plugin is required. On the debug tab click Create a launch.json file and select type php.

You can replace the contents of launch.json with the following:

{
  "version": "0.2.0",
  "configurations": [
    {
      "name": "Listen for Xdebug",
      "type": "php",
      "request": "launch",
      "port": 9003,
      "pathMappings": {
        "/var/www/html/wp-content/plugins/ucsc-gutenberg-blocks": "${workspaceRoot}"
      },
      "hostname": "wp-dev.ucsc"
    }
  ]
}

Releases

Newest 25 of 60 recorded releases. Each count is every asset in that release; expand a row for the breakdown.

Tag
Published
Assets
Downloads
v1.2.2 latest
Oct 22, 2026 3d ago
ucsc-gutenberg-blocks.zip
3
Aug 25, 2026 2mo ago
ucsc-gutenberg-blocks.zip
4
Jul 30, 2026 2mo ago
ucsc-gutenberg-blocks.zip
5
Jun 18, 2026 4mo ago
ucsc-gutenberg-blocks.zip
1
May 13, 2026 5mo ago
ucsc-gutenberg-blocks.zip
3
May 12, 2026 5mo ago
ucsc-gutenberg-blocks.zip
1
May 6, 2026 5mo ago
ucsc-gutenberg-blocks.zip
5
Apr 22, 2026 6mo ago
ucsc-gutenberg-blocks.zip
3
Apr 7, 2026 6mo ago
ucsc-gutenberg-blocks.zip
3
Jan 21, 2026 9mo ago
ucsc-gutenberg-blocks.zip
6
Aug 14, 2025 1 year ago
ucsc-gutenberg-blocks.zip
2
Jan 21, 2025 1 year ago
tag only
—
Nov 6, 2024 1 year ago
ucsc-gutenberg-blocks.zip
8
Jun 27, 2024 2 years ago
ucsc-gutenberg-blocks.zip
10
Jun 27, 2024 2 years ago
ucsc-gutenberg-blocks.zip
10
Jun 26, 2024 2 years ago
ucsc-gutenberg-blocks.zip
15
Jun 24, 2024 2 years ago
ucsc-gutenberg-blocks.zip
9
Feb 7, 2024 2 years ago
tag only
—
Jan 9, 2024 2 years ago
tag only
—
Nov 2, 2023 2 years ago
tag only
—
Oct 18, 2023 3 years ago
tag only
—
Aug 30, 2023 3 years ago
tag only
—
Aug 21, 2023 3 years ago
tag only
—
Aug 8, 2023 3 years ago
tag only
—
Aug 2, 2023 3 years ago
tag only
—
All releases on GitHub →