Show tag dropdown for Sidebar Right (Individual Post) location (#18779)

This commit is contained in:
Ben Halpern 2022-11-28 14:16:27 -05:00 committed by GitHub
parent 62fbb2f5fe
commit 24cf767c9c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 4 deletions

View file

@ -81,13 +81,13 @@ function defaultTagValues() {
*/
document.ready.then(() => {
const select = document.getElementsByClassName('js-placement-area')[0];
if (select.value === 'post_comments') {
const placementAreasWithTags = ['post_comments', 'post_sidebar']
if (placementAreasWithTags.includes(select.value)) {
showTagsField();
}
select.addEventListener('change', (event) => {
if (event.target.value === 'post_comments') {
if (placementAreasWithTags.includes(event.target.value)) {
showTagsField();
} else {
hideTagsField();

View file

@ -12,7 +12,7 @@ describe('Create Display Ads', () => {
});
});
it('should not show the tags field if the placement is not "Below the comment section"', () => {
it('should not show the tags field if the placement is not one of the post page areas', () => {
cy.findByRole('combobox', { name: 'Placement Area:' }).select(
'Sidebar Right (Home)',
);
@ -25,5 +25,13 @@ describe('Create Display Ads', () => {
);
cy.findByLabelText('Targeted Tag(s)').should('exist');
});
it('should show the tags field if the placement is "Sidebar Right (Individual Post)"', () => {
cy.findByRole('combobox', { name: 'Placement Area:' }).select(
'Sidebar Right (Individual Post)',
);
cy.findByLabelText('Targeted Tag(s)').should('exist');
});
});
});