DEV: Change sidebar header dropdown to use wait_for_animation (#20627)

* DEV: Change sidebar header dropdown to use wait_for_animation

Introduced in 54351e1b8a, this
helper should remove the need to have to add the .animated
CSS class in JS for the sidebar.

* DEV: Revert spec change
This commit is contained in:
Martin Brennan 2023-03-10 14:54:57 +10:00 committed by GitHub
parent 5893ad46ba
commit 168de52538
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 5 additions and 8 deletions

View File

@ -78,7 +78,6 @@ const SiteHeaderComponent = MountWidget.extend(
headerCloak.classList.add("animate"); headerCloak.classList.add("animate");
this._scheduledRemoveAnimate = discourseLater(() => { this._scheduledRemoveAnimate = discourseLater(() => {
panel.classList.remove("animate"); panel.classList.remove("animate");
panel.classList.add("animated");
headerCloak.classList.remove("animate"); headerCloak.classList.remove("animate");
}, 200); }, 200);
panel.style.setProperty("--offset", 0); panel.style.setProperty("--offset", 0);
@ -90,7 +89,6 @@ const SiteHeaderComponent = MountWidget.extend(
this._animate = true; this._animate = true;
const headerCloak = document.querySelector(".header-cloak"); const headerCloak = document.querySelector(".header-cloak");
panel.classList.add("animate"); panel.classList.add("animate");
panel.classList.remove("animated");
headerCloak.classList.add("animate"); headerCloak.classList.add("animate");
if (menuOrigin === "left") { if (menuOrigin === "left") {
panel.style.setProperty("--offset", `-100vw`); panel.style.setProperty("--offset", `-100vw`);

View File

@ -3,8 +3,6 @@
module PageObjects module PageObjects
module Pages module Pages
class ChatChannel < PageObjects::Pages::Base class ChatChannel < PageObjects::Pages::Base
include SystemHelpers
def type_in_composer(input) def type_in_composer(input)
find(".chat-composer-input").send_keys(input) find(".chat-composer-input").send_keys(input)
end end

View File

@ -5,6 +5,7 @@ module PageObjects
class Base class Base
include Capybara::DSL include Capybara::DSL
include RSpec::Matchers include RSpec::Matchers
include SystemHelpers
end end
end end
end end

View File

@ -5,9 +5,7 @@ module PageObjects
class SidebarHeaderDropdown < PageObjects::Components::Base class SidebarHeaderDropdown < PageObjects::Components::Base
def click def click
page.find(".hamburger-dropdown").click page.find(".hamburger-dropdown").click
wait_for_animation(find(".menu-panel"), timeout: 5)
# `.animated` is important here because we want to wait until dropdown has finished its animation completely
page.has_css?(".menu-panel.animated")
self self
end end

View File

@ -4,6 +4,8 @@ module PageObjects
module Pages module Pages
class Base class Base
include Capybara::DSL include Capybara::DSL
include RSpec::Matchers
include SystemHelpers
end end
end end
end end

View File

@ -5,7 +5,7 @@ describe "Viewing sidebar", type: :system, js: true do
fab!(:user) { Fabricate(:user) } fab!(:user) { Fabricate(:user) }
fab!(:category_sidebar_section_link) { Fabricate(:category_sidebar_section_link, user: user) } fab!(:category_sidebar_section_link) { Fabricate(:category_sidebar_section_link, user: user) }
before_all { sign_in(user) } before { sign_in(user) }
describe "when using the legacy navigation menu" do describe "when using the legacy navigation menu" do
before { SiteSetting.navigation_menu = "legacy" } before { SiteSetting.navigation_menu = "legacy" }