mirror of
https://github.com/zulip/zulip.git
synced 2025-11-02 21:13:36 +00:00
list_render: Remove requirement of filter in opts.
The use case for this are small or fixed tables, which do not need filtering support. Thus we are able to not include the unnecessary search input inside the html parent container. It is not used at present, but will be required when we refactor the settings pages. We also split out exports.validate_filter function for unit testing the above condition.
This commit is contained in:
@@ -108,7 +108,7 @@ run_test('list_render', () => {
|
||||
'fence',
|
||||
'grape',
|
||||
];
|
||||
const opts = {
|
||||
let opts = {
|
||||
filter: {
|
||||
element: search_input,
|
||||
predicate: (item, value) => {
|
||||
@@ -119,7 +119,7 @@ run_test('list_render', () => {
|
||||
modifier: (item) => div(item),
|
||||
};
|
||||
|
||||
const widget = list_render.create(container, list, opts);
|
||||
let widget = list_render.create(container, list, opts);
|
||||
|
||||
widget.render();
|
||||
|
||||
@@ -160,6 +160,17 @@ run_test('list_render', () => {
|
||||
widget.render();
|
||||
expected_html = '<div>greta</div><div>gary</div>';
|
||||
assert.deepEqual(container.appended_data.html(), expected_html);
|
||||
|
||||
// Opts does not require a filter key.
|
||||
opts = {
|
||||
modifier: (item) => div(item),
|
||||
};
|
||||
list_render.validate_filter(opts);
|
||||
widget = list_render.create(container, ['apple', 'banana'], opts);
|
||||
widget.render();
|
||||
|
||||
expected_html = '<div>apple</div><div>banana</div>';
|
||||
assert.deepEqual(container.appended_data.html(), expected_html);
|
||||
});
|
||||
|
||||
function sort_button(opts) {
|
||||
|
||||
Reference in New Issue
Block a user