mirror of
https://github.com/discourse/discourse.git
synced 2024-11-27 03:10:46 -06:00
FIX: prevents multi-select to use noneItem for its list (#17523)
This commit is contained in:
parent
fab1c00c8f
commit
c94a011d9f
@ -3,7 +3,7 @@ import { setupRenderingTest } from "discourse/tests/helpers/component-test";
|
|||||||
import { render } from "@ember/test-helpers";
|
import { render } from "@ember/test-helpers";
|
||||||
import { hbs } from "ember-cli-htmlbars";
|
import { hbs } from "ember-cli-htmlbars";
|
||||||
import selectKit from "discourse/tests/helpers/select-kit-helper";
|
import selectKit from "discourse/tests/helpers/select-kit-helper";
|
||||||
import { paste, query } from "discourse/tests/helpers/qunit-helpers";
|
import { exists, paste, query } from "discourse/tests/helpers/qunit-helpers";
|
||||||
|
|
||||||
const DEFAULT_CONTENT = [
|
const DEFAULT_CONTENT = [
|
||||||
{ id: 1, name: "foo" },
|
{ id: 1, name: "foo" },
|
||||||
@ -118,4 +118,18 @@ module("Integration | Component | select-kit/multi-select", function (hooks) {
|
|||||||
|
|
||||||
assert.equal(this.subject.header().value(), "1,2");
|
assert.equal(this.subject.header().value(), "1,2");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test("no value property with no content", async function (assert) {
|
||||||
|
setDefaultState(this);
|
||||||
|
|
||||||
|
await render(hbs`
|
||||||
|
<MultiSelect @valueProperty={{null}} />
|
||||||
|
`);
|
||||||
|
await this.subject.expand();
|
||||||
|
|
||||||
|
assert.notOk(
|
||||||
|
exists(".selected-content"),
|
||||||
|
"it doesn’t render an empty content div"
|
||||||
|
);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
@ -156,7 +156,7 @@ export default SelectKitComponent.extend({
|
|||||||
return this.selectKit.modifySelection(content);
|
return this.selectKit.modifySelection(content);
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.selectKit.noneItem;
|
return null;
|
||||||
}
|
}
|
||||||
),
|
),
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
{{d-icon icon}}
|
{{d-icon icon}}
|
||||||
{{/each}}
|
{{/each}}
|
||||||
|
|
||||||
<MultiSelect::FormatSelectedContent @content={{this.selectedContent}} @selectKit={{this.selectKit}} />
|
<MultiSelect::FormatSelectedContent @content={{or this.selectedContent this.selectKit.noneItem}} @selectKit={{this.selectKit}} />
|
||||||
|
|
||||||
{{d-icon this.caretIcon class="caret-icon"}}
|
{{d-icon this.caretIcon class="caret-icon"}}
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user