From f9559b6c8ab642d55093528851c2d56902586167 Mon Sep 17 00:00:00 2001 From: Sergey Vinogradov Date: Fri, 17 May 2024 14:43:50 +0300 Subject: [PATCH] test: add missing data provider tests (#7425) --- packages/combo-box/test/lazy-loading.common.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/packages/combo-box/test/lazy-loading.common.js b/packages/combo-box/test/lazy-loading.common.js index efd05954c6..50405b9e05 100644 --- a/packages/combo-box/test/lazy-loading.common.js +++ b/packages/combo-box/test/lazy-loading.common.js @@ -618,6 +618,18 @@ describe('lazy loading', () => { expect(comboBox.size).to.equal(SIZE); }); + it('should not add items exceeding the size returned by dataProvider', () => { + comboBox.dataProvider = (params, callback) => callback(['foo', 'bar'], 1); + comboBox.opened = true; + expect(comboBox.filteredItems).to.eql(['foo']); + }); + + it('should add items when dataProvider return size undefined', () => { + comboBox.dataProvider = (params, callback) => callback(['foo', 'bar'], undefined); + comboBox.opened = true; + expect(comboBox.filteredItems).to.eql(['foo', 'bar']); + }); + it('should remove extra filteredItems when decreasing size', () => { comboBox.dataProvider = (params, callback) => callback(['foo', 'bar'], 2); comboBox.open();