list_render test: Split out no-filtering test.

This commit is contained in:
Steve Howell 2020-04-24 20:16:39 +00:00 committed by showell
parent 2cded3f3df
commit 47c9f463db
1 changed files with 11 additions and 5 deletions

View File

@ -192,7 +192,7 @@ run_test('filtering', () => {
'fence', 'fence',
'grape', 'grape',
]; ];
let opts = { const opts = {
filter: { filter: {
element: search_input, element: search_input,
predicate: (item, value) => { predicate: (item, value) => {
@ -203,7 +203,7 @@ run_test('filtering', () => {
}; };
container.html = (html) => { assert.equal(html, ''); }; container.html = (html) => { assert.equal(html, ''); };
let widget = list_render.create(container, list, opts); const widget = list_render.create(container, list, opts);
let expected_html = let expected_html =
'<div>apple</div>' + '<div>apple</div>' +
@ -240,15 +240,21 @@ run_test('filtering', () => {
'<div>gary</div>' + '<div>gary</div>' +
'<div>giraffe</div>'; '<div>giraffe</div>';
assert.deepEqual(container.appended_data.html(), expected_html); assert.deepEqual(container.appended_data.html(), expected_html);
});
run_test('no filtering', () => {
const container = make_container();
make_scroll_container(container);
container.html = () => {};
// Opts does not require a filter key. // Opts does not require a filter key.
opts = { const opts = {
modifier: (item) => div(item), modifier: (item) => div(item),
}; };
widget = list_render.create(container, ['apple', 'banana'], opts); const widget = list_render.create(container, ['apple', 'banana'], opts);
widget.render(); widget.render();
expected_html = const expected_html =
'<div>apple</div>' + '<div>apple</div>' +
'<div>banana</div>'; '<div>banana</div>';
assert.deepEqual(container.appended_data.html(), expected_html); assert.deepEqual(container.appended_data.html(), expected_html);