Skip to content

Commit

Permalink
revert: test(*): adjust tests #3519
Browse files Browse the repository at this point in the history
This reverts commit c3a5438.

# Conflicts:
#	projects/igniteui-angular/src/lib/combo/combo.component.spec.ts
  • Loading branch information
DiyanDimitrov committed Jan 28, 2019
1 parent 115eafb commit 710698f
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 26 deletions.
18 changes: 9 additions & 9 deletions projects/igniteui-angular/src/lib/combo/combo.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,7 @@ describe('igxCombo', () => {
const dropdownList = fixture.debugElement.query(By.css('.' + CSS_CLASS_DROPDOWNLIST)).nativeElement;
expect(dropdownList.classList.contains(CSS_CLASS_TOGGLE)).toBeTruthy();
const dropdownItems = dropdownList.querySelectorAll('.' + CSS_CLASS_DROPDOWNLISTITEM);
expect(dropdownItems.length).toEqual(12);
expect(dropdownItems.length).toEqual(11);
comboButton.click();
tick();
fixture.detectChanges();
Expand Down Expand Up @@ -652,7 +652,7 @@ describe('igxCombo', () => {
dropdownContainer = fixture.debugElement.query(By.css('.' + CSS_CLASS_CONTAINER)).nativeElement;
firstVisibleItem = dropdownContainer.querySelector('.' + CSS_CLASS_DROPDOWNLISTITEM + ':first-child');
lastVisibleItem = dropdownContainer.querySelector('.' + CSS_CLASS_DROPDOWNLISTITEM + ':last-child');
expect(firstVisibleItem.textContent.trim()).toEqual(combo.data[combo.data.length - 12]);
expect(firstVisibleItem.textContent.trim()).toEqual(combo.data[combo.data.length - 11]);
expect(lastVisibleItem.textContent.trim()).toEqual(combo.data[combo.data.length - 1]);
expect(firstVisibleItem.classList.contains(CSS_CLASS_FOCUSED)).toBeFalsy();
expect(lastVisibleItem.classList.contains(CSS_CLASS_FOCUSED)).toBeTruthy();
Expand All @@ -664,7 +664,7 @@ describe('igxCombo', () => {
firstVisibleItem = dropdownContainer.querySelector('.' + CSS_CLASS_DROPDOWNLISTITEM + ':first-child');
lastVisibleItem = dropdownContainer.querySelector('.' + CSS_CLASS_DROPDOWNLISTITEM + ':last-child');
expect(firstVisibleItem.textContent.trim()).toEqual(combo.data[0]);
expect(lastVisibleItem.textContent.trim()).toEqual(combo.data[11]);
expect(lastVisibleItem.textContent.trim()).toEqual(combo.data[10]);
combo.dropdown.verticalScrollContainer.scrollTo(10);
setTimeout(function () {
fixture.detectChanges();
Expand All @@ -673,15 +673,15 @@ describe('igxCombo', () => {
lastVisibleItem = dropdownContainer.querySelector('.' + CSS_CLASS_DROPDOWNLISTITEM + ':last-child');
expect(firstVisibleItem.classList.contains(CSS_CLASS_FOCUSED)).toBeFalsy();
expect(lastVisibleItem.classList.contains(CSS_CLASS_FOCUSED)).toBeTruthy();
expect(lastVisibleItem.textContent.trim()).toEqual(combo.data[12]);
expect(lastVisibleItem.textContent.trim()).toEqual(combo.data[11]);
dropdownContent.dispatchEvent(homeEvent);
setTimeout(function () {
fixture.detectChanges();
dropdownContainer = fixture.debugElement.query(By.css('.' + CSS_CLASS_CONTAINER)).nativeElement;
firstVisibleItem = dropdownContainer.querySelector('.' + CSS_CLASS_DROPDOWNLISTITEM + ':first-child');
lastVisibleItem = dropdownContainer.querySelector('.' + CSS_CLASS_DROPDOWNLISTITEM + ':last-child');
expect(firstVisibleItem.textContent.trim()).toEqual(combo.data[0]);
expect(lastVisibleItem.textContent.trim()).toEqual(combo.data[11]);
expect(lastVisibleItem.textContent.trim()).toEqual(combo.data[10]);
expect(firstVisibleItem.classList.contains(CSS_CLASS_FOCUSED)).toBeTruthy();
expect(lastVisibleItem.classList.contains(CSS_CLASS_FOCUSED)).toBeFalsy();
expect(scrollbar.scrollTop).toEqual(0);
Expand Down Expand Up @@ -714,7 +714,7 @@ describe('igxCombo', () => {
dropdownContainer = fixture.debugElement.query(By.css('.' + CSS_CLASS_CONTAINER)).nativeElement;
firstVisibleItem = dropdownContainer.querySelector('.' + CSS_CLASS_DROPDOWNLISTITEM + ':first-child');
lastVisibleItem = dropdownContainer.querySelector('.' + CSS_CLASS_DROPDOWNLISTITEM + ':last-child');
expect(firstVisibleItem.textContent.trim()).toEqual(combo.data[combo.data.length - 12]);
expect(firstVisibleItem.textContent.trim()).toEqual(combo.data[combo.data.length - 11]);
expect(lastVisibleItem.textContent.trim()).toEqual(combo.data[combo.data.length - 1]);
expect(firstVisibleItem.classList.contains(CSS_CLASS_FOCUSED)).toBeFalsy();
expect(lastVisibleItem.classList.contains(CSS_CLASS_FOCUSED)).toBeTruthy();
Expand All @@ -730,7 +730,7 @@ describe('igxCombo', () => {
dropdownContainer = fixture.debugElement.query(By.css('.' + CSS_CLASS_CONTAINER)).nativeElement;
firstVisibleItem = dropdownContainer.querySelector('.' + CSS_CLASS_DROPDOWNLISTITEM + ':first-child');
lastVisibleItem = dropdownContainer.querySelector('.' + CSS_CLASS_DROPDOWNLISTITEM + ':last-child');
expect(firstVisibleItem.textContent.trim()).toEqual(combo.data[combo.data.length - 12]);
expect(firstVisibleItem.textContent.trim()).toEqual(combo.data[combo.data.length - 11]);
expect(lastVisibleItem.textContent.trim()).toEqual(combo.data[combo.data.length - 1]);
expect(scrollbar.scrollHeight - scrollbar.scrollTop).toEqual(scrollbar.clientHeight);
expect(firstVisibleItem.classList.contains(CSS_CLASS_FOCUSED)).toBeFalsy();
Expand Down Expand Up @@ -1139,7 +1139,7 @@ describe('igxCombo', () => {
const fixture = TestBed.createComponent(IgxComboTestComponent);
fixture.detectChanges();
const combo = fixture.componentInstance.combo;
const expectedOutput = combo.data[3] + ', ' + combo.data[7] + ', ' + combo.data[1] + ', ' + combo.data[10];
const expectedOutput = combo.data[3] + ', ' + combo.data[7] + ', ' + combo.data[1] + ', ' + combo.data[11];
const comboButton = fixture.debugElement.query(By.css('.' + CSS_CLASS_DROPDOWNBUTTON)).nativeElement;
comboButton.click();
fixture.detectChanges();
Expand Down Expand Up @@ -2258,7 +2258,7 @@ describe('igxCombo', () => {
fix.detectChanges();
expect(combo.collapsed).toBeFalsy();
expect(combo.dropdown.headers).toBeDefined();
expect(combo.dropdown.headers.length).toEqual(3);
expect(combo.dropdown.headers.length).toEqual(2);
combo.dropdown.headers[0].clicked(null);
fix.detectChanges();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ describe('IgxForOf directive -', () => {

it('should detect width change and update initially rendered columns', () => {
let rows = displayContainer.querySelectorAll('igx-display-container');
expect(rows.length).toBe(10);
expect(rows.length).toBe(9);
for (let i = 0; i < rows.length; i++) {
expect(rows[i].children.length).toBe(7);
expect(rows[i].children[3].textContent)
Expand All @@ -392,7 +392,7 @@ describe('IgxForOf directive -', () => {
fix.detectChanges();

rows = displayContainer.querySelectorAll('igx-display-container');
expect(rows.length).toBe(10);
expect(rows.length).toBe(9);
for (let i = 0; i < rows.length; i++) {
expect(rows[i].children.length).toBe(9);
expect(rows[i].children[4].textContent)
Expand All @@ -402,7 +402,7 @@ describe('IgxForOf directive -', () => {

it('should detect height change and update initially rendered rows', () => {
let rows = displayContainer.querySelectorAll('igx-display-container');
expect(rows.length).toBe(10);
expect(rows.length).toBe(9);
for (let i = 0; i < rows.length; i++) {
expect(rows[i].children.length).toBe(7);
expect(rows[i].children[2].textContent)
Expand All @@ -414,7 +414,7 @@ describe('IgxForOf directive -', () => {
fix.detectChanges();

rows = displayContainer.querySelectorAll('igx-display-container');
expect(rows.length).toBe(16);
expect(rows.length).toBe(15);
for (let i = 0; i < rows.length; i++) {
expect(rows[i].children.length).toBe(7);
expect(rows[i].children[2].textContent)
Expand All @@ -430,7 +430,7 @@ describe('IgxForOf directive -', () => {
expect(horizontalScroller).not.toBeNull();
expect(fix.componentInstance.isVerticalScrollbarVisible()).toBe(true);
expect(fix.componentInstance.isHorizontalScrollbarVisible()).toBe(true);
expect(rowsRendered.length).toBe(10);
expect(rowsRendered.length).toBe(9);

/** Step 1. Lower the amount of rows to 5. The vertical scrollbar then should not be rendered */
expect(() => {
Expand Down Expand Up @@ -471,7 +471,7 @@ describe('IgxForOf directive -', () => {
expect(horizontalScroller.scrollLeft).toBe(1000);
expect(fix.componentInstance.isVerticalScrollbarVisible()).toBe(true);
expect(fix.componentInstance.isHorizontalScrollbarVisible()).toBe(true);
expect(rowsRendered.length).toBe(10);
expect(rowsRendered.length).toBe(9);
});

it('should not render vertical scrollbars when number of rows change to 0 after scrolling down', async () => {
Expand All @@ -482,7 +482,7 @@ describe('IgxForOf directive -', () => {
expect(horizontalScroller).not.toBeNull();
expect(fix.componentInstance.isVerticalScrollbarVisible()).toBe(true);
expect(fix.componentInstance.isHorizontalScrollbarVisible()).toBe(true);
expect(rowsRendered.length).toBe(10);
expect(rowsRendered.length).toBe(9);

dg.generateData300x50000(fix.componentInstance);
fix.detectChanges();
Expand Down Expand Up @@ -524,7 +524,7 @@ describe('IgxForOf directive -', () => {
expect(verticalScroller.scrollTop).toBe(0);
expect(fix.componentInstance.isVerticalScrollbarVisible()).toBe(true);
expect(fix.componentInstance.isHorizontalScrollbarVisible()).toBe(true);
expect(rowsRendered.length).toBe(10);
expect(rowsRendered.length).toBe(9);
});

it('should not render vertical scrollbar when number of rows change to 0 after scrolling right', async () => {
Expand All @@ -533,7 +533,7 @@ describe('IgxForOf directive -', () => {

expect(fix.componentInstance.isVerticalScrollbarVisible()).toBe(true);
expect(fix.componentInstance.isHorizontalScrollbarVisible()).toBe(true);
expect(rowsRendered.length).toBe(10);
expect(rowsRendered.length).toBe(9);
expect(colsRendered.length).toBe(7);

/** Step 1. Scroll to the right. */
Expand Down Expand Up @@ -581,7 +581,7 @@ describe('IgxForOf directive -', () => {
// expect(horizontalScroller.scrollLeft).toBe(0); To be investigated
expect(fix.componentInstance.isVerticalScrollbarVisible()).toBe(true);
expect(fix.componentInstance.isHorizontalScrollbarVisible()).toBe(true);
expect(rowsRendered.length).toBe(10);
expect(rowsRendered.length).toBe(9);
// expect(colsRendered.length).toBe(4); To be investigated

for (let i = 0; i < rowsRendered.length; i++) {
Expand All @@ -597,7 +597,7 @@ describe('IgxForOf directive -', () => {

expect(fix.componentInstance.isVerticalScrollbarVisible()).toBe(true);
expect(fix.componentInstance.isHorizontalScrollbarVisible()).toBe(true);
expect(rowsRendered.length).toBe(10);
expect(rowsRendered.length).toBe(9);
expect(colsRendered.length).toBe(7);

/** Step 1. Lower the amount of cols to 3 so there would be no horizontal scrollbar */
Expand All @@ -615,7 +615,7 @@ describe('IgxForOf directive -', () => {

expect(fix.componentInstance.isVerticalScrollbarVisible()).toBe(true);
expect(fix.componentInstance.isHorizontalScrollbarVisible()).toBe(false);
expect(rowsRendered.length).toBe(10);
expect(rowsRendered.length).toBe(9);
expect(colsRendered.length).toBe(3);

/** Step 2. Scroll down. There should be no errors then and everything should be still the same */
Expand All @@ -634,7 +634,7 @@ describe('IgxForOf directive -', () => {

expect(fix.componentInstance.isVerticalScrollbarVisible()).toBe(true);
expect(fix.componentInstance.isHorizontalScrollbarVisible()).toBe(false);
expect(rowsRendered.length).toBe(10);
expect(rowsRendered.length).toBe(9);
expect(colsRendered.length).toBe(3);

/** Step 3. Set the data back to have 300 columns and the horizontal scrollbar should render now. */
Expand All @@ -653,7 +653,7 @@ describe('IgxForOf directive -', () => {
expect(verticalScroller.scrollTop).toBe(1000);
expect(fix.componentInstance.isVerticalScrollbarVisible()).toBe(true);
expect(fix.componentInstance.isHorizontalScrollbarVisible()).toBe(true);
expect(rowsRendered.length).toBe(10);
expect(rowsRendered.length).toBe(9);
expect(colsRendered.length).toBe(7);
});

Expand Down Expand Up @@ -848,7 +848,7 @@ describe('IgxForOf directive -', () => {
const rowsRendered = displayContainer.querySelectorAll('igx-display-container');
for (let i = 0; i < 8; i++) {
expect(rowsRendered[i].children[1].textContent)
.toBe(fix.componentInstance.data[49990 + i][1].toString());
.toBe(fix.componentInstance.data[49991 + i][1].toString());
}
wait().then(done);
});
Expand Down Expand Up @@ -892,7 +892,7 @@ describe('IgxForOf directive -', () => {
expect(chunkPreLoadSpy).toHaveBeenCalledTimes(1);

// change size so that chunk size does not change
fix.componentInstance.height = '401px';
fix.componentInstance.height = '399px';
fix.detectChanges();
await wait();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ describe('IgxTreeGrid Component Tests', () => {
expect(defaultHeightNum).toBeGreaterThan(300);
expect(defaultHeightNum).toBeLessThan(330);
expect(fix.componentInstance.isVerticalScrollbarVisible()).toBeTruthy();
expect(grid.rowList.length).toEqual(12);
expect(grid.rowList.length).toEqual(11);
}));
});

Expand Down

0 comments on commit 710698f

Please sign in to comment.