Skip to content

Commit

Permalink
test: add missing data provider tests (#7463)
Browse files Browse the repository at this point in the history
  • Loading branch information
vursen committed May 31, 2024
1 parent eb3dfaf commit 9d54e95
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions packages/combo-box/test/data-provider.common.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 9d54e95

Please sign in to comment.