mirror of https://github.com/zulip/zulip.git
pill_typeahead: Use query passed to source instead hacky this.
This commit is contained in:
parent
b4299d99fd
commit
9f83d14fb7
|
@ -40,9 +40,9 @@ export function set_up($input, pills, opts) {
|
|||
items: 5,
|
||||
fixed: true,
|
||||
dropup: true,
|
||||
source() {
|
||||
source(query) {
|
||||
let source = [];
|
||||
if (include_streams(this.query)) {
|
||||
if (include_streams(query)) {
|
||||
// If query starts with # we expect,
|
||||
// only stream suggestions so we simply
|
||||
// return stream source.
|
||||
|
|
|
@ -251,7 +251,7 @@ run_test("set_up", ({mock_template, override}) => {
|
|||
(function test_source() {
|
||||
let result;
|
||||
if (opts.stream) {
|
||||
result = config.source.call(fake_stream_this);
|
||||
result = config.source(fake_stream_this.query);
|
||||
const stream_ids = result.map((stream) => stream.stream_id);
|
||||
const expected_stream_ids = [denmark.stream_id, sweden.stream_id];
|
||||
assert.deepEqual(stream_ids, expected_stream_ids);
|
||||
|
@ -262,7 +262,7 @@ run_test("set_up", ({mock_template, override}) => {
|
|||
function is_group(item) {
|
||||
return item.members;
|
||||
}
|
||||
result = config.source.call(fake_person_this);
|
||||
result = config.source(fake_person_this.query);
|
||||
actual_result = result
|
||||
.map((item) => {
|
||||
if (is_group(item)) {
|
||||
|
|
Loading…
Reference in New Issue