2
0
Fork 0
mirror of https://github.com/discourse/discourse.git synced 2026-03-05 15:27:34 +08:00
discourse/spec/lib/wizard/wizard_step_spec.rb
Penar Musaraj efee8ea4fc
UX: One step wizard (#36082)
Consolidates all three wizard screens into one. Cleans up some leftover,
unused wizard elements (checkbox, image, canvas inputs).

Internal ticket: t/164852

<img width="2880" height="2376" alt="CleanShot 2025-11-25 at 10 35
43@2x"
src="https://github.com/user-attachments/assets/f824a172-38b0-4fda-922a-3732335b93b2"
/>

---------

Co-authored-by: Jordan Vidrine <jordan@jordanvidrine.com>
2025-11-25 13:35:32 -05:00

21 lines
656 B
Ruby

# frozen_string_literal: true
require "wizard"
RSpec.describe Wizard::Step do
let(:wizard) { Wizard.new(Fabricate.build(:user)) }
let(:step) { wizard.create_step("test-step") }
it "supports fields and options" do
expect(step.fields).to be_empty
text = step.add_field(id: "test", type: "text")
expect(step.fields).to eq([text])
dropdown = step.add_field(id: "snacks", type: "dropdown")
dropdown.add_choice("candy")
dropdown.add_choice("nachos", data: { color: "yellow" })
dropdown.add_choice("pizza", label: "Pizza!")
expect(step.fields).to eq([text, dropdown])
expect(dropdown.choices.size).to eq(3)
end
end