Describe the bug
The user guide is pretty unambiguous what the definition of a scenario is:
Each public method defined in the preview class represents a unique scenario [...]
Source: https://lookbook.build/guide/concepts#scenarios
However, when I call Lookbook.preview.first.scenarios, I get a Lookbook::ScenarioCollection that contains Lookbook::ScenarioEntity AND Lookbook::ScenarioGroupEntity.
To Reproduce
class TestComponentPreview < ViewComponent::Preview
# @!group Scenario Group
def scenario_a
render TestComponent.new
end
def scenario_b
render TestComponent.new
end
# @!endgroup
end
This results in:
Lookbook.previews.first.scenarios.map(&:name)
# => ["scenario_group"]
However, scenario_group is not a method on my TestComponentPreview.
Expected behavior
Lookbook.previews.first.scenarios.map(&:name)
# => ["scenario_a", "scenario_b"]
Screenshots
Version numbers
Please complete the following information:
- Lookbook: 2.3.14
- ViewComponent: 4.6.0
- Rails: 8.1.3
- Ruby: 4.0.1
Additional context
As I workaround, I can fall back to the protected method scenario_entities:
Lookbook.previews.first.send(:scenario_entities).map(&:name)
# => ["scenario_a", "scenario_b"]
Describe the bug
The user guide is pretty unambiguous what the definition of a scenario is:
However, when I call
Lookbook.preview.first.scenarios, I get aLookbook::ScenarioCollectionthat containsLookbook::ScenarioEntityANDLookbook::ScenarioGroupEntity.To Reproduce
This results in:
However,
scenario_groupis not a method on myTestComponentPreview.Expected behavior
Screenshots
Version numbers
Please complete the following information:
Additional context
As I workaround, I can fall back to the protected method
scenario_entities: