Skip to content

Commit

Permalink
Rename filename for classname fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
tjcafferkey authored and ockham committed Jun 5, 2024
1 parent 31fb923 commit cd945bd
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
/**
* Internal dependencies
*/
import {
fixCustomClassname,
fixVariationClassname,
} from './fix-custom-classname';
import { fixCustomClassname, fixVariationClassname } from './fix-classnames';

/**
* Attempts to fix block invalidation by applying build-in validation fixes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,18 @@ export function fixCustomClassname( blockAttributes, blockType, innerHTML ) {
return modifiedBlockAttributes;
}

/**
* Given a block's attributes, block type settings, and innerHTML. If the block
* has variations and the active variation is not reflected in the block's
* markup, the active variation's class name is injected into the block's
* markup.
*
* @param {Object} blockAttributes Original block attributes.
* @param {Object} blockType Block type settings.
* @param {string} innerHTML Original block markup.
*
* @return {string} Block markup.
*/
export function fixVariationClassname( blockAttributes, blockType, innerHTML ) {
if ( hasBlockSupport( blockType, 'className', true ) ) {
const activeVariation = getBlockTypeActiveVariation(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import {
fixCustomClassname,
getHTMLRootElementClasses,
} from '../fix-custom-classname';
} from '../fix-classnames';

describe( 'Fix custom className', () => {
const blockSettings = {
Expand Down

0 comments on commit cd945bd

Please sign in to comment.