From 05e5369a434e8b0e3d9f2bd2db95b37caa66bb3f Mon Sep 17 00:00:00 2001 From: mhenrixon Date: Mon, 2 Dec 2024 16:05:51 +0200 Subject: [PATCH] chore(deps): bump phlex to 2.0.0.rc --- Gemfile.lock | 4 ++-- lib/phlexy_ui/collapsible_sub_menu.rb | 7 +++++-- lib/phlexy_ui/sub_menu.rb | 9 +++++++-- lib/phlexy_ui/tab.rb | 9 +++++++-- phlexy_ui.gemspec | 2 +- spec/spec_helper.rb | 2 +- spec/support/phlex_helpers.rb | 10 ++++++++++ 7 files changed, 33 insertions(+), 10 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index a2f35bd..6fe2a7a 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -2,7 +2,7 @@ PATH remote: . specs: phlexy_ui (0.1.22) - phlex (>= 1.10) + phlex (>= 2.0.0.rc1) zeitwerk (~> 2.6) GEM @@ -24,7 +24,7 @@ GEM parser (3.3.4.0) ast (~> 2.4.1) racc - phlex (1.11.0) + phlex (2.0.0.rc1) psych (5.1.2) stringio racc (1.8.1) diff --git a/lib/phlexy_ui/collapsible_sub_menu.rb b/lib/phlexy_ui/collapsible_sub_menu.rb index 444379b..3bbdfd9 100644 --- a/lib/phlexy_ui/collapsible_sub_menu.rb +++ b/lib/phlexy_ui/collapsible_sub_menu.rb @@ -3,8 +3,6 @@ module PhlexyUI # @private class CollapsibleSubMenu < Base - include Phlex::DeferredRender - def initialize(*, **) super @items ||= [] @@ -52,6 +50,11 @@ def item(*, **, &) private + def before_template(&) + vanish(&) + super + end + ATTRIBUTES_MAP = { open: true }.freeze diff --git a/lib/phlexy_ui/sub_menu.rb b/lib/phlexy_ui/sub_menu.rb index 476a0ee..fc53eee 100644 --- a/lib/phlexy_ui/sub_menu.rb +++ b/lib/phlexy_ui/sub_menu.rb @@ -3,8 +3,6 @@ module PhlexyUI # @private class SubMenu < Base - include Phlex::DeferredRender - def initialize(*, **) super @items ||= [] @@ -33,5 +31,12 @@ def title(&block) def item(*, **, &) @items << MenuItem.new(*, **, &) end + + private + + def before_template(&) + vanish(&) + super + end end end diff --git a/lib/phlexy_ui/tab.rb b/lib/phlexy_ui/tab.rb index 3249a16..d64e460 100644 --- a/lib/phlexy_ui/tab.rb +++ b/lib/phlexy_ui/tab.rb @@ -3,8 +3,6 @@ module PhlexyUI # @private class Tab < Base - include Phlex::DeferredRender - def initialize(*, id: nil, **) super(*, **) @id = id @@ -39,5 +37,12 @@ def content(*, **options, &) end end end + + private + + def before_template(&) + vanish(&) + super + end end end diff --git a/phlexy_ui.gemspec b/phlexy_ui.gemspec index bcdd9b8..a397e1e 100644 --- a/phlexy_ui.gemspec +++ b/phlexy_ui.gemspec @@ -14,7 +14,7 @@ Gem::Specification.new do |s| s.required_ruby_version = ">= 3.2" - s.add_dependency "phlex", ">= 1.10" + s.add_dependency "phlex", ">= 2.0.0.rc1" s.add_dependency "zeitwerk", "~> 2.6" s.add_development_dependency "standard", "~> 1.39.2" diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index acf6ff2..49c2706 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -2,7 +2,7 @@ Bundler.setup require "phlexy_ui" -require "phlex/testing/view_helper" +require "phlex/testing" Dir["./spec/support/**/*.rb"].each do |f| require f diff --git a/spec/support/phlex_helpers.rb b/spec/support/phlex_helpers.rb index 98c60e3..7d72ec4 100644 --- a/spec/support/phlex_helpers.rb +++ b/spec/support/phlex_helpers.rb @@ -10,6 +10,16 @@ def phlex_context(&) end end +module Phlex + module Testing + module ViewHelper + include Phlex::Testing::SGML + + alias render render_to_string + end + end +end + RSpec.configure do |config| config.include Phlex::Testing::ViewHelper config.include PhlexHelpers