Skip to content

A platform for community discussion. Free, open, simple.

FIX: Language dropdown in wizard should filter correctly (#34379)

Natalie Tay028c90dd5e7a
diff --git a/app/assets/javascripts/discourse/app/static/wizard/components/fields/dropdown.gjs b/app/assets/javascripts/discourse/app/static/wizard/components/fields/dropdown.gjs
index 0235d91f7d8..87594fc2aeb 100644
--- a/app/assets/javascripts/discourse/app/static/wizard/components/fields/dropdown.gjs
+++ b/app/assets/javascripts/discourse/app/static/wizard/components/fields/dropdown.gjs
@@ -99,15 +99,6 @@ export default class Dropdown extends Component {
}
}
- get nameProperty() {
- switch (this.args.field.id) {
- case "default_locale":
- return "name";
- default:
- return "label";
- }
- }
-
keyPress(event) {
event.stopPropagation();
}
@@ -123,9 +114,8 @@ export default class Dropdown extends Component {
class="wizard-container__dropdown"
- nameProperty=this.nameProperty
+ nameProperty="label"
tabindex="9"
- onChange=this.onChangeValue
options=(hash translatedNone=false)
}}
</template>
diff --git a/spec/system/page_objects/pages/wizard.rb b/spec/system/page_objects/pages/wizard.rb
index 57521c56939..efab8358742 100644
--- a/spec/system/page_objects/pages/wizard.rb
+++ b/spec/system/page_objects/pages/wizard.rb
@@ -35,6 +35,16 @@ module PageObjects
find_field(field_type, field_id).fill_in(with: value)
end
+ def select_dropdown_option(field_id, option_value)
+ droppdown =
+ PageObjects::Components::SelectKit.new(
+ ".wizard-container__field.dropdown-#{field_id} .wizard-container__dropdown",
+ )
+ droppdown.expand
+ droppdown.select_row_by_value(option_value)
+ droppdown.collapse
+ end
+
def has_field_with_value?(field_type, field_id, value)
find_field(field_type, field_id).find("input").value == value
end
diff --git a/spec/system/wizard_spec.rb b/spec/system/wizard_spec.rb
index bd4281574a2..d68e1a9ce58 100644
--- a/spec/system/wizard_spec.rb
+++ b/spec/system/wizard_spec.rb
@@ -11,6 +11,7 @@ describe "Wizard", type: :system do
visit("/wizard")
expect(wizard_page).to be_on_step("introduction")
wizard_page.fill_field("text", "title", "My Test Site")
+ wizard_page.select_dropdown_option("default-locale", "en")
wizard_page.go_to_next_step
expect(wizard_page).to be_on_step("privacy")
wizard_page.go_to_next_step