From 9d54e95f32f046ae1e8b63ac4736da70acc69ca1 Mon Sep 17 00:00:00 2001 From: Sergey Vinogradov Date: Fri, 31 May 2024 16:43:39 +0300 Subject: [PATCH] test: add missing data provider tests (#7463) --- .../combo-box/test/data-provider.common.js | 43 +++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/packages/combo-box/test/data-provider.common.js b/packages/combo-box/test/data-provider.common.js index 93ae597e78..f84dfdedb0 100644 --- a/packages/combo-box/test/data-provider.common.js +++ b/packages/combo-box/test/data-provider.common.js @@ -504,6 +504,27 @@ const TEMPLATES = { }); }); + describe('dataProvider is set before attach', () => { + beforeEach(async () => { + comboBox = document.createElement(tag); + comboBox.dataProvider = spyDataProvider; + document.body.appendChild(comboBox); + await nextRender(); + }); + + afterEach(() => { + document.body.removeChild(comboBox); + }); + + it('should have undefined size', () => { + expect(comboBox.size).to.be.undefined; + }); + + it('should have empty filteredItems', () => { + expect(comboBox.filteredItems).to.have.lengthOf(0); + }); + }); + describe('pageSize', () => { it('should have default value', () => { expect(typeof comboBox.pageSize).to.equal('number'); @@ -658,6 +679,28 @@ const TEMPLATES = { }); }); + describe('size is set before attach', () => { + beforeEach(async () => { + comboBox = document.createElement(tag); + comboBox.dataProvider = spyDataProvider; + comboBox.size = SIZE; + document.body.appendChild(comboBox); + await nextRender(); + }); + + afterEach(() => { + document.body.removeChild(comboBox); + }); + + it('should have size', () => { + expect(comboBox.size).to.equal(SIZE); + }); + + it('should have filteredItems', () => { + expect(comboBox.filteredItems).to.have.lengthOf(SIZE); + }); + }); + describe('value (string items)', () => { beforeEach(() => { comboBox.dataProvider = dataProvider;