Skip to content

Commit

Permalink
Update to use state instead of command_state (#52)
Browse files Browse the repository at this point in the history
* Update to use state instead of command_state

* Update deps

* Update packages
  • Loading branch information
hopsoft authored May 17, 2024
1 parent 08672fd commit fdd236e
Show file tree
Hide file tree
Showing 4 changed files with 145 additions and 600 deletions.
6 changes: 2 additions & 4 deletions app/commands/turbo_boost/elements/toggle_command.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,21 +33,19 @@ def validate_element!

def validate_element_attributes!
case element
in {renders: _, morphs: _} then return true
in {renders: _, morphs: _} then true
in {renders: _} then raise TurboBoost::Commands::InvalidElementError, "The trigger element is missing the `morphs` attribute!"
in {morphs: _} then raise TurboBoost::Commands::InvalidElementError, "The trigger element is missing the `renders` attribute!"
else raise TurboBoost::Commands::InvalidCommandError, "The trigger element is missing the `renders` and `moprhs` attributes!"
end
false
end

def validate_element_aria_attributes!
case element.aria
in {controls: _, expanded: _} then return true
in {controls: _, expanded: _} then true
in {controls: _} then raise TurboBoost::Commands::InvalidElementError, "The trigger element is missing the `aria-expanded` attribute!"
in {expanded: _} then raise TurboBoost::Commands::InvalidElementError, "The trigger element is missing the `aria-controls` attribute!"
else raise TurboBoost::Commands::InvalidElementError, "The trigger element is missing the `aria-controls` and `aria-expanded` attributes!"
end
false
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ def target_tag(
end

def target_expanded?(dom_id)
!!controller_pack.command_state[dom_id]
!!controller_pack.state[dom_id]
end

def target_collapsed?(dom_id)
Expand Down
Loading

0 comments on commit fdd236e

Please sign in to comment.