Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
1 change: 1 addition & 0 deletions src/js/_enqueues/wp/code-editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ if ( 'undefined' === typeof window.wp.codeEditor ) {
* @property {boolean} [src-not-empty] - Src not empty rules.
* @property {boolean} [attr-no-duplication] - Attribute no duplication rules.
* @property {boolean} [alt-require] - Alt require rules.
* @property {boolean} [input-requires-label] - Input requires label rules.
* @property {string} [space-tab-mixed-disabled] - Space tab mixed disabled rules.
* @property {boolean} [attr-unsafe-chars] - Attribute unsafe chars rules.
* @property {JSHintRules} [jshint] - JSHint rules.
Expand Down
1 change: 1 addition & 0 deletions src/wp-includes/general-template.php
Original file line number Diff line number Diff line change
Expand Up @@ -4201,6 +4201,7 @@ function wp_get_code_editor_settings( $args ) {
'src-not-empty' => true,
'attr-no-duplication' => true,
'alt-require' => true,
'input-requires-label' => true,
'space-tab-mixed-disabled' => 'tab',
'attr-unsafe-chars' => true,
),
Expand Down
19 changes: 19 additions & 0 deletions tests/phpunit/tests/dependencies/scripts.php
Original file line number Diff line number Diff line change
Expand Up @@ -3185,6 +3185,7 @@ public function test_wp_enqueue_code_editor_when_php_file_will_be_passed() {
'src-not-empty',
'attr-no-duplication',
'alt-require',
'input-requires-label',
'space-tab-mixed-disabled',
'attr-unsafe-chars',
),
Expand Down Expand Up @@ -3268,6 +3269,7 @@ public function test_wp_enqueue_code_editor_when_generated_array_by_compact_will
'src-not-empty',
'attr-no-duplication',
'alt-require',
'input-requires-label',
'space-tab-mixed-disabled',
'attr-unsafe-chars',
),
Expand Down Expand Up @@ -3365,6 +3367,7 @@ public function test_wp_enqueue_code_editor_when_generated_array_by_array_merge_
'src-not-empty',
'attr-no-duplication',
'alt-require',
'input-requires-label',
'space-tab-mixed-disabled',
'attr-unsafe-chars',
),
Expand Down Expand Up @@ -3459,13 +3462,29 @@ public function test_wp_enqueue_code_editor_when_simple_array_will_be_passed() {
'src-not-empty',
'attr-no-duplication',
'alt-require',
'input-requires-label',
'space-tab-mixed-disabled',
'attr-unsafe-chars',
),
array_keys( $wp_enqueue_code_editor['htmlhint'] )
);
}

/**
* Tests that the `input-requires-label` HTMLHint rule is enabled by default
* in `wp_get_code_editor_settings()` for accessibility linting.
*
* @ticket 42780
*
* @covers ::wp_get_code_editor_settings
*/
public function test_wp_get_code_editor_settings_input_requires_label_rule_is_enabled() {
$settings = wp_get_code_editor_settings( array( 'type' => 'text/html' ) );

$this->assertArrayHasKey( 'input-requires-label', $settings['htmlhint'] );
$this->assertTrue( $settings['htmlhint']['input-requires-label'] );
}

/**
* @ticket 52534
*
Expand Down
Loading