-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add: button checks * add: button check for text and url * change: build files * fix: checking innerblocks for invalid * add: readme notes * fix: git action
- Loading branch information
1 parent
1027d26
commit 25206b6
Showing
19 changed files
with
134 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ name: Build Test | |
|
||
on: | ||
pull_request: | ||
branches: [develop] | ||
branches: [main] | ||
|
||
jobs: | ||
build: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
<?php return array('dependencies' => array('wp-block-editor', 'wp-components', 'wp-compose', 'wp-data', 'wp-element', 'wp-hooks', 'wp-i18n', 'wp-plugins'), 'version' => '12f443fb42d1eb70e4dd'); | ||
<?php return array('dependencies' => array('wp-block-editor', 'wp-components', 'wp-compose', 'wp-data', 'wp-element', 'wp-hooks', 'wp-i18n', 'wp-plugins'), 'version' => '84a825068ffd07f9034c'); |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
/* global BlockAccessibilityChecks */ | ||
import { __ } from '@wordpress/i18n'; | ||
const validationMode = | ||
BlockAccessibilityChecks.blockChecksOptions.coreButtonBlockCheck; | ||
|
||
/** | ||
* Checks the heading level of a block. | ||
* | ||
* @param {Object} block - The block object to be checked. | ||
* @return {Object} - The response object containing the validation result. | ||
*/ | ||
export function checkButtonAttributes(block) { | ||
if ( | ||
block.name === 'core/button' && | ||
!block.attributes.url && | ||
!block.attributes.text.originalHTML | ||
) { | ||
const response = { | ||
isValid: true, | ||
message: '', | ||
clientId: block.clientId, | ||
mode: validationMode, | ||
}; | ||
|
||
switch (validationMode) { | ||
case 'error': | ||
response.isValid = false; | ||
response.message = __( | ||
'Error: Buttons must have text and a link', | ||
'block-accessibility-checks' | ||
); | ||
break; | ||
case 'warning': | ||
response.isValid = false; | ||
response.message = __( | ||
'Warning: Buttons must have text and a link', | ||
'block-accessibility-checks' | ||
); | ||
break; | ||
case 'none': | ||
default: | ||
response.isValid = true; | ||
} | ||
|
||
return response; | ||
} | ||
|
||
return { isValid: true, mode: 'none' }; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.