mirror of
https://github.com/discourse/discourse.git
synced 2024-12-26 16:33:47 +08:00
cbc0ece6e8
`<DSelect />` is a wrapper similar to our existing `<DButton />` over the html element `<select>`. The code is ported from form kit which is now directly using `<DSelect />`. Note this component has also been used in edit topic timer modal. This component is recommended for a small list of text items (no icons, no rich formatting...). Usage: ```gjs <DSelect class="my-select" @onChange={{this.handleChange}} as |select|> <select.Option @value="foo" class="my-favorite-option">Foo</select.Option> <select.Option @value="bar">Bar</select.Option> </DSelect> ``` This commit comes with a set of assertions: ```gjs import dselect from "discourse/tests/helpers/d-select-helper"; import { select } from "@ember/test-helpers"; assert .dselect(".my-select") .hasOption({ value: "bar", label: "Bar" }) .hasOption({ value: "foo", label: "Foo" }) .hasNoOption("baz"); await select(".my-select", "foo"); assert.dselect(".my-select").hasSelectedOption({value: "foo", label: "Foo"}); ``` |
||
---|---|---|
.. | ||
_alert.scss | ||
_char-counter.scss | ||
_checkbox-group.scss | ||
_col.scss | ||
_collection.scss | ||
_conditional-display.scss | ||
_container.scss | ||
_control-checkbox.scss | ||
_control-code.scss | ||
_control-composer.scss | ||
_control-custom-value-list.scss | ||
_control-custom.scss | ||
_control-icon.scss | ||
_control-image.scss | ||
_control-input-group.scss | ||
_control-input.scss | ||
_control-menu.scss | ||
_control-password.scss | ||
_control-radio.scss | ||
_control-select.scss | ||
_control-textarea.scss | ||
_default-input-mixin.scss | ||
_errors-summary.scss | ||
_errors.scss | ||
_field.scss | ||
_fieldset.scss | ||
_form-kit.scss | ||
_index.scss | ||
_meta.scss | ||
_row.scss | ||
_section.scss | ||
_variables.scss |