Skip to content

Apply review comments from PR 15819 #15878

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: 20.0.x
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

import { Component, ViewChild } from '@angular/core';
import { Component, DebugElement, ViewChild } from '@angular/core';
import { TestBed, ComponentFixture, tick, fakeAsync, waitForAsync } from '@angular/core/testing';
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
import { IgxExpansionPanelComponent } from './expansion-panel.component';
Expand Down Expand Up @@ -296,13 +296,17 @@ describe('igxExpansionPanel', () => {
panel: IgxExpansionPanelComponent,
panelContainer: any,
panelHeader: HTMLElement,
button: HTMLElement,
button: DebugElement,
timesCollapsed = 0,
timesExpanded = 0) => {
expect(panel.collapsed).toEqual(collapsed);
const ariaExpanded = collapsed ? 'false' : 'true';
expect(panelHeader.querySelector('div [role = \'button\']').getAttribute('aria-expanded')).toMatch(ariaExpanded);
expect(panelHeader.classList.contains(CSS_CLASS_HEADER_EXPANDED)).toEqual(!collapsed);
if (button.children.length > 1) {
const iconName = collapsed ? 'expand_more' : 'expand_less';
expect(button.componentInstance.iconName).toMatch(iconName);
}
if (collapsed) {
expect(panelContainer.lastElementChild.nodeName).toEqual('IGX-EXPANSION-PANEL-HEADER');
} else {
Expand All @@ -322,7 +326,7 @@ describe('igxExpansionPanel', () => {
const header = fixture.componentInstance.header;
const panelContainer = fixture.nativeElement.querySelector('.' + CSS_CLASS_EXPANSION_PANEL);
const panelHeader = fixture.nativeElement.querySelector('.' + CSS_CLASS_PANEL_HEADER) as HTMLElement;
const button = fixture.nativeElement.querySelector('.' + CSS_CLASS_PANEL_ICON) as HTMLElement;
const button = fixture.debugElement.query(By.css('.' + CSS_CLASS_PANEL_ICON)) as DebugElement;

let timesCollapsed = 0;
let timesExpanded = 0;
Expand Down Expand Up @@ -383,7 +387,7 @@ describe('igxExpansionPanel', () => {
const header = fixture.componentInstance.header;
const panelContainer = fixture.nativeElement.querySelector('.' + CSS_CLASS_EXPANSION_PANEL);
const panelHeader = fixture.nativeElement.querySelector('.' + CSS_CLASS_PANEL_HEADER) as HTMLElement;
let button = fixture.nativeElement.querySelector('.' + CSS_CLASS_PANEL_ICON) as HTMLElement;
let button = fixture.debugElement.query(By.css('.' + CSS_CLASS_PANEL_ICON)) as DebugElement;

let timesCollapsed = 0;
let timesExpanded = 0;
Expand All @@ -392,23 +396,23 @@ describe('igxExpansionPanel', () => {
spyOn(header.interaction, 'emit');
verifyPanelExpansionState(true, panel, panelContainer, panelHeader, button, timesCollapsed, timesExpanded);

button.click();
button.nativeElement.click()
tick();
fixture.detectChanges();
tick();
timesExpanded++;
verifyPanelExpansionState(false, panel, panelContainer, panelHeader, button, timesCollapsed, timesExpanded);
expect(header.interaction.emit).toHaveBeenCalledTimes(1);

button.click();
button.nativeElement.click()
tick();
fixture.detectChanges();
tick();
timesCollapsed++;
verifyPanelExpansionState(true, panel, panelContainer, panelHeader, button, timesCollapsed, timesExpanded);
expect(header.interaction.emit).toHaveBeenCalledTimes(2);

button.click();
button.nativeElement.click()
tick();
fixture.detectChanges();
tick();
Expand All @@ -422,24 +426,24 @@ describe('igxExpansionPanel', () => {
fixture.detectChanges();
tick();

button = fixture.nativeElement.querySelector('.' + CSS_CLASS_PANEL_ICON) as HTMLElement;
button.click();
button = fixture.debugElement.query(By.css('.' + CSS_CLASS_PANEL_ICON)) as DebugElement;
button.nativeElement.click()
tick();
fixture.detectChanges();
tick();
timesCollapsed++;
verifyPanelExpansionState(true, panel, panelContainer, panelHeader, button, timesCollapsed, timesExpanded);
expect(header.interaction.emit).toHaveBeenCalledTimes(4);

button.click();
button.nativeElement.click()
tick();
fixture.detectChanges();
tick();
timesExpanded++;
verifyPanelExpansionState(false, panel, panelContainer, panelHeader, button, timesCollapsed, timesExpanded);
expect(header.interaction.emit).toHaveBeenCalledTimes(5);

button.click();
button.nativeElement.click()
tick();
fixture.detectChanges();
tick();
Expand All @@ -453,7 +457,7 @@ describe('igxExpansionPanel', () => {
const panel = fixture.componentInstance.expansionPanel;
const panelContainer = fixture.nativeElement.querySelector('.' + CSS_CLASS_EXPANSION_PANEL);
const panelHeader = fixture.nativeElement.querySelector('.' + CSS_CLASS_PANEL_HEADER) as HTMLElement;
const button = fixture.nativeElement.querySelector('.' + CSS_CLASS_PANEL_ICON) as HTMLElement;
const button = fixture.debugElement.query(By.css('.' + CSS_CLASS_PANEL_ICON)) as DebugElement;
spyOn(panel.contentCollapsed, 'emit').and.callThrough();
spyOn(panel.contentExpanded, 'emit').and.callThrough();
verifyPanelExpansionState(true, panel, panelContainer, panelHeader, button);
Expand Down Expand Up @@ -482,7 +486,7 @@ describe('igxExpansionPanel', () => {
const panel = fixture.componentInstance.expansionPanel;
const panelContainer = fixture.nativeElement.querySelector('.' + CSS_CLASS_EXPANSION_PANEL);
const panelHeader = fixture.nativeElement.querySelector('.' + CSS_CLASS_PANEL_HEADER) as HTMLElement;
const button = fixture.nativeElement.querySelector('.' + CSS_CLASS_PANEL_ICON) as HTMLElement;
const button = fixture.debugElement.query(By.css('.' + CSS_CLASS_PANEL_ICON)) as DebugElement;

let timesCollapsed = 0;
let timesExpanded = 0;
Expand Down Expand Up @@ -524,7 +528,7 @@ describe('igxExpansionPanel', () => {
const panel = fixture.componentInstance.expansionPanel;
const panelContainer = fixture.nativeElement.querySelector('.' + CSS_CLASS_EXPANSION_PANEL);
const panelHeader = fixture.nativeElement.querySelector('.' + CSS_CLASS_PANEL_HEADER) as HTMLElement;
const button = fixture.nativeElement.querySelector('.' + CSS_CLASS_PANEL_ICON) as HTMLElement;
const button = fixture.debugElement.query(By.css('.' + CSS_CLASS_PANEL_ICON)) as DebugElement;

let timesCollapsed = 0;
let timesExpanded = 0;
Expand Down Expand Up @@ -571,7 +575,7 @@ describe('igxExpansionPanel', () => {
const header = fixture.componentInstance.header;
const panelContainer = fixture.nativeElement.querySelector('.' + CSS_CLASS_EXPANSION_PANEL);
const panelHeader = fixture.nativeElement.querySelector('.' + CSS_CLASS_PANEL_HEADER) as HTMLElement;
const button = fixture.nativeElement.querySelector('.' + CSS_CLASS_PANEL_ICON) as HTMLElement;
const button = fixture.debugElement.query(By.css('.' + CSS_CLASS_PANEL_ICON)) as DebugElement;

let timesCollapsed = 0;
let timesExpanded = 0;
Expand Down Expand Up @@ -684,7 +688,7 @@ describe('igxExpansionPanel', () => {
const header = fixture.componentInstance.header;
const panelContainer = fixture.nativeElement.querySelector('.' + CSS_CLASS_EXPANSION_PANEL);
const panelHeader = fixture.nativeElement.querySelector('.' + CSS_CLASS_PANEL_HEADER) as HTMLElement;
const button = fixture.nativeElement.querySelector('.' + CSS_CLASS_PANEL_ICON) as HTMLElement;
const button = fixture.debugElement.query(By.css('.' + CSS_CLASS_PANEL_ICON)) as DebugElement;

let timesCollapsed = 0;
let timesExpanded = 0;
Expand All @@ -708,7 +712,7 @@ describe('igxExpansionPanel', () => {
verifyPanelExpansionState(true, panel, panelContainer, panelHeader, button, timesCollapsed, timesExpanded);
expect(header.interaction.emit).toHaveBeenCalledTimes(1);

button.click();
button.nativeElement.click()
tick();
fixture.detectChanges();
tick();
Expand Down Expand Up @@ -759,7 +763,7 @@ describe('igxExpansionPanel', () => {
const header = fixture.componentInstance.header;
const panelContainer = fixture.nativeElement.querySelector('.' + CSS_CLASS_EXPANSION_PANEL);
const panelHeader = fixture.nativeElement.querySelector('.' + CSS_CLASS_PANEL_HEADER) as HTMLElement;
const button = fixture.nativeElement.querySelector('.' + CSS_CLASS_PANEL_ICON) as HTMLElement;
const button = fixture.debugElement.query(By.css('.' + CSS_CLASS_PANEL_ICON)) as DebugElement;
const headerButton = panelHeader.querySelector('div [role = \'button\']');

let timesCollapsed = 0;
Expand Down Expand Up @@ -788,7 +792,7 @@ describe('igxExpansionPanel', () => {
verifyPanelExpansionState(false, panel, panelContainer, panelHeader, button, timesCollapsed, timesExpanded);
expect(header.interaction.emit).toHaveBeenCalledTimes(0);

button.click();
button.nativeElement.click()
tick();
fixture.detectChanges();
tick();
Expand Down Expand Up @@ -817,7 +821,7 @@ describe('igxExpansionPanel', () => {
verifyPanelExpansionState(true, panel, panelContainer, panelHeader, button, timesCollapsed, timesExpanded);
expect(header.interaction.emit).toHaveBeenCalledTimes(0);

button.click();
button.nativeElement.click()
tick();
fixture.detectChanges();
tick();
Expand Down
4 changes: 2 additions & 2 deletions projects/igniteui-angular/src/lib/grids/grid/cell.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ describe('IgxGrid - Cell component #grid', () => {
});
});

xdescribe('Cells in virtualized grid ', () => {
describe('Cells in virtualized grid ', () => {
let fix;
let grid: IgxGridComponent;

Expand Down Expand Up @@ -260,8 +260,8 @@ describe('IgxGrid - Cell component #grid', () => {

const gridContent = GridFunctions.getGridContent(fix);
UIInteractions.triggerEventHandlerKeyDown('arrowup', gridContent);
await wait(16);
fix.detectChanges();
await wait(30);

expect(grid.getCellByColumn(2, 'value').selected).toBeTruthy();
}));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { waitForAsync, TestBed, ComponentFixture, fakeAsync, tick, flush } from '@angular/core/testing';
import { FilteringExpressionsTree, FilteringLogic, IExpressionTree, IgxChipComponent, IgxComboComponent, IgxDateFilteringOperand, IgxNumberFilteringOperand, IgxQueryBuilderComponent, IgxQueryBuilderHeaderComponent, IgxQueryBuilderSearchValueTemplateDirective } from 'igniteui-angular';
import { FilteringExpressionsTree, FilteringLogic, IExpressionTree, IgxChipComponent, IgxComboComponent, IgxDateFilteringOperand, IgxIconComponent, IgxInputGroupComponent, IgxNumberFilteringOperand, IgxQueryBuilderComponent, IgxQueryBuilderHeaderComponent, IgxQueryBuilderSearchValueTemplateDirective, IgxSelectComponent } from 'igniteui-angular';
import { Component, OnInit, ViewChild } from '@angular/core';
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
import { By } from '@angular/platform-browser';
Expand Down Expand Up @@ -830,8 +830,10 @@ describe('IgxQueryBuilder', () => {
QueryBuilderFunctions.selectOperatorInEditModeExpression(fix, 10); // Select 'In' operator.

// Verify operator icon
// const operatorInputGroup = QueryBuilderFunctions.getQueryBuilderOperatorSelect(fix).querySelector('igx-input-group') as HTMLElement;
// expect(operatorInputGroup.querySelector('igx-icon').attributes.getNamedItem('ng-reflect-name').nodeValue).toEqual('in');
const operatorSelectDebugElement = fix.debugElement.queryAll(By.directive(IgxSelectComponent))[2];
const inputDebugElement = operatorSelectDebugElement.query(By.directive(IgxInputGroupComponent));
const iconDebugElem = inputDebugElement.query(By.directive(IgxIconComponent));
expect(iconDebugElem.componentInstance.name).toEqual('in');

const input = QueryBuilderFunctions.getQueryBuilderValueInput(fix).querySelector('input');
// Verify value input placeholder
Expand Down Expand Up @@ -907,8 +909,10 @@ describe('IgxQueryBuilder', () => {
QueryBuilderFunctions.selectOperatorInEditModeExpression(fix, 11); // Select 'Not-In' operator.

// Verify operator icon
// const operatorInputGroup = QueryBuilderFunctions.getQueryBuilderOperatorSelect(fix).querySelector('igx-input-group') as HTMLElement;
// expect(operatorInputGroup.querySelector('igx-icon').attributes.getNamedItem('ng-reflect-name').nodeValue).toEqual('not-in');
const operatorSelectDebugElement = fix.debugElement.queryAll(By.directive(IgxSelectComponent))[2];
const inputDebugElement = operatorSelectDebugElement.query(By.directive(IgxInputGroupComponent));
const iconDebugElem = inputDebugElement.query(By.directive(IgxIconComponent));
expect(iconDebugElem.componentInstance.name).toEqual('not-in');

const input = QueryBuilderFunctions.getQueryBuilderValueInput(fix).querySelector('input');
// Verify value input placeholder
Expand Down
Loading