Skip to content

Commit

Permalink
Add amp prefix to element IDs
Browse files Browse the repository at this point in the history
  • Loading branch information
westonruter committed Dec 14, 2021
1 parent 19ffbfd commit 090fb5d
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 11 deletions.
8 changes: 4 additions & 4 deletions assets/src/amp-validation/counts/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ function setMenuItemCountValue( itemId, count ) {
* Initializes the 'Validated URLs' and 'Error Index' menu items.
*/
function initializeMenuItemCounts() {
setMenuItemIsLoading( 'new-error-index-count' );
setMenuItemIsLoading( 'new-validation-url-count' );
setMenuItemIsLoading( 'amp-new-error-index-count' );
setMenuItemIsLoading( 'amp-new-validation-url-count' );
}

/**
Expand All @@ -71,8 +71,8 @@ function initializeMenuItemCounts() {
function updateMenuItemCounts( counts ) {
const { validated_urls: newValidatedUrlCount, errors: newErrorCount } = counts;

setMenuItemCountValue( 'new-error-index-count', newErrorCount );
setMenuItemCountValue( 'new-validation-url-count', newValidatedUrlCount );
setMenuItemCountValue( 'amp-new-error-index-count', newErrorCount );
setMenuItemCountValue( 'amp-new-validation-url-count', newValidatedUrlCount );
}

/**
Expand Down
4 changes: 2 additions & 2 deletions assets/src/amp-validation/counts/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
display: inline-block;
}

body.no-js #new-validation-url-count,
body.no-js #new-error-index-count {
body.no-js #amp-new-validation-url-count,
body.no-js #amp-new-error-index-count {
display: none;
}
2 changes: 1 addition & 1 deletion includes/validation/class-amp-validated-url-post-type.php
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,7 @@ public static function update_validated_url_menu_item() {

if ( ValidationCounts::is_needed() ) {
// Append markup to display a loading spinner while the unreviewed count is being fetched.
$submenu_item[0] .= ' <span id="new-validation-url-count"></span>';
$submenu_item[0] .= ' <span id="amp-new-validation-url-count"></span>';
}

break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1745,7 +1745,7 @@ public static function add_admin_menu_validation_error_item() {

if ( ValidationCounts::is_needed() ) {
// Append markup to display a loading spinner while the unreviewed count is being fetched.
$menu_item_label .= ' <span id="new-error-index-count"></span>';
$menu_item_label .= ' <span id="amp-new-error-index-count"></span>';
}

$post_menu_slug = 'edit.php?post_type=' . AMP_Validated_URL_Post_Type::POST_TYPE_SLUG;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ public function test_update_validated_url_menu_item() {

AMP_Validated_URL_Post_Type::update_validated_url_menu_item();
if ( Services::get( 'dependency_support' )->has_support() ) {
$this->assertSame( 'Validated URLs <span id="new-validation-url-count"></span>', $submenu[ AMP_Options_Manager::OPTION_NAME ][2][0] );
$this->assertSame( 'Validated URLs <span id="amp-new-validation-url-count"></span>', $submenu[ AMP_Options_Manager::OPTION_NAME ][2][0] );
} else {
$this->assertSame( 'Validated URLs', $submenu[ AMP_Options_Manager::OPTION_NAME ][2][0] );
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1034,8 +1034,8 @@ public function test_add_admin_menu_validation_error_item() {
'Error Index',
];
if ( Services::get( 'dependency_support' )->has_support() ) {
$expected_submenu[0] .= ' <span id="new-error-index-count"></span>';
$expected_submenu[3] .= ' <span id="new-error-index-count"></span>';
$expected_submenu[0] .= ' <span id="amp-new-error-index-count"></span>';
$expected_submenu[3] .= ' <span id="amp-new-error-index-count"></span>';
}
$amp_options = $submenu[ AMP_Options_Manager::OPTION_NAME ];
$this->assertEquals( $expected_submenu, end( $amp_options ) );
Expand Down

0 comments on commit 090fb5d

Please sign in to comment.