FEATURE: Add modal for editing tags in navigation menu (#22214)

What does this change do?

This change is a first pass for adding a modal used to edit tags that appears in
the navigation menu. As the feature is being worked on in phases, it is
currently hidden behind the `new_edit_sidebar_categories_tags_interface_groups` site setting.

The following features will be worked on in future commits:

1. Input filter to filter through the tgas
2. Button to reset tag selection to default navigation menu tags site
   settings
3. Button to deselect all current selection
This commit is contained in:
Alan Guo Xiang Tan
2023-06-21 09:09:56 +08:00
committed by GitHub
parent 1987fce018
commit 08d8bd9f43
17 changed files with 272 additions and 4 deletions

View File

@ -0,0 +1,37 @@
# frozen_string_literal: true
module PageObjects
module Modals
class SidebarEditTags < PageObjects::Modals::Base
def closed?
has_no_css?(".sidebar-tags-form-modal")
end
def has_right_title?(title)
has_css?(".sidebar-tags-form-modal #discourse-modal-title", text: title)
end
def has_tag_checkboxes?(tags)
tag_names = tags.map(&:name)
has_css?(".sidebar-tags-form-modal .sidebar-tags-form__tag", count: tag_names.length) &&
all(".sidebar-tags-form-modal .sidebar-tags-form__tag").all? do |row|
tag_names.include?(row["data-tag-name"].to_s)
end
end
def toggle_tag_checkbox(tag)
find(
".sidebar-tags-form-modal .sidebar-tags-form__tag[data-tag-name='#{tag.name}'] .sidebar-tags-form__input",
).click
self
end
def save
find(".sidebar-tags-form-modal .sidebar-tags-form__save-button").click
self
end
end
end
end