0
0
Fork 0
mirror of https://github.com/discourse/discourse.git synced 2026-08-08 17:53:55 +08:00
discourse/spec/integrity/admin_onboarding_locale_spec.rb
Keegan George 9866827083
DEV: Code review and fixes
- Don't fire the onboarding step's completion callback against a destroyed
  component. Previewing a homepage routes away from the banner, so the step
  hands its callback back on teardown and the service falls back to writing
  the store key and audit event itself.
- Make the collapsed banner's "x of 3 steps completed" count reactive. It was
  reading the key value store, which doesn't trigger a re-render.
- Stop memoizing a font stack probed before the stylesheet that defines the
  font classes has loaded, which pinned the wrong font for the page's lifetime.
- Add the missing `start_posting.completed` label, which rendered as a raw
  i18n key once the step was done, plus an integrity spec so a step can't ship
  without both labels. Sentence case for the other two step titles.
- Collapse the eight site setting steps in DesignWizard::Apply into one that
  iterates the hash the contract already builds.
- Move the wizard's stylesheet link handling into color-scheme-manager so all
  the light/dark link knowledge lives in one place.
- Give the step dots their own class instead of borrowing the image carousel's,
  and put the panel on its own z-layer below modals so dialogs behind it stay
  reachable.
- Dock the panel to the bottom edge on narrow viewports. A full height side
  rail covered the page it's meant to be previewing.
- Pull the hardcoded base-light values in design-wizard.scss into named
  variables so each one is declared once.
- Drop the dead --design-wizard-chrome-font-size plumbing.
- Note why update_palette_selectability resets everything and why update_all
  is safe there.
- Tests: specs for PalettePairs and ResolvePalette, the user selectable palette
  toggle in both directions, a failed progress save, and the case where there
  are no palettes to offer. Fixed a viewport assertion that couldn't fail and
  a link cleanup that leaked between tests.
2026-08-06 11:41:03 -07:00

30 lines
930 B
Ruby
Vendored

# frozen_string_literal: true
RSpec.describe "Admin onboarding banner locale keys" do
# OnboardingStep#buttonLabel switches between `action` and `completed`, so a
# step missing either one renders the raw key in the banner.
let(:steps) do
File
.read("frontend/discourse/app/components/admin-onboarding/banner.gjs")
.scan(/static name = "(\w+)"/)
.flatten
end
let(:banner) do
YAML.load_file("config/locales/client.en.yml").dig("en", "js", "admin_onboarding_banner")
end
it "finds the steps defined by the banner" do
expect(steps).to include("select_theme")
end
it "defines title, description, action and completed for every step" do
missing =
steps.each_with_object({}) do |step, hash|
absent = %w[title description action completed] - (banner[step]&.keys || [])
hash[step] = absent if absent.present?
end
expect(missing).to eq({})
end
end