diff --git a/projects/igniteui-angular/calendar/src/calendar/days-view/days-view.component.spec.ts b/projects/igniteui-angular/calendar/src/calendar/days-view/days-view.component.spec.ts index 8faedc23c93..875266a2471 100644 --- a/projects/igniteui-angular/calendar/src/calendar/days-view/days-view.component.spec.ts +++ b/projects/igniteui-angular/calendar/src/calendar/days-view/days-view.component.spec.ts @@ -132,12 +132,12 @@ describe("Days View Component", () => { // 1. Verify Programmatic Access (formattedDate method) // Should return the raw formatted string from the formatter (with suffix) const programmaticResult = daysView.formattedDate(date); - expect(programmaticResult).toBe('25日', 'Programmatic API should return the full locale string (including suffix, in this case 日)'); + expect(programmaticResult, 'Programmatic API should return the full locale string (including suffix, in this case 日)').toBe('25日'); // 2. Verify Pipe Logic // The pipe takes the formatted string "25日" and strips non-digits to return "25" const pipeResult = pipe.transform(programmaticResult, daysView.formatViews); - expect(pipeResult).toBe('25', 'Pipe should strip non-numeric characters from the input string'); + expect(pipeResult, 'Pipe should strip non-numeric characters from the input string').toBe('25'); // 3. Confirm the difference implies the pipe did its job expect(programmaticResult).not.toEqual(pipeResult); diff --git a/projects/igniteui-angular/core/src/data-operations/data-util.spec.ts b/projects/igniteui-angular/core/src/data-operations/data-util.spec.ts index 258eadf11d3..55a6a0ee968 100644 --- a/projects/igniteui-angular/core/src/data-operations/data-util.spec.ts +++ b/projects/igniteui-angular/core/src/data-operations/data-util.spec.ts @@ -76,8 +76,7 @@ const testSort = () => { strategy: DefaultSortingStrategy.instance() }; let res = DataUtil.sort(data, [se0]); - expect(dataGenerator.getValuesForColumn(res, 'number')) - .toEqual([3, 2, 1, 0, 4], 'expressionDefaults.ignoreCase = false'); + expect(dataGenerator.getValuesForColumn(res, 'number'), 'expressionDefaults.ignoreCase = false').toEqual([3, 2, 1, 0, 4]); se0.ignoreCase = true; res = DataUtil.sort(data, [se0]); expect(dataGenerator.getValuesForColumn(res, 'number')) diff --git a/projects/igniteui-angular/date-picker/src/date-picker/date-picker.component.spec.ts b/projects/igniteui-angular/date-picker/src/date-picker/date-picker.component.spec.ts index e0fb2de02fc..06bafaaedf1 100644 --- a/projects/igniteui-angular/date-picker/src/date-picker/date-picker.component.spec.ts +++ b/projects/igniteui-angular/date-picker/src/date-picker/date-picker.component.spec.ts @@ -74,7 +74,7 @@ describe('IgxDatePicker', () => { expect(datePicker['_calendar'].hasHeader).toBe(false); const calendarHeader = fixture.debugElement.query(By.css(CSS_CLASS_CALENDAR_HEADER)); - expect(calendarHeader).toBeFalsy('Calendar header should not be present'); + expect(calendarHeader, 'Calendar header should not be present').toBeFalsy(); })); it('should set calendar orientation property', fakeAsync(() => { @@ -663,7 +663,7 @@ describe('IgxDatePicker', () => { fixture.detectChanges(); const headerTitleElement = fixture.debugElement.query(By.css('.igx-calendar__header-year')); - expect(headerTitleElement).toBeTruthy('Header title element should be present'); + expect(headerTitleElement, 'Header title element should be present').toBeTruthy(); if (headerTitleElement) { expect(headerTitleElement.nativeElement.textContent.trim()).toBe('2024'); } @@ -677,7 +677,7 @@ describe('IgxDatePicker', () => { fixture.detectChanges(); const headerElement = fixture.debugElement.query(By.css('.igx-calendar__header-date')); - expect(headerElement).toBeTruthy('Header element should be present'); + expect(headerElement, 'Header element should be present').toBeTruthy(); if (headerElement) { expect(headerElement.nativeElement.textContent.trim()).toBe('Nov'); } diff --git a/projects/igniteui-angular/dialog/src/dialog/dialog.component.spec.ts b/projects/igniteui-angular/dialog/src/dialog/dialog.component.spec.ts index 9904a702f30..da1f6de99c7 100644 --- a/projects/igniteui-angular/dialog/src/dialog/dialog.component.spec.ts +++ b/projects/igniteui-angular/dialog/src/dialog/dialog.component.spec.ts @@ -458,9 +458,9 @@ describe('Dialog', () => { expect(dialog.isOpen).toEqual(true); const firstContentRect = document.getElementsByClassName(CLASS_OVERLAY_CONTENT_MODAL)[0].getBoundingClientRect(); const middleDialogPosition = document.documentElement.offsetHeight / 2 - firstContentRect.height / 2; - expect(firstContentRect.left).toEqual(0, 'OffsetLeft position check'); - expect(firstContentRect.top).toBeGreaterThanOrEqual(middleDialogPosition - 2, 'OffsetTop position check'); - expect(firstContentRect.top).toBeLessThanOrEqual(middleDialogPosition + 2, 'OffsetTop position check'); + expect(firstContentRect.left, 'OffsetLeft position check').toEqual(0); + expect(firstContentRect.top, 'OffsetTop position check').toBeGreaterThanOrEqual(middleDialogPosition - 2); + expect(firstContentRect.top, 'OffsetTop position check').toBeLessThanOrEqual(middleDialogPosition + 2); dialog.close(); tick(16); @@ -478,9 +478,9 @@ describe('Dialog', () => { expect(dialog.isOpen).toEqual(true); const secondContentRect = document.getElementsByClassName(CLASS_OVERLAY_CONTENT_MODAL)[0].getBoundingClientRect(); const topDialogPosition = document.documentElement.offsetWidth / 2 - secondContentRect.width / 2; - expect(secondContentRect.top).toEqual(0, 'OffsetTop position check'); - expect(secondContentRect.left).toBeGreaterThanOrEqual(topDialogPosition - 2, 'OffsetLeft position check'); - expect(secondContentRect.left).toBeLessThanOrEqual(topDialogPosition + 2, 'OffsetLeft position check'); + expect(secondContentRect.top, 'OffsetTop position check').toEqual(0); + expect(secondContentRect.left, 'OffsetLeft position check').toBeGreaterThanOrEqual(topDialogPosition - 2); + expect(secondContentRect.left, 'OffsetLeft position check').toBeLessThanOrEqual(topDialogPosition + 2); dialog.close(); tick(16); @@ -493,18 +493,18 @@ describe('Dialog', () => { const currentElement = fix.componentInstance; // Check initial animation settings - expect(dialog.positionSettings.openAnimation.animation.type).toEqual(8, 'Animation type is set'); - expect(dialog.positionSettings.openAnimation.options.params.duration).toEqual('200ms', 'Animation duration is set to 200ms'); + expect(dialog.positionSettings.openAnimation.animation.type, 'Animation type is set').toEqual(8); + expect(dialog.positionSettings.openAnimation.options.params.duration, 'Animation duration is set to 200ms').toEqual('200ms'); - expect(dialog.positionSettings.closeAnimation.animation.type).toEqual(8, 'Animation type is set'); - expect(dialog.positionSettings.closeAnimation.options.params.duration).toEqual('200ms', 'Animation duration is set to 200ms'); + expect(dialog.positionSettings.closeAnimation.animation.type, 'Animation type is set').toEqual(8); + expect(dialog.positionSettings.closeAnimation.options.params.duration, 'Animation duration is set to 200ms').toEqual('200ms'); dialog.positionSettings = currentElement.animationSettings; fix.detectChanges(); // Check the new animation settings - expect(dialog.positionSettings.openAnimation.options.params.duration).toEqual('800ms', 'Animation duration is set to 800ms'); - expect(dialog.positionSettings.closeAnimation.options.params.duration).toEqual('700ms', 'Animation duration is set to 700ms'); + expect(dialog.positionSettings.openAnimation.options.params.duration, 'Animation duration is set to 800ms').toEqual('800ms'); + expect(dialog.positionSettings.closeAnimation.options.params.duration, 'Animation duration is set to 700ms').toEqual('700ms'); }); }); diff --git a/projects/igniteui-angular/grids/core/src/services/csv/csv-exporter-grid.spec.ts b/projects/igniteui-angular/grids/core/src/services/csv/csv-exporter-grid.spec.ts index c8c3d05fe5e..31105047c7d 100644 --- a/projects/igniteui-angular/grids/core/src/services/csv/csv-exporter-grid.spec.ts +++ b/projects/igniteui-angular/grids/core/src/services/csv/csv-exporter-grid.spec.ts @@ -92,7 +92,7 @@ describe('CSV Grid Exporter', () => { grid.filter('JobTitle', 'Director', IgxStringFilteringOperand.instance().condition('equals'), true); fix.detectChanges(); - expect(grid.rowList.length).toEqual(2, 'Invalid number of rows after filtering!'); + expect(grid.rowList.length, 'Invalid number of rows after filtering!').toEqual(2); wrapper = await getExportedData(grid, options); wrapper.verifyData(wrapper.gridTwoDirectors, 'Two rows should have been exported!'); }); @@ -106,7 +106,7 @@ describe('CSV Grid Exporter', () => { options.ignoreColumnsVisibility = false; fix.detectChanges(); - expect(grid.visibleColumns.length).toEqual(2, 'Invalid number of visible columns!'); + expect(grid.visibleColumns.length, 'Invalid number of visible columns!').toEqual(2); let wrapper = await getExportedData(grid, options); wrapper.verifyData(wrapper.gridNameJobTitle, 'Two columns data should have been exported!'); @@ -124,25 +124,25 @@ describe('CSV Grid Exporter', () => { options.ignoreColumnsOrder = true; fix.detectChanges(); - expect(grid.visibleColumns.length).toEqual(3, 'Invalid number of visible columns!'); + expect(grid.visibleColumns.length, 'Invalid number of visible columns!').toEqual(3); let wrapper = await getExportedData(grid, options); wrapper.verifyData(wrapper.simpleGridData, 'All columns data should have been exported!'); grid.columnList.get(0).hidden = true; fix.detectChanges(); - expect(grid.visibleColumns.length).toEqual(2, 'Invalid number of visible columns!'); + expect(grid.visibleColumns.length, 'Invalid number of visible columns!').toEqual(2); wrapper = await getExportedData(grid, options); wrapper.verifyData(wrapper.gridNameJobTitle, 'Two columns data should have been exported!'); grid.columnList.get(0).hidden = false; fix.detectChanges(); - expect(grid.visibleColumns.length).toEqual(3, 'Invalid number of visible columns!'); + expect(grid.visibleColumns.length, 'Invalid number of visible columns!').toEqual(3); wrapper = await getExportedData(grid, options); wrapper.verifyData(wrapper.simpleGridData, 'All columns data should have been exported!'); grid.columnList.get(0).hidden = undefined; fix.detectChanges(); - expect(grid.visibleColumns.length).toEqual(3, 'Invalid number of visible columns!'); + expect(grid.visibleColumns.length, 'Invalid number of visible columns!').toEqual(3); wrapper = await getExportedData(grid, options); wrapper.verifyData(wrapper.simpleGridData, 'All columns data should have been exported!'); }); @@ -410,7 +410,7 @@ describe('CSV Grid Exporter', () => { const wrapper = await getExportedData(grid, options); const exportedData = wrapper['_data']; - expect(exportedData.includes('[object Object]')).toBe(false, 'CSV export should not contain [object Object]'); + expect(exportedData.includes('[object Object]'), 'CSV export should not contain [object Object]').toBe(false); const lines = exportedData.split('\r\n'); @@ -420,7 +420,7 @@ describe('CSV Grid Exporter', () => { // Verify at least one summary line contains proper formatting (label: value pattern) const hasProperlySummary = summaryLines.some(line => line.includes(':') && !line.includes('[object Object]')); - expect(hasProperlySummary).toBe(true, 'Summary data should be formatted as "label: value"'); + expect(hasProperlySummary, 'Summary data should be formatted as "label: value"').toBe(true); }); describe('Tree Grid CSV export', () => { diff --git a/projects/igniteui-angular/grids/core/src/services/excel/excel-exporter-grid.spec.ts b/projects/igniteui-angular/grids/core/src/services/excel/excel-exporter-grid.spec.ts index 9093117f115..21900bdd2a9 100644 --- a/projects/igniteui-angular/grids/core/src/services/excel/excel-exporter-grid.spec.ts +++ b/projects/igniteui-angular/grids/core/src/services/excel/excel-exporter-grid.spec.ts @@ -125,7 +125,7 @@ describe('Excel Exporter', () => { grid.filter('JobTitle', 'Director', IgxStringFilteringOperand.instance().condition('equals'), true); fix.detectChanges(); - expect(grid.rowList.length).toEqual(2, 'Invalid number of rows after filtering!'); + expect(grid.rowList.length, 'Invalid number of rows after filtering!').toEqual(2); wrapper = await getExportedData(grid, options); await wrapper.verifyDataFilesContent(actualData.simpleGridDataDirectors, 'Two rows should have been exported!'); }); @@ -140,7 +140,7 @@ describe('Excel Exporter', () => { options.ignoreColumnsVisibility = false; fix.detectChanges(); - expect(grid.visibleColumns.length).toEqual(2, 'Invalid number of visible columns!'); + expect(grid.visibleColumns.length, 'Invalid number of visible columns!').toEqual(2); let wrapper = await getExportedData(grid, options); await wrapper.verifyDataFilesContent(actualData.simpleGridNameJobTitle, 'Two columns should have been exported!'); @@ -158,28 +158,28 @@ describe('Excel Exporter', () => { const grid = fix.componentInstance.grid; options.ignoreColumnsVisibility = false; - expect(grid.visibleColumns.length).toEqual(3, 'Invalid number of visible columns!'); + expect(grid.visibleColumns.length, 'Invalid number of visible columns!').toEqual(3); let wrapper = await getExportedData(grid, options); await wrapper.verifyDataFilesContent(actualData.simpleGridData, 'All columns should have been exported!'); grid.columnList.get(0).hidden = true; fix.detectChanges(); - expect(grid.visibleColumns.length).toEqual(2, 'Invalid number of visible columns!'); + expect(grid.visibleColumns.length, 'Invalid number of visible columns!').toEqual(2); wrapper = await getExportedData(grid, options); await wrapper.verifyDataFilesContent(actualData.simpleGridNameJobTitle, 'Two columns should have been exported!'); grid.columnList.get(0).hidden = false; fix.detectChanges(); - expect(grid.visibleColumns.length).toEqual(3, 'Invalid number of visible columns!'); + expect(grid.visibleColumns.length, 'Invalid number of visible columns!').toEqual(3); wrapper = await getExportedData(grid, options); await wrapper.verifyDataFilesContent(actualData.simpleGridData, 'All columns should have been exported!'); grid.columnList.get(0).hidden = undefined; fix.detectChanges(); - expect(grid.visibleColumns.length).toEqual(3, 'Invalid number of visible columns!'); + expect(grid.visibleColumns.length, 'Invalid number of visible columns!').toEqual(3); wrapper = await getExportedData(grid, options); await wrapper.verifyDataFilesContent(actualData.simpleGridData, 'All columns should have been exported!'); }); diff --git a/projects/igniteui-angular/grids/core/src/services/exporter-common/test-methods.spec.ts b/projects/igniteui-angular/grids/core/src/services/exporter-common/test-methods.spec.ts index db3977f3d62..ec2454f8231 100644 --- a/projects/igniteui-angular/grids/core/src/services/exporter-common/test-methods.spec.ts +++ b/projects/igniteui-angular/grids/core/src/services/exporter-common/test-methods.spec.ts @@ -14,7 +14,7 @@ export class TestMethods { await wait(16); myGrid = fix.componentInstance.grid; - expect(myGrid.rowList.length).toEqual(10, 'Invalid number of rows initialized!'); + expect(myGrid.rowList.length, 'Invalid number of rows initialized!').toEqual(10); await action(myGrid); } diff --git a/projects/igniteui-angular/grids/core/src/state.directive.spec.ts b/projects/igniteui-angular/grids/core/src/state.directive.spec.ts index 2e60ad02d5f..372b6c29ce3 100644 --- a/projects/igniteui-angular/grids/core/src/state.directive.spec.ts +++ b/projects/igniteui-angular/grids/core/src/state.directive.spec.ts @@ -56,7 +56,7 @@ describe('IgxGridState - input properties #grid', () => { const state = fix.componentInstance.state; - expect(state).toBeDefined('IgxGridState directive is initialized'); + expect(state, 'IgxGridState directive is initialized').toBeDefined(); expect(state.options).toEqual(expect.objectContaining(defaultOptions)); }); @@ -91,7 +91,7 @@ describe('IgxGridState - input properties #grid', () => { const state = fix.componentInstance.state; const gridState = state.getState(); - expect(gridState).toBe(initialGridState, 'JSON string representation of the initial grid state is not correct'); + expect(gridState, 'JSON string representation of the initial grid state is not correct').toBe(initialGridState); }); it('getState should return correct IGridState object when using default options', () => { @@ -165,7 +165,7 @@ describe('IgxGridState - input properties #grid', () => { const filtering = grid.filteringExpressionsTree; let gridState = state.getState(true, 'filtering'); - expect(gridState).toBe('{"filtering":{"filteringOperands":[],"operator":0}}', 'JSON string'); + expect(gridState, 'JSON string').toBe('{"filtering":{"filteringOperands":[],"operator":0}}'); gridState = state.getState(false, ['filtering']) as IGridState; HelperFunctions.verifyFilteringExpressions(filtering, gridState); @@ -826,8 +826,8 @@ class HelperFunctions { } public static verifyFilteringExpressions(expressions: IFilteringExpressionsTree, gridState: IGridState) { - expect(expressions.fieldName).toBe(gridState.filtering.fieldName, 'Filtering expression field name is not correct'); - expect(expressions.operator).toBe(gridState.filtering.operator, 'Filtering expression operator value is not correct'); + expect(expressions.fieldName, 'Filtering expression field name is not correct').toBe(gridState.filtering.fieldName); + expect(expressions.operator, 'Filtering expression operator value is not correct').toBe(gridState.filtering.operator); expressions.filteringOperands.forEach((expr, i) => { expect(expr).toEqual(expect.objectContaining(gridState.filtering.filteringOperands[i])); }); @@ -835,8 +835,8 @@ class HelperFunctions { public static verifyAdvancedFilteringExpressions(expressions: IFilteringExpressionsTree, gridState: IGridState) { if (gridState.advancedFiltering) { - expect(expressions.fieldName).toBe(gridState.advancedFiltering.fieldName, 'Filtering expression field name is not correct'); - expect(expressions.operator).toBe(gridState.advancedFiltering.operator, 'Filtering expression operator value is not correct'); + expect(expressions.fieldName, 'Filtering expression field name is not correct').toBe(gridState.advancedFiltering.fieldName); + expect(expressions.operator, 'Filtering expression operator value is not correct').toBe(gridState.advancedFiltering.operator); expressions.filteringOperands.forEach((expr, i) => { expect(expr).toEqual(expect.objectContaining(gridState.advancedFiltering.filteringOperands[i])); }); diff --git a/projects/igniteui-angular/grids/core/src/state.hierarchicalgrid.spec.ts b/projects/igniteui-angular/grids/core/src/state.hierarchicalgrid.spec.ts index 335b839f20d..e4fd327fc09 100644 --- a/projects/igniteui-angular/grids/core/src/state.hierarchicalgrid.spec.ts +++ b/projects/igniteui-angular/grids/core/src/state.hierarchicalgrid.spec.ts @@ -53,7 +53,7 @@ describe('IgxHierarchicalGridState - input properties #hGrid', () => { }; const state = fix.componentInstance.state; - expect(state).toBeDefined('IgxGridState directive is initialized'); + expect(state, 'IgxGridState directive is initialized').toBeDefined(); expect(state.options).toEqual(expect.objectContaining(defaultOptions)); }); @@ -94,7 +94,7 @@ describe('IgxHierarchicalGridState - input properties #hGrid', () => { const state = fix.componentInstance.state; const gridState = state.getState(); - expect(gridState).toBe(initialGridState, 'JSON string representation of the initial grid state is not correct'); + expect(gridState, 'JSON string representation of the initial grid state is not correct').toBe(initialGridState); }); it('getState should return corect IGridState object when using default options', () => { @@ -516,8 +516,8 @@ class HelperFunctions { } public static verifyFilteringExpressions(expressions: IFilteringExpressionsTree, gridState: IGridState) { - expect(expressions.fieldName).toBe(gridState.filtering.fieldName, 'Filtering expression field name is not correct'); - expect(expressions.operator).toBe(gridState.filtering.operator, 'Filtering expression operator value is not correct'); + expect(expressions.fieldName, 'Filtering expression field name is not correct').toBe(gridState.filtering.fieldName); + expect(expressions.operator, 'Filtering expression operator value is not correct').toBe(gridState.filtering.operator); expressions.filteringOperands.forEach((expr, i) => { expect(expr).toEqual(expect.objectContaining(gridState.filtering.filteringOperands[i])); }); @@ -525,8 +525,8 @@ class HelperFunctions { public static verifyAdvancedFilteringExpressions(expressions: IFilteringExpressionsTree, gridState: IGridState) { if (gridState.advancedFiltering) { - expect(expressions.fieldName).toBe(gridState.advancedFiltering.fieldName, 'Filtering expression field name is not correct'); - expect(expressions.operator).toBe(gridState.advancedFiltering.operator, 'Filtering expression operator value is not correct'); + expect(expressions.fieldName, 'Filtering expression field name is not correct').toBe(gridState.advancedFiltering.fieldName); + expect(expressions.operator, 'Filtering expression operator value is not correct').toBe(gridState.advancedFiltering.operator); expressions.filteringOperands.forEach((expr, i) => { expect(expr).toEqual(expect.objectContaining(gridState.advancedFiltering.filteringOperands[i])); }); diff --git a/projects/igniteui-angular/grids/core/src/state.treegrid.spec.ts b/projects/igniteui-angular/grids/core/src/state.treegrid.spec.ts index 4d62edb1139..b1f104ab821 100644 --- a/projects/igniteui-angular/grids/core/src/state.treegrid.spec.ts +++ b/projects/igniteui-angular/grids/core/src/state.treegrid.spec.ts @@ -54,7 +54,7 @@ describe('IgxTreeGridState - input properties #tGrid', () => { const state = fix.componentInstance.state; - expect(state).toBeDefined('IgxGridState directive is initialized'); + expect(state, 'IgxGridState directive is initialized').toBeDefined(); expect(state.options).toEqual(expect.objectContaining(defaultOptions)); }); @@ -87,7 +87,7 @@ describe('IgxTreeGridState - input properties #tGrid', () => { const state = fix.componentInstance.state; const gridState = state.getState(); - expect(gridState).toBe(initialGridState, 'JSON string representation of the initial grid state is not correct'); + expect(gridState, 'JSON string representation of the initial grid state is not correct').toBe(initialGridState); }); it('getState should return correct IGridState object when using default options', () => { @@ -124,7 +124,7 @@ describe('IgxTreeGridState - input properties #tGrid', () => { const filtering = grid.filteringExpressionsTree; let gridState = state.getState(true, 'filtering'); - expect(gridState).toBe('{"filtering":{"filteringOperands":[],"operator":0}}', 'JSON string'); + expect(gridState, 'JSON string').toBe('{"filtering":{"filteringOperands":[],"operator":0}}'); gridState = state.getState(false, ['filtering']) as IGridState; HelperFunctions.verifyFilteringExpressions(filtering, gridState); @@ -152,7 +152,7 @@ describe('IgxTreeGridState - input properties #tGrid', () => { const moving = grid.moving; let gridState = state.getState(true, 'moving'); - expect(gridState).toBe('{"moving":true}', 'JSON string'); + expect(gridState, 'JSON string').toBe('{"moving":true}'); gridState = state.getState(false, ['moving']) as IGridState; HelperFunctions.verifyMoving(moving, gridState); @@ -299,8 +299,8 @@ class HelperFunctions { } public static verifyFilteringExpressions(expressions: IFilteringExpressionsTree, gridState: IGridState) { - expect(expressions.fieldName).toBe(gridState.filtering.fieldName, 'Filtering expression field name is not correct'); - expect(expressions.operator).toBe(gridState.filtering.operator, 'Filtering expression operator value is not correct'); + expect(expressions.fieldName, 'Filtering expression field name is not correct').toBe(gridState.filtering.fieldName); + expect(expressions.operator, 'Filtering expression operator value is not correct').toBe(gridState.filtering.operator); expressions.filteringOperands.forEach((expr, i) => { expect(expr).toEqual(expect.objectContaining(gridState.filtering.filteringOperands[i])); }); @@ -308,8 +308,8 @@ class HelperFunctions { public static verifyAdvancedFilteringExpressions(expressions: IFilteringExpressionsTree, gridState: IGridState) { if (gridState.advancedFiltering) { - expect(expressions.fieldName).toBe(gridState.advancedFiltering.fieldName, 'Filtering expression field name is not correct'); - expect(expressions.operator).toBe(gridState.advancedFiltering.operator, 'Filtering expression operator value is not correct'); + expect(expressions.fieldName, 'Filtering expression field name is not correct').toBe(gridState.advancedFiltering.fieldName); + expect(expressions.operator, 'Filtering expression operator value is not correct').toBe(gridState.advancedFiltering.operator); expressions.filteringOperands.forEach((expr, i) => { expect(expr).toEqual(expect.objectContaining(gridState.advancedFiltering.filteringOperands[i])); }); diff --git a/projects/igniteui-angular/grids/grid/src/column-hiding.spec.ts b/projects/igniteui-angular/grids/grid/src/column-hiding.spec.ts index 58779f04df1..74a53d5039d 100644 --- a/projects/igniteui-angular/grids/grid/src/column-hiding.spec.ts +++ b/projects/igniteui-angular/grids/grid/src/column-hiding.spec.ts @@ -261,14 +261,14 @@ describe('Column Hiding UI #grid', () => { GridFunctions.clickColumnChooserItem(columnChooserElement, name); fix.detectChanges(); - expect(GridFunctions.getColumnChooserItemInput(checkbox).checked).toBe(true, 'Checkbox is not checked!'); + expect(GridFunctions.getColumnChooserItemInput(checkbox).checked, 'Checkbox is not checked!').toBe(true); ControlsFunction.verifyButtonIsDisabled(showAll); ControlsFunction.verifyButtonIsDisabled(hideAll, false); GridFunctions.clickColumnChooserItem(columnChooserElement, name); fix.detectChanges(); - expect(GridFunctions.getColumnChooserItemInput(checkbox).checked).toBe(false, 'Checkbox is not unchecked!'); + expect(GridFunctions.getColumnChooserItemInput(checkbox).checked, 'Checkbox is not unchecked!').toBe(false); ControlsFunction.verifyButtonIsDisabled(showAll, false); ControlsFunction.verifyButtonIsDisabled(hideAll); @@ -489,7 +489,7 @@ describe('Column Hiding UI #grid', () => { tick(); fix.detectChanges(); - expect(columnChooser.filterCriteria).toBe('', 'Filter criteria is not empty string!'); + expect(columnChooser.filterCriteria, 'Filter criteria is not empty string!').toBe(''); expect(GridFunctions.getColumnChooserItemInput(checkbox).checked).toBe(false); checkbox = GridFunctions.getColumnChooserItemElement(columnChooserElement, 'ID'); expect(GridFunctions.getColumnChooserItemInput(checkbox).checked).toBe(true); @@ -604,7 +604,7 @@ describe('Column Hiding UI #grid', () => { fix.detectChanges(); tick(); - expect(columnChooser.filterCriteria).toBe('', 'Filter criteria is not empty string!'); + expect(columnChooser.filterCriteria, 'Filter criteria is not empty string!').toBe(''); checkbox = GridFunctions.getColumnChooserItemElement(columnChooserElement, 'ID'); expect(GridFunctions.getColumnChooserItemInput(checkbox).checked).toBe(true); @@ -628,18 +628,18 @@ describe('Column Hiding UI #grid', () => { fix.detectChanges(); ControlsFunction.verifyButtonIsDisabled(showAll.nativeElement); - expect(grid.columnList.get(2).hidden).toBe(false, 'Downloads column is not hidden!'); + expect(grid.columnList.get(2).hidden, 'Downloads column is not hidden!').toBe(false); UIInteractions.triggerInputEvent(filterInput, ''); fix.detectChanges(); ControlsFunction.verifyButtonIsDisabled(showAll.nativeElement); - expect(grid.columnList.get(0).hidden).toBe(false, 'ID column is not shown!'); + expect(grid.columnList.get(0).hidden, 'ID column is not shown!').toBe(false); GridFunctions.clickColumnChooserItem(columnChooserElement, 'ID'); fix.detectChanges(); ControlsFunction.verifyButtonIsDisabled(showAll.nativeElement, false); - expect(grid.columnList.get(0).hidden).toBe(true, 'ID column is not hidden!'); + expect(grid.columnList.get(0).hidden, 'ID column is not hidden!').toBe(true); }); it('height can be controlled via columnsAreaMaxHeight input.', () => { diff --git a/projects/igniteui-angular/grids/grid/src/column.spec.ts b/projects/igniteui-angular/grids/grid/src/column.spec.ts index 8649f72baed..6d1e0919078 100644 --- a/projects/igniteui-angular/grids/grid/src/column.spec.ts +++ b/projects/igniteui-angular/grids/grid/src/column.spec.ts @@ -1629,11 +1629,11 @@ describe('IgxGrid - Column properties #grid', () => { .filter(attr => Boolean(attr)); for (const attr of gridAttributes) { - expect(grid[attr]).toBe(true, `Grid attribute: '${attr}' failed`); + expect(grid[attr], `Grid attribute: '${attr}' failed`).toBe(true); } for (const attr of columnAttributes) { - expect(column[attr]).toBe(true, `Column attribute: '${attr}' failed`); + expect(column[attr], `Column attribute: '${attr}' failed`).toBe(true); } })); }); diff --git a/projects/igniteui-angular/grids/grid/src/grid-filtering-advanced.spec.ts b/projects/igniteui-angular/grids/grid/src/grid-filtering-advanced.spec.ts index dacf8b0187c..65d323130bd 100644 --- a/projects/igniteui-angular/grids/grid/src/grid-filtering-advanced.spec.ts +++ b/projects/igniteui-angular/grids/grid/src/grid-filtering-advanced.spec.ts @@ -52,21 +52,21 @@ describe('IgxGrid - Advanced Filtering #grid - ', () => { it('Should show/hide Advanced Filtering button in toolbar based on respective input.', fakeAsync(() => { // Verify Advanced Filtering button in toolbar is visible. let advFilterButton = GridFunctions.getAdvancedFilteringButton(fix); - expect(advFilterButton !== null && advFilterButton !== undefined).toBe(true, 'Adv.Filter button is not visible.'); + expect(advFilterButton !== null && advFilterButton !== undefined, 'Adv.Filter button is not visible.').toBe(true); grid.allowAdvancedFiltering = false; fix.detectChanges(); // Verify Advanced Filtering button in toolbar is not visible. advFilterButton = GridFunctions.getAdvancedFilteringButton(fix); - expect(advFilterButton !== null && advFilterButton !== undefined).toBe(false, 'Adv.Filter button is visible.'); + expect(advFilterButton !== null && advFilterButton !== undefined, 'Adv.Filter button is visible.').toBe(false); grid.allowAdvancedFiltering = true; fix.detectChanges(); // Verify Advanced Filtering button in toolbar is visible. advFilterButton = GridFunctions.getAdvancedFilteringButton(fix); - expect(advFilterButton !== null && advFilterButton !== undefined).toBe(true, 'Adv.Filter button is not visible.'); + expect(advFilterButton !== null && advFilterButton !== undefined, 'Adv.Filter button is not visible.').toBe(true); })); it('Should correctly initialize the Advanced Filtering dialog.', fakeAsync(() => { @@ -172,8 +172,7 @@ describe('IgxGrid - Advanced Filtering #grid - ', () => { it('Should update the Advanced Filtering button in toolbar when (filtering)/(clear filtering).', fakeAsync(() => { // Verify that the advanced filtering button indicates there are no filters. let advFilterBtn = GridFunctions.getAdvancedFilteringButton(fix); - expect(Array.from(advFilterBtn.children).some(c => (c as any).classList.contains('igx-adv-filter--column-number'))) - .toBe(false, 'Button indicates there is active filtering.'); + expect(Array.from(advFilterBtn.children).some(c => (c as any).classList.contains('igx-adv-filter--column-number')), 'Button indicates there is active filtering.').toBe(false); // Open Advanced Filtering dialog. grid.openAdvancedFilteringDialog(); @@ -200,8 +199,7 @@ describe('IgxGrid - Advanced Filtering #grid - ', () => { // Verify that the advanced filtering button indicates there are filters. advFilterBtn = GridFunctions.getAdvancedFilteringButton(fix); - expect(Array.from(advFilterBtn.children).some(c => (c as any).classList.contains('igx-adv-filter--column-number'))) - .toBe(true, 'Button indicates there is no active filtering.'); + expect(Array.from(advFilterBtn.children).some(c => (c as any).classList.contains('igx-adv-filter--column-number')), 'Button indicates there is no active filtering.').toBe(true); // Open Advanced Filtering dialog. grid.openAdvancedFilteringDialog(); @@ -217,8 +215,7 @@ describe('IgxGrid - Advanced Filtering #grid - ', () => { // Verify that the advanced filtering button indicates there are no filters. advFilterBtn = GridFunctions.getAdvancedFilteringButton(fix); - expect(Array.from(advFilterBtn.children).some(c => (c as any).classList.contains('igx-adv-filter--column-number'))) - .toBe(false, 'Button indicates there is active filtering.'); + expect(Array.from(advFilterBtn.children).some(c => (c as any).classList.contains('igx-adv-filter--column-number')), 'Button indicates there is active filtering.').toBe(false); })); it('The Clear/Cancel/Apply buttons type should be set to "button"', fakeAsync(() => { @@ -234,9 +231,9 @@ describe('IgxGrid - Advanced Filtering #grid - ', () => { const expectedButtonType = 'button'; // Verify buttons type is set to "button". - expect(clearButtonType).toBe(expectedButtonType, 'Clear button type is not "button"'); - expect(cancelButtonType).toBe(expectedButtonType, 'Cancel button type is not "button"'); - expect(applyButtonType).toBe(expectedButtonType, 'Apply button type is not "button"'); + expect(clearButtonType, 'Clear button type is not "button"').toBe(expectedButtonType); + expect(cancelButtonType, 'Cancel button type is not "button"').toBe(expectedButtonType); + expect(applyButtonType, 'Apply button type is not "button"').toBe(expectedButtonType); })); it('Should emit the filtering event when applying filters.', fakeAsync(() => { @@ -973,7 +970,7 @@ describe('IgxGrid - Advanced Filtering #grid - ', () => { fix.detectChanges(); const rows = GridFunctions.getRows(fix); - expect(rows.length).toEqual(3, 'Wrong filtered rows count'); + expect(rows.length, 'Wrong filtered rows count').toEqual(3); })); it('Should filter by cells formatted data when using FormattedValuesFilteringStrategy with rowData', fakeAsync(() => { @@ -1007,7 +1004,7 @@ describe('IgxGrid - Advanced Filtering #grid - ', () => { fix.detectChanges(); const rows = GridFunctions.getRows(fix); - expect(rows.length).toEqual(1, 'Wrong filtered rows count'); + expect(rows.length, 'Wrong filtered rows count').toEqual(1); })); it('DateTime: Should set editorOptions.dateTimeFormat prop as inputFormat for the filter value editor', fakeAsync(() => { @@ -1913,8 +1910,8 @@ const verifyElementIsInExpressionsContainerView = (fix, element: HTMLElement) => const elementRect = element.getBoundingClientRect(); const exprContainer: HTMLElement = QueryBuilderFunctions.getQueryBuilderExpressionsContainer(fix) as HTMLElement; const exprContainerRect = exprContainer.getBoundingClientRect(); - expect(elementRect.top >= exprContainerRect.top).toBe(true, 'top is not in view'); - expect(elementRect.bottom <= exprContainerRect.bottom).toBe(true, 'bottom is not in view'); - expect(elementRect.left >= exprContainerRect.left).toBe(true, 'left is not in view'); - expect(elementRect.right <= exprContainerRect.right).toBe(true, 'right is not in view'); + expect(elementRect.top >= exprContainerRect.top, 'top is not in view').toBe(true); + expect(elementRect.bottom <= exprContainerRect.bottom, 'bottom is not in view').toBe(true); + expect(elementRect.left >= exprContainerRect.left, 'left is not in view').toBe(true); + expect(elementRect.right <= exprContainerRect.right, 'right is not in view').toBe(true); }; diff --git a/projects/igniteui-angular/grids/grid/src/grid-filtering-ui.spec.ts b/projects/igniteui-angular/grids/grid/src/grid-filtering-ui.spec.ts index 5d8b19cb200..936c44f2861 100644 --- a/projects/igniteui-angular/grids/grid/src/grid-filtering-ui.spec.ts +++ b/projects/igniteui-angular/grids/grid/src/grid-filtering-ui.spec.ts @@ -1464,7 +1464,7 @@ describe('IgxGrid - Filtering Row UI actions #grid', () => { const chipArea = filteringRow.query(By.css('igx-chip-area')); expect(GridFunctions.getFilterRowLeftArrowButton(fix)).toBeNull(); expect(GridFunctions.getFilterRowRightArrowButton(fix)).toBeNull(); - expect(chipArea).toBeNull('chipArea is present'); + expect(chipArea, 'chipArea is present').toBeNull(); })); it('Should remove first chip and filter by the remaining ones.', fakeAsync(() => { @@ -1529,7 +1529,7 @@ describe('IgxGrid - Filtering Row UI actions #grid', () => { let chip = GridFunctions.getFilterChipsForColumn('ReleaseDate', fix)[0].nativeElement; let chipRect = chip.getBoundingClientRect(); let gridRect = grid.nativeElement.getBoundingClientRect(); - expect(chipRect.right > gridRect.right).toBe(true, 'chip should not be fully visible and thus not within grid'); + expect(chipRect.right > gridRect.right, 'chip should not be fully visible and thus not within grid').toBe(true); GridFunctions.clickFilterCellChipUI(fix, 'ReleaseDate'); await wait(100); @@ -1543,7 +1543,7 @@ describe('IgxGrid - Filtering Row UI actions #grid', () => { chip = GridFunctions.getFilterChipsForColumn('ReleaseDate', fix)[0].nativeElement; chipRect = chip.getBoundingClientRect(); gridRect = grid.nativeElement.getBoundingClientRect(); - expect(chipRect.left > gridRect.left && chipRect.right < gridRect.right).toBe(true, 'chip should be fully visible and within grid'); + expect(chipRect.left > gridRect.left && chipRect.right < gridRect.right, 'chip should be fully visible and within grid').toBe(true); }); it('Verify condition chips are scrolled into/(out of) view by using arrow buttons.', (async () => { @@ -1837,7 +1837,7 @@ describe('IgxGrid - Filtering Row UI actions #grid', () => { fix.detectChanges(); // Verify chips count. - expect(GridFunctions.getFilterChipsForColumn('ProductName', fix).length).toBe(3, 'incorrect chips count'); + expect(GridFunctions.getFilterChipsForColumn('ProductName', fix).length, 'incorrect chips count').toBe(3); // Verify last chip text. let lastFilterCellChip = GridFunctions.getFilterChipsForColumn('ProductName', fix)[2]; @@ -1849,7 +1849,7 @@ describe('IgxGrid - Filtering Row UI actions #grid', () => { fix.detectChanges(); // Verify chips count. - expect(GridFunctions.getFilterChipsForColumn('ProductName', fix).length).toBe(2, 'incorrect chips count'); + expect(GridFunctions.getFilterChipsForColumn('ProductName', fix).length, 'incorrect chips count').toBe(2); // Verify new last chip text. lastFilterCellChip = GridFunctions.getFilterChipsForColumn('ProductName', fix)[1]; expect(GridFunctions.getChipText(lastFilterCellChip)).toBe('e'); @@ -1885,7 +1885,7 @@ describe('IgxGrid - Filtering Row UI actions #grid', () => { // Verify first chip is selected (in edit mode). const chipDiv = GridFunctions.getFilterConditionChip(fix, 0).querySelector('.igx-chip__item'); - expect(chipDiv.classList.contains('igx-chip__item--selected')).toBe(true, 'chip is not selected'); + expect(chipDiv.classList.contains('igx-chip__item--selected'), 'chip is not selected').toBe(true); })); it('Should not throw error when deleting the last chip', (async () => { @@ -1923,10 +1923,10 @@ describe('IgxGrid - Filtering Row UI actions #grid', () => { expect(chips.length).toBe(4); const leftArrowButton = GridFunctions.getFilterRowLeftArrowButton(fix).nativeElement; - expect(leftArrowButton).toBeTruthy('Left scroll arrow should be visible'); + expect(leftArrowButton, 'Left scroll arrow should be visible').toBeTruthy(); const rightArrowButton = GridFunctions.getFilterRowRightArrowButton(fix).nativeElement; - expect(rightArrowButton).toBeTruthy('Right scroll arrow should be visible'); + expect(rightArrowButton, 'Right scroll arrow should be visible').toBeTruthy(); expect(grid.rowList.length).toBe(2); let chipToRemove = filterUIRow.componentInstance.expressionsList[3]; @@ -2029,17 +2029,17 @@ describe('IgxGrid - Filtering Row UI actions #grid', () => { // Verify the the filterRow is closed. const filterUIRow = fix.debugElement.query(By.css(FILTER_UI_ROW)); - expect(filterUIRow).toBeNull('filterRow is visible'); + expect(filterUIRow, 'filterRow is visible').toBeNull(); // Verify the ESF icons are visible. const thead = grid.theadRow.nativeElement; const filterIcons = thead.querySelectorAll('.igx-excel-filter__icon'); - expect(filterIcons.length).toEqual(6, 'incorrect esf filter icons count'); + expect(filterIcons.length, 'incorrect esf filter icons count').toEqual(6); // Verify the condition was submitted. const header = GridFunctions.getColumnHeader('ProductName', fix); const activeFilterIcon = header.nativeElement.querySelector('.igx-excel-filter__icon--filtered'); - expect(activeFilterIcon).toBeDefined('no active filter icon was found'); + expect(activeFilterIcon, 'no active filter icon was found').toBeDefined(); })); it('Should clear non-unary conditions with null searchVal when close', fakeAsync(() => { @@ -2087,7 +2087,7 @@ describe('IgxGrid - Filtering Row UI actions #grid', () => { const chip = GridFunctions.getFilterConditionChip(fix, 0); const chipDiv = chip.querySelector('.igx-chip__item'); - expect(chipDiv.classList.contains('igx-chip__item--selected')).toBe(true, 'initial chip is committed'); + expect(chipDiv.classList.contains('igx-chip__item--selected'), 'initial chip is committed').toBe(true); // Focus out grid.nativeElement.focus(); @@ -2095,8 +2095,8 @@ describe('IgxGrid - Filtering Row UI actions #grid', () => { tick(200); fix.detectChanges(); - expect(chipDiv.classList.contains('igx-chip__item--selected')).toBe(false, 'initial chip is not committed'); - expect(input.value).toBe('', 'initial input value is present and not committed'); + expect(chipDiv.classList.contains('igx-chip__item--selected'), 'initial chip is not committed').toBe(false); + expect(input.value, 'initial input value is present and not committed').toBe(''); chip.click(); tick(200); @@ -2135,21 +2135,21 @@ describe('IgxGrid - Filtering Row UI actions #grid', () => { tick(200); fix.detectChanges(); - expect(chipDiv.classList.contains('igx-chip__item--selected')).toBe(true, 'chip is committed'); + expect(chipDiv.classList.contains('igx-chip__item--selected'), 'chip is committed').toBe(true); // Focus out grid.nativeElement.focus(); grid.filteringRow.onInputGroupFocusout(); tick(200); fix.detectChanges(); - expect(chipDiv.classList.contains('igx-chip__item--selected')).toBe(false, 'chip is selected'); + expect(chipDiv.classList.contains('igx-chip__item--selected'), 'chip is selected').toBe(false); // Check if we still have only one committed chip const chipsLength = GridFunctions.getAllFilterConditionChips(fix).length; - expect(chipsLength).toBe(1, 'there is more than one chip'); - expect(chipDiv.classList.contains('igx-chip__item--selected')).toBe(false, 'chip is not committed'); - expect(input.value).toBe('', 'input value is present and not committed'); + expect(chipsLength, 'there is more than one chip').toBe(1); + expect(chipDiv.classList.contains('igx-chip__item--selected'), 'chip is not committed').toBe(false); + expect(input.value, 'input value is present and not committed').toBe(''); })); it('should not retain expression values in cell filter after calling grid clearFilter() method.', fakeAsync(() => { @@ -2316,7 +2316,7 @@ describe('IgxGrid - Filtering Row UI actions #grid', () => { fix.detectChanges(); const chips = filterRow.queryAll(By.directive(IgxChipComponent)); - expect(chips.length).toEqual(0, 'No chips should be present'); + expect(chips.length, 'No chips should be present').toEqual(0); })); it('Should not throw error when pressing Backspace in empty dateTime filter.', fakeAsync(() => { @@ -2443,7 +2443,7 @@ describe('IgxGrid - Filtering Row UI actions #grid', () => { // Check that the filterRow is closed filterUIRow = fix.debugElement.query(By.css(FILTER_UI_ROW)); expect(filterUIRow).toBeNull(); - expect(grid.rowList.length).toBe(3, 'filter is not applied'); + expect(grid.rowList.length, 'filter is not applied').toBe(3); })); it('Should keep existing column filter after hiding another column.', fakeAsync(() => { @@ -2833,10 +2833,10 @@ describe('IgxGrid - Filtering Row UI actions #grid', () => { it('Should render custom filter template instead of default one.', fakeAsync(() => { // Verify default filter template is not present. - expect(GridFunctions.getFilterCell(fix, 'ProductName').query(By.css('.igx-filtering-chips'))).toBeNull('\'ProductName\' default filter chips area template was found.'); - expect(GridFunctions.getFilterCell(fix, 'Downloads').query(By.css('.igx-filtering-chips'))).toBeNull('\'Downloads\' default filter chips area template was found.'); - expect(GridFunctions.getFilterCell(fix, 'Released').query(By.css('.igx-filtering-chips'))).toBeNull('\'Released\' default filter chips area template was found.'); - expect(GridFunctions.getFilterCell(fix, 'ReleaseDate').query(By.css('.igx-filtering-chips'))).toBeNull('\'ReleaseDate\' default filter chips area template was found.'); + expect(GridFunctions.getFilterCell(fix, 'ProductName').query(By.css('.igx-filtering-chips')), '\'ProductName\' default filter chips area template was found.').toBeNull(); + expect(GridFunctions.getFilterCell(fix, 'Downloads').query(By.css('.igx-filtering-chips')), '\'Downloads\' default filter chips area template was found.').toBeNull(); + expect(GridFunctions.getFilterCell(fix, 'Released').query(By.css('.igx-filtering-chips')), '\'Released\' default filter chips area template was found.').toBeNull(); + expect(GridFunctions.getFilterCell(fix, 'ReleaseDate').query(By.css('.igx-filtering-chips')), '\'ReleaseDate\' default filter chips area template was found.').toBeNull(); // Verify the custom filter template is present. expect(GridFunctions.getFilterCell(fix, 'ProductName').query(By.css('.custom-filter'))).not.toBeNull('\'ProductName\' customer filter template was not found.'); @@ -2861,7 +2861,7 @@ describe('IgxGrid - Filtering Row UI actions #grid', () => { // Expect the filter row is closed filterUIRow = fix.debugElement.query(By.css(FILTER_UI_ROW)); - expect(filterUIRow).toBeNull('Default filter template was found on a column with custom filtering.'); + expect(filterUIRow, 'Default filter template was found on a column with custom filtering.').toBeNull(); })); it('Should not prevent mousedown event when target is within the filter cell template', fakeAsync(() => { @@ -3893,7 +3893,7 @@ describe('IgxGrid - Filtering actions - Excel style filtering #grid', () => { await wait(100); const searchComponent = GridFunctions.getExcelStyleSearchComponent(fix); let listItems = GridFunctions.getExcelStyleSearchComponentListItems(fix, searchComponent); - expect(listItems.length).toBe(6, 'incorrect rendered list items count'); + expect(listItems.length, 'incorrect rendered list items count').toBe(6); // Type string in search box. const inputNativeElement = GridFunctions.getExcelStyleSearchComponentInput(fix, searchComponent); @@ -3902,7 +3902,7 @@ describe('IgxGrid - Filtering actions - Excel style filtering #grid', () => { await wait(100); listItems = GridFunctions.getExcelStyleSearchComponentListItems(fix, searchComponent); - expect(listItems.length).toBe(4, 'incorrect rendered list items count'); + expect(listItems.length, 'incorrect rendered list items count').toBe(4); // Clear filtering of ESF search. const clearIcon: any = Array.from(searchComponent.querySelectorAll('igx-icon')) @@ -3911,7 +3911,7 @@ describe('IgxGrid - Filtering actions - Excel style filtering #grid', () => { fix.detectChanges(); listItems = GridFunctions.getExcelStyleSearchComponentListItems(fix, searchComponent); - expect(listItems.length).toBe(6, 'incorrect rendered list items count'); + expect(listItems.length, 'incorrect rendered list items count').toBe(6); }); it('Should allow to input commas in excel search component input field when column dataType is number.', async () => { @@ -3928,7 +3928,7 @@ describe('IgxGrid - Filtering actions - Excel style filtering #grid', () => { await wait(100); listItems = GridFunctions.getExcelStyleSearchComponentListItems(fix, searchComponent); - expect(listItems.length).toBe(3, 'incorrect rendered list items count'); + expect(listItems.length, 'incorrect rendered list items count').toBe(3); // Type non-numerical symbol in search box. UIInteractions.clickAndSendInputElementValue(inputNativeElement, 'a', fix); @@ -3936,8 +3936,8 @@ describe('IgxGrid - Filtering actions - Excel style filtering #grid', () => { await wait(100); listItems = GridFunctions.getExcelStyleSearchComponentListItems(fix, searchComponent); - expect(inputNativeElement.value).toBe('', 'incorrect rendered list items count'); - expect(listItems.length).toBe(8, 'incorrect rendered list items count'); + expect(inputNativeElement.value, 'incorrect rendered list items count').toBe(''); + expect(listItems.length, 'incorrect rendered list items count').toBe(8); }); it('Should enable/disable the apply button correctly.', async () => { @@ -3947,7 +3947,7 @@ describe('IgxGrid - Filtering actions - Excel style filtering #grid', () => { // Verify there are filtered-in results and that apply button is enabled. const listItems = GridFunctions.getExcelStyleSearchComponentListItems(fix); let applyButton = GridFunctions.getApplyButtonExcelStyleFiltering(fix) as HTMLElement; - expect(listItems.length).toBe(6, 'ESF search result should NOT be empty'); + expect(listItems.length, 'ESF search result should NOT be empty').toBe(6); ControlsFunction.verifyButtonIsDisabled(applyButton, false); // Verify the apply button is disabled when all items are unchecked (when unchecking 'Select All'). @@ -4209,7 +4209,7 @@ describe('IgxGrid - Filtering actions - Excel style filtering #grid', () => { // Verify that the first item is 'Select All' and the third item is 'false'. const listItems = GridFunctions.getExcelStyleSearchComponentListItems(fix, searchComponent); - expect(listItems.length).toBe(3, 'incorrect rendered list items count'); + expect(listItems.length, 'incorrect rendered list items count').toBe(3); expect(listItems[0].innerText).toBe('Select all search results'); expect(listItems[2].innerText).toBe('False'); })); @@ -4252,10 +4252,10 @@ describe('IgxGrid - Filtering actions - Excel style filtering #grid', () => { const displayContainerRect = displayContainer.getBoundingClientRect(); const listHeight = searchComponent.querySelector('igx-list').getBoundingClientRect().height; const itemHeight = displayContainer.querySelector('igx-list-item').getBoundingClientRect().height; - expect(displayContainerRect.height > listHeight + itemHeight && displayContainerRect.height < listHeight + (itemHeight * 2)).toBe(true, 'incorrect search display container height'); + expect(displayContainerRect.height > listHeight + itemHeight && displayContainerRect.height < listHeight + (itemHeight * 2), 'incorrect search display container height').toBe(true); // Verify rendered list items count. const listItems = displayContainer.querySelectorAll('igx-list-item'); - expect(listItems.length).toBe(Math.ceil(listHeight / itemHeight) + 1, 'incorrect rendered list items count'); + expect(listItems.length, 'incorrect rendered list items count').toBe(Math.ceil(listHeight / itemHeight) + 1); })); it('should correctly display all items in search list after filtering it', (async () => { @@ -4297,8 +4297,8 @@ describe('IgxGrid - Filtering actions - Excel style filtering #grid', () => { const displayContainerRect = displayContainer.getBoundingClientRect(); const listNativeElement = searchComponent.querySelector('.igx-list'); const listRect = listNativeElement.getBoundingClientRect(); - expect(displayContainerRect.top >= listRect.top).toBe(true, 'displayContainer starts above list'); - expect(displayContainerRect.bottom <= listRect.bottom).toBe(true, 'displayContainer ends below list'); + expect(displayContainerRect.top >= listRect.top, 'displayContainer starts above list').toBe(true); + expect(displayContainerRect.bottom <= listRect.bottom, 'displayContainer ends below list').toBe(true); })); it('Should not treat \'Select All\' as a search result.', async () => { @@ -4359,14 +4359,14 @@ describe('IgxGrid - Filtering actions - Excel style filtering #grid', () => { const lastExpression = expressions[expressions.length - 1]; const lastExpressionRect = lastExpression.getBoundingClientRect(); const expressionsContainerRect = expressionsContainer.getBoundingClientRect(); - expect(lastExpressionRect.top >= expressionsContainerRect.top).toBe(true, 'lastExpression starts above expressionsContainer'); - expect(lastExpressionRect.bottom <= expressionsContainerRect.bottom).toBe(true, 'lastExpression ends below expressionsContainer'); + expect(lastExpressionRect.top >= expressionsContainerRect.top, 'lastExpression starts above expressionsContainer').toBe(true); + expect(lastExpressionRect.bottom <= expressionsContainerRect.bottom, 'lastExpression ends below expressionsContainer').toBe(true); // Verify addFilter button is currently in view beneath the last expression. const addFilterButton = GridFunctions.getAddFilterExcelStyleCustomFiltering(fix); const addFilterButtonRect = addFilterButton.getBoundingClientRect(); - expect(addFilterButtonRect.top >= lastExpressionRect.bottom).toBe(true, 'addFilterButton overlaps lastExpression'); - expect(addFilterButtonRect.bottom <= expressionsContainerRect.bottom).toBe(true, 'addFilterButton ends below expressionsContainer'); + expect(addFilterButtonRect.top >= lastExpressionRect.bottom, 'addFilterButton overlaps lastExpression').toBe(true); + expect(addFilterButtonRect.bottom <= expressionsContainerRect.bottom, 'addFilterButton ends below expressionsContainer').toBe(true); })); it('Should generate "equals" conditions when selecting two values.', fakeAsync(() => { @@ -4485,7 +4485,7 @@ describe('IgxGrid - Filtering actions - Excel style filtering #grid', () => { await wait(DEBOUNCE_TIME); fix.detectChanges(); - expect(isExcelSearchScrollBarVisible(fix)).toBe(true, 'excel search scrollbar should be visible'); + expect(isExcelSearchScrollBarVisible(fix), 'excel search scrollbar should be visible').toBe(true); GridFunctions.clickApplyExcelStyleFiltering(fix); fix.detectChanges(); @@ -4498,7 +4498,7 @@ describe('IgxGrid - Filtering actions - Excel style filtering #grid', () => { await wait(DEBOUNCE_TIME); fix.detectChanges(); - expect(isExcelSearchScrollBarVisible(fix)).toBe(false, 'excel search scrollbar should NOT be visible'); + expect(isExcelSearchScrollBarVisible(fix), 'excel search scrollbar should NOT be visible').toBe(false); GridFunctions.clickApplyExcelStyleFiltering(fix); fix.detectChanges(); @@ -4511,7 +4511,7 @@ describe('IgxGrid - Filtering actions - Excel style filtering #grid', () => { await wait(DEBOUNCE_TIME); fix.detectChanges(); - expect(isExcelSearchScrollBarVisible(fix)).toBe(false, 'excel search scrollbar should NOT be visible'); + expect(isExcelSearchScrollBarVisible(fix), 'excel search scrollbar should NOT be visible').toBe(false); })); it('Should cascade filter the available filter options.', fakeAsync(() => { @@ -4662,9 +4662,9 @@ describe('IgxGrid - Filtering actions - Excel style filtering #grid', () => { const gridRect = gridNativeElement.getBoundingClientRect(); const excelMenu = GridFunctions.getExcelStyleFilteringComponent(fix); const excelMenuRect = excelMenu.getBoundingClientRect(); - expect(excelMenuRect.left >= gridRect.left).toBe(true, 'ESF spans outside the grid on the left'); - expect(excelMenuRect.top >= gridRect.top).toBe(true, 'ESF spans outside the grid on the top'); - expect(excelMenuRect.right <= gridRect.right).toBe(true, 'ESF spans outside the grid on the right'); + expect(excelMenuRect.left >= gridRect.left, 'ESF spans outside the grid on the left').toBe(true); + expect(excelMenuRect.top >= gridRect.top, 'ESF spans outside the grid on the top').toBe(true); + expect(excelMenuRect.right <= gridRect.right, 'ESF spans outside the grid on the right').toBe(true); }); it('Should add/remove expressions in custom filter dialog through UI correctly.', fakeAsync(() => { @@ -5480,7 +5480,7 @@ describe('IgxGrid - Filtering actions - Excel style filtering #grid', () => { const cell1 = GridFunctions.getRowCells(fix, 0)[4].nativeElement; const cell2 = GridFunctions.getRowCells(fix, 3)[4].nativeElement; expect(cell1.textContent.toString()).toEqual(cell2.textContent.toString()); - expect(rows.length).toBe(6, 'incorrect number of rows'); + expect(rows.length, 'incorrect number of rows').toBe(6); //Check if checkboxes have correct state on ESF menu reopening GridFunctions.clickExcelFilterIcon(fix, 'ReleaseDate'); @@ -5524,7 +5524,7 @@ describe('IgxGrid - Filtering actions - Excel style filtering #grid', () => { fix.detectChanges(); listItems = GridFunctions.getExcelStyleSearchComponentListItems(fix, searchComponent); - expect(listItems.length).toBe(0, 'incorrect rendered list items count'); + expect(listItems.length, 'incorrect rendered list items count').toBe(0); })); it('Should filter ISO 8601 date by input string', fakeAsync(() => { @@ -5562,7 +5562,7 @@ describe('IgxGrid - Filtering actions - Excel style filtering #grid', () => { fix.detectChanges(); listItems = GridFunctions.getExcelStyleSearchComponentListItems(fix, searchComponent); - expect(listItems.length).toBe(0, 'incorrect rendered list items count'); + expect(listItems.length, 'incorrect rendered list items count').toBe(0); })); it('Should filter milliseconds date by input string', fakeAsync(() => { @@ -5600,7 +5600,7 @@ describe('IgxGrid - Filtering actions - Excel style filtering #grid', () => { fix.detectChanges(); listItems = GridFunctions.getExcelStyleSearchComponentListItems(fix, searchComponent); - expect(listItems.length).toBe(0, 'incorrect rendered list items count'); + expect(listItems.length, 'incorrect rendered list items count').toBe(0); })); it('Should ignore duplicate records when column\'s filteringIgnoreCase is true', fakeAsync(() => { @@ -5638,7 +5638,7 @@ describe('IgxGrid - Filtering actions - Excel style filtering #grid', () => { // Verify that the second item is 'Add to current filter selection'. const listItems = GridFunctions.getExcelStyleSearchComponentListItems(fix, searchComponent); - expect(listItems.length).toBe(6, 'incorrect rendered list items count'); + expect(listItems.length, 'incorrect rendered list items count').toBe(6); expect(listItems[1].innerText).toBe('Add current selection to filter'); })); @@ -5988,7 +5988,7 @@ describe('IgxGrid - Filtering actions - Excel style filtering #grid', () => { excelMenu = GridFunctions.getExcelStyleFilteringComponent(fix); expect(excelMenu).not.toBeNull(); - expect(inputNativeElement.value).toBe('', 'input isn\'t cleared correctly'); + expect(inputNativeElement.value, 'input isn\'t cleared correctly').toBe(''); })); it('Should clear search criteria when selecting clear column filters option.', fakeAsync(() => { @@ -6017,14 +6017,14 @@ describe('IgxGrid - Filtering actions - Excel style filtering #grid', () => { UIInteractions.clickAndSendInputElementValue(inputNativeElement, 'Net', fix); const listItems = GridFunctions.getExcelStyleSearchComponentListItems(fix); - expect(listItems.length).toBe(3, 'incorrect rendered list items count'); + expect(listItems.length, 'incorrect rendered list items count').toBe(3); GridFunctions.clickClearFilterInExcelStyleFiltering(fix); flush(); expect(grid.filteredData).toBeNull(); inputNativeElement = GridFunctions.getExcelStyleSearchComponentInput(fix); - expect(inputNativeElement.value).toBe('', 'search criteria is not cleared'); + expect(inputNativeElement.value, 'search criteria is not cleared').toBe(''); checkboxes = GridFunctions.getExcelStyleFilteringCheckboxes(fix); const listItemsCheckboxes = checkboxes.slice(1, checkboxes.length); @@ -6083,9 +6083,9 @@ describe('IgxGrid - Filtering actions - Excel style filtering #grid', () => { const searchComponent = GridFunctions.getExcelStyleSearchComponent(fix); const listItems = GridFunctions.getExcelStyleSearchComponentListItems(fix, searchComponent); - expect(listItems.length).toBe(4, 'incorrect rendered list items count'); - expect(listItems[2].innerText).toBe('False', 'incorrect list item label'); - expect(listItems[3].innerText).toBe('True', 'incorrect list item label'); + expect(listItems.length, 'incorrect rendered list items count').toBe(4); + expect(listItems[2].innerText, 'incorrect list item label').toBe('False'); + expect(listItems[3].innerText, 'incorrect list item label').toBe('True'); const checkboxes = GridFunctions.getExcelStyleFilteringCheckboxes(fix); checkboxes[3].click(); @@ -6111,9 +6111,9 @@ describe('IgxGrid - Filtering actions - Excel style filtering #grid', () => { const searchComponent = GridFunctions.getExcelStyleSearchComponent(fix); const listItems = GridFunctions.getExcelStyleSearchComponentListItems(fix, searchComponent); - expect(listItems.length).toBe(4, 'incorrect rendered list items count'); - expect(listItems[2].innerText).toBe('No', 'incorrect list item label'); - expect(listItems[3].innerText).toBe('Yes', 'incorrect list item label'); + expect(listItems.length, 'incorrect rendered list items count').toBe(4); + expect(listItems[2].innerText, 'incorrect list item label').toBe('No'); + expect(listItems[3].innerText, 'incorrect list item label').toBe('Yes'); }); it('Should sort items in excel style search correctly', fakeAsync(() => { @@ -6308,7 +6308,7 @@ describe('IgxGrid - Filtering actions - Excel style filtering #grid', () => { const searchComponent = GridFunctions.getExcelStyleSearchComponent(fix); let listItems = GridFunctions.getExcelStyleSearchComponentListItems(fix, searchComponent); - expect(listItems.length).toBe(6, 'incorrect rendered list items count'); + expect(listItems.length, 'incorrect rendered list items count').toBe(6); // Type string in search box. const inputNativeElement = GridFunctions.getExcelStyleSearchComponentInput(fix, searchComponent); @@ -6317,7 +6317,7 @@ describe('IgxGrid - Filtering actions - Excel style filtering #grid', () => { fix.detectChanges(); listItems = GridFunctions.getExcelStyleSearchComponentListItems(fix, searchComponent); - expect(listItems.length).toBe(4, 'incorrect rendered list items count'); + expect(listItems.length, 'incorrect rendered list items count').toBe(4); // Clear filtering of ESF search. const clearIcon: any = Array.from(searchComponent.querySelectorAll('igx-icon')) @@ -6326,7 +6326,7 @@ describe('IgxGrid - Filtering actions - Excel style filtering #grid', () => { fix.detectChanges(); listItems = GridFunctions.getExcelStyleSearchComponentListItems(fix, searchComponent); - expect(listItems.length).toBe(6, 'incorrect rendered list items count'); + expect(listItems.length, 'incorrect rendered list items count').toBe(6); tick(100); })); @@ -6416,13 +6416,13 @@ describe('IgxGrid - Filtering actions - Excel style filtering #grid', () => { UIInteractions.clickAndSendInputElementValue(inputNativeElement, 20, fix); const listItems = GridFunctions.getExcelStyleSearchComponentListItems(fix); - expect(listItems.length).toBe(3, 'incorrect rendered list items count'); + expect(listItems.length, 'incorrect rendered list items count').toBe(3); GridFunctions.clickExcelFilterIconFromCode(fix, grid, 'ProductName'); flush(); inputNativeElement = GridFunctions.getExcelStyleSearchComponentInput(fix); - expect(inputNativeElement.value).toBe('', 'input value didn\'t reset'); + expect(inputNativeElement.value, 'input value didn\'t reset').toBe(''); })); it('Should reset blank items on column change.', fakeAsync(() => { @@ -6498,7 +6498,7 @@ describe('IgxGrid - Filtering actions - Excel style filtering #grid', () => { // Update scrollbar scrollbar = GridFunctions.getExcelStyleSearchComponentScrollbar(fix); - expect(scrollbar.scrollTop).toBe(0, 'search scrollbar did not reset'); + expect(scrollbar.scrollTop, 'search scrollbar did not reset').toBe(0); }); }); @@ -6519,7 +6519,7 @@ describe('IgxGrid - Filtering actions - Excel style filtering #grid', () => { // Verify items in search have not loaded yet and that the loading indicator is visible. let listItems = GridFunctions.getExcelStyleSearchComponentListItems(fix); - expect(listItems.length).toBe(0, 'incorrect rendered list items count'); + expect(listItems.length, 'incorrect rendered list items count').toBe(0); let loadingIndicator = GridFunctions.getExcelFilteringLoadingIndicator(fix); expect(loadingIndicator).not.toBeNull('esf loading indicator is not visible'); @@ -6528,9 +6528,9 @@ describe('IgxGrid - Filtering actions - Excel style filtering #grid', () => { // Verify items in search have loaded and that the loading indicator is not visible. listItems = GridFunctions.getExcelStyleSearchComponentListItems(fix); - expect(listItems.length).toBe(6, 'incorrect rendered list items count'); + expect(listItems.length, 'incorrect rendered list items count').toBe(6); loadingIndicator = GridFunctions.getExcelFilteringLoadingIndicator(fix); - expect(loadingIndicator).toBeNull('esf loading indicator is visible'); + expect(loadingIndicator, 'esf loading indicator is visible').toBeNull(); })); it('Verify unique values are loaded correctly in ESF search component when using filtering strategy.', fakeAsync(() => { @@ -6545,7 +6545,7 @@ describe('IgxGrid - Filtering actions - Excel style filtering #grid', () => { // Verify items in search have not loaded yet and that the loading indicator is visible. let listItems = GridFunctions.getExcelStyleSearchComponentListItems(fix); - expect(listItems.length).toBe(0, 'incorrect rendered list items count'); + expect(listItems.length, 'incorrect rendered list items count').toBe(0); let loadingIndicator = GridFunctions.getExcelFilteringLoadingIndicator(fix); expect(loadingIndicator).not.toBeNull('esf loading indicator is not visible'); @@ -6554,9 +6554,9 @@ describe('IgxGrid - Filtering actions - Excel style filtering #grid', () => { // Verify items in search have loaded and that the loading indicator is not visible. listItems = GridFunctions.getExcelStyleSearchComponentListItems(fix); - expect(listItems.length).toBe(6, 'incorrect rendered list items count'); + expect(listItems.length, 'incorrect rendered list items count').toBe(6); loadingIndicator = GridFunctions.getExcelFilteringLoadingIndicator(fix); - expect(loadingIndicator).toBeNull('esf loading indicator is visible'); + expect(loadingIndicator, 'esf loading indicator is visible').toBeNull(); })); it('Verify unique date values are loaded correctly in ESF search component.', fakeAsync(() => { @@ -6567,7 +6567,7 @@ describe('IgxGrid - Filtering actions - Excel style filtering #grid', () => { // Verify items in search have not loaded yet and that the loading indicator is visible. let listItems = GridFunctions.getExcelStyleSearchComponentListItems(fix); - expect(listItems.length).toBe(0, 'incorrect rendered list items count'); + expect(listItems.length, 'incorrect rendered list items count').toBe(0); let loadingIndicator = GridFunctions.getExcelFilteringLoadingIndicator(fix); expect(loadingIndicator).not.toBeNull('esf loading indicator is not visible'); @@ -6576,9 +6576,9 @@ describe('IgxGrid - Filtering actions - Excel style filtering #grid', () => { // Verify items in search have loaded and that the loading indicator is not visible. listItems = GridFunctions.getExcelStyleSearchComponentListItems(fix); - expect(listItems.length).toBe(7, 'incorrect rendered list items count'); + expect(listItems.length, 'incorrect rendered list items count').toBe(7); loadingIndicator = GridFunctions.getExcelFilteringLoadingIndicator(fix); - expect(loadingIndicator).toBeNull('esf loading indicator is visible'); + expect(loadingIndicator, 'esf loading indicator is visible').toBeNull(); })); it('Verify unique ISO 8601 date values are loaded correctly in ESF search component.', fakeAsync(() => { @@ -6596,7 +6596,7 @@ describe('IgxGrid - Filtering actions - Excel style filtering #grid', () => { // Verify items in search have not loaded yet and that the loading indicator is visible. let listItems = GridFunctions.getExcelStyleSearchComponentListItems(fix); - expect(listItems.length).toBe(0, 'incorrect rendered list items count'); + expect(listItems.length, 'incorrect rendered list items count').toBe(0); let loadingIndicator = GridFunctions.getExcelFilteringLoadingIndicator(fix); expect(loadingIndicator).not.toBeNull('esf loading indicator is not visible'); @@ -6605,9 +6605,9 @@ describe('IgxGrid - Filtering actions - Excel style filtering #grid', () => { // Verify items in search have loaded and that the loading indicator is not visible. listItems = GridFunctions.getExcelStyleSearchComponentListItems(fix); - expect(listItems.length).toBe(7, 'incorrect rendered list items count'); + expect(listItems.length, 'incorrect rendered list items count').toBe(7); loadingIndicator = GridFunctions.getExcelFilteringLoadingIndicator(fix); - expect(loadingIndicator).toBeNull('esf loading indicator is visible'); + expect(loadingIndicator, 'esf loading indicator is visible').toBeNull(); })); it('Verify unique milliseconds date values are loaded correctly in ESF search component.', fakeAsync(() => { @@ -6625,7 +6625,7 @@ describe('IgxGrid - Filtering actions - Excel style filtering #grid', () => { // Verify items in search have not loaded yet and that the loading indicator is visible. let listItems = GridFunctions.getExcelStyleSearchComponentListItems(fix); - expect(listItems.length).toBe(0, 'incorrect rendered list items count'); + expect(listItems.length, 'incorrect rendered list items count').toBe(0); let loadingIndicator = GridFunctions.getExcelFilteringLoadingIndicator(fix); expect(loadingIndicator).not.toBeNull('esf loading indicator is not visible'); @@ -6634,9 +6634,9 @@ describe('IgxGrid - Filtering actions - Excel style filtering #grid', () => { // Verify items in search have loaded and that the loading indicator is not visible. listItems = GridFunctions.getExcelStyleSearchComponentListItems(fix); - expect(listItems.length).toBe(7, 'incorrect rendered list items count'); + expect(listItems.length, 'incorrect rendered list items count').toBe(7); loadingIndicator = GridFunctions.getExcelFilteringLoadingIndicator(fix); - expect(loadingIndicator).toBeNull('esf loading indicator is visible'); + expect(loadingIndicator, 'esf loading indicator is visible').toBeNull(); })); it('Verify date values are displayed in correct format according to column pipeArgs', fakeAsync(() => { @@ -6664,7 +6664,7 @@ describe('IgxGrid - Filtering actions - Excel style filtering #grid', () => { // Verify items in search have loaded and that the loading indicator is not visible. let listItems = GridFunctions.getExcelStyleSearchComponentListItems(fix); - expect(listItems.length).toBe(7, 'incorrect rendered list items count'); + expect(listItems.length, 'incorrect rendered list items count').toBe(7); for (let i = 2; i < listItems.length; i++) { const label = datePipe.transform(dates[i - 2], formatOptions.format); @@ -6672,7 +6672,7 @@ describe('IgxGrid - Filtering actions - Excel style filtering #grid', () => { } const loadingIndicator = GridFunctions.getExcelFilteringLoadingIndicator(fix); - expect(loadingIndicator).toBeNull('esf loading indicator is visible'); + expect(loadingIndicator, 'esf loading indicator is visible').toBeNull(); // Open excel style custom filtering dialog and wait a bit. GridFunctions.clickExcelFilterIcon(fix, 'Downloads'); @@ -6681,7 +6681,7 @@ describe('IgxGrid - Filtering actions - Excel style filtering #grid', () => { // Verify items in search have loaded and that the loading indicator is not visible. listItems = GridFunctions.getExcelStyleSearchComponentListItems(fix); - expect(listItems.length).toBe(7, 'incorrect rendered list items count'); + expect(listItems.length, 'incorrect rendered list items count').toBe(7); listItems.forEach((item, ind) => { expect(item.innerText).toBe(downloads[ind]); @@ -6712,7 +6712,7 @@ describe('IgxGrid - Filtering actions - Excel style filtering #grid', () => { // Verify items in search have loaded and that the loading indicator is not visible. const listItems = GridFunctions.getExcelStyleSearchComponentListItems(fix); - expect(listItems.length).toBe(7, 'incorrect rendered list items count'); + expect(listItems.length, 'incorrect rendered list items count').toBe(7); expect(listItems[1].innerText).toBe('(Blanks)'); for (let i = 2; i < listItems.length; i++) { @@ -6722,7 +6722,7 @@ describe('IgxGrid - Filtering actions - Excel style filtering #grid', () => { } const loadingIndicator = GridFunctions.getExcelFilteringLoadingIndicator(fix); - expect(loadingIndicator).toBeNull('esf loading indicator is visible'); + expect(loadingIndicator, 'esf loading indicator is visible').toBeNull(); })); it('Verify date values are displayed in correct format according to column formatter after filtering', fakeAsync(() => { @@ -6745,7 +6745,7 @@ describe('IgxGrid - Filtering actions - Excel style filtering #grid', () => { // Verify items in search have loaded and that the loading indicator is not visible. let listItems = GridFunctions.getExcelStyleSearchComponentListItems(fix); - expect(listItems.length).toBe(7, 'incorrect rendered list items count'); + expect(listItems.length, 'incorrect rendered list items count').toBe(7); const checkboxElements = GridFunctions.getExcelStyleFilteringCheckboxes(fix); checkboxElements[2].click(); @@ -6761,7 +6761,7 @@ describe('IgxGrid - Filtering actions - Excel style filtering #grid', () => { fix.detectChanges(); listItems = GridFunctions.getExcelStyleSearchComponentListItems(fix); - expect(listItems.length).toBe(7, 'incorrect rendered list items count'); + expect(listItems.length, 'incorrect rendered list items count').toBe(7); expect(listItems[1].innerText).toBe('(Blanks)'); for (let i = 2; i < listItems.length; i++) { @@ -6771,7 +6771,7 @@ describe('IgxGrid - Filtering actions - Excel style filtering #grid', () => { } const loadingIndicator = GridFunctions.getExcelFilteringLoadingIndicator(fix); - expect(loadingIndicator).toBeNull('esf loading indicator is visible'); + expect(loadingIndicator, 'esf loading indicator is visible').toBeNull(); })); it('Done callback should be executed only once per column', fakeAsync(() => { @@ -6782,20 +6782,20 @@ describe('IgxGrid - Filtering actions - Excel style filtering #grid', () => { fix.detectChanges(); // Verify items in search have loaded and that the loading indicator is not visible. - expect(compInstance.doneCallbackCounter).toBe(1, 'Incorrect done callback execution count'); + expect(compInstance.doneCallbackCounter, 'Incorrect done callback execution count').toBe(1); let listItems = GridFunctions.getExcelStyleSearchComponentListItems(fix); - expect(listItems.length).toBe(6, 'incorrect rendered list items count'); + expect(listItems.length, 'incorrect rendered list items count').toBe(6); let loadingIndicator = GridFunctions.getExcelFilteringLoadingIndicator(fix); - expect(loadingIndicator).toBeNull('esf loading indicator is visible'); + expect(loadingIndicator, 'esf loading indicator is visible').toBeNull(); GridFunctions.clickExcelFilterIcon(fix, 'Downloads'); tick(1000); fix.detectChanges(); - expect(compInstance.doneCallbackCounter).toBe(2, 'Incorrect done callback execution count'); + expect(compInstance.doneCallbackCounter, 'Incorrect done callback execution count').toBe(2); listItems = GridFunctions.getExcelStyleSearchComponentListItems(fix); - expect(listItems.length).toBe(7, 'incorrect rendered list items count'); + expect(listItems.length, 'incorrect rendered list items count').toBe(7); loadingIndicator = GridFunctions.getExcelFilteringLoadingIndicator(fix); - expect(loadingIndicator).toBeNull('esf loading indicator is visible'); + expect(loadingIndicator, 'esf loading indicator is visible').toBeNull(); })); it('Should not execute done callback for null column', fakeAsync(() => { @@ -7226,26 +7226,26 @@ const verifyPinningHidingSize = (fix: ComponentFixture, expectedSize: ɵSiz if (expectedSize === ɵSize.Large) { // Verify icons in header are not present. - expect(headerAreaPinIcon === null || headerAreaPinIcon === undefined).toBe(true, 'headerArea pin icon is present'); - expect(headerAreaUnpinIcon === null || headerAreaUnpinIcon === undefined).toBe(true, 'headerArea unpin icon is present'); - expect(headerAreaColumnHidingIcon === null || headerAreaColumnHidingIcon === undefined).toBe(true, 'headerArea column hiding icon is present'); + expect(headerAreaPinIcon === null || headerAreaPinIcon === undefined, 'headerArea pin icon is present').toBe(true); + expect(headerAreaUnpinIcon === null || headerAreaUnpinIcon === undefined, 'headerArea unpin icon is present').toBe(true); + expect(headerAreaColumnHidingIcon === null || headerAreaColumnHidingIcon === undefined, 'headerArea column hiding icon is present').toBe(true); // Verify icons in actions area are present. - expect(actionsPinArea !== null).toBe(true, 'actionsArea pin/unpin icon is NOT present'); + expect(actionsPinArea !== null, 'actionsArea pin/unpin icon is NOT present').toBe(true); expect(actionsAreaColumnHidingIcon).not.toBeNull('actionsArea column hiding icon is NOT present'); } else { // Verify icons in header are present. - expect((headerAreaPinIcon !== null) || (headerAreaUnpinIcon !== null)).toBe(true, 'headerArea pin/unpin icon is NOT present'); + expect((headerAreaPinIcon !== null) || (headerAreaUnpinIcon !== null), 'headerArea pin/unpin icon is NOT present').toBe(true); expect(headerAreaColumnHidingIcon).not.toBeNull('headerArea column hiding icon is NOT present'); // Verify icons in actions area are not present. - expect(actionsPinArea).toBeNull('actionsArea pin icon is present'); - expect(actionsAreaColumnHidingIcon).toBeNull('headerArea column hiding icon is present'); + expect(actionsPinArea, 'actionsArea pin icon is present').toBeNull(); + expect(actionsAreaColumnHidingIcon, 'headerArea column hiding icon is present').toBeNull(); // Verify icons are on right of the title const headerTitleRect = headerTitle.getBoundingClientRect(); const pinUnpinIconRect = ((headerAreaPinIcon !== null) ? headerAreaPinIcon : headerAreaUnpinIcon).getBoundingClientRect(); const columnHidingRect = headerAreaColumnHidingIcon.getBoundingClientRect(); - expect(pinUnpinIconRect.left >= headerTitleRect.right).toBe(true, 'pinUnpin icon is NOT on the right of top header'); - expect(columnHidingRect.left > headerTitleRect.right).toBe(true, 'columnHiding icon is NOT on the right of top header'); + expect(pinUnpinIconRect.left >= headerTitleRect.right, 'pinUnpin icon is NOT on the right of top header').toBe(true); + expect(columnHidingRect.left > headerTitleRect.right, 'columnHiding icon is NOT on the right of top header').toBe(true); } }; @@ -7266,16 +7266,16 @@ const verifySortMoveSize = (fix: ComponentFixture, expectedSize: ɵSize) => const isSmall = expectedSize === ɵSize.Small; // Verify sort buttons are on right of the sort title if size is 'small' // or that they are under the sort title if size is not 'small'. - expect(sortHeaderRect.right <= sortButtons[0].getBoundingClientRect().left).toBe(isSmall, 'incorrect sort button horizontal position based on the sort title'); - expect(sortHeaderRect.right <= sortButtons[1].getBoundingClientRect().left).toBe(isSmall, 'incorrect sort button horizontal position based on the sort title'); - expect(sortHeaderRect.bottom <= sortButtons[0].getBoundingClientRect().top).toBe(!isSmall, 'incorrect sort button vertical position based on the sort title'); - expect(sortHeaderRect.bottom <= sortButtons[1].getBoundingClientRect().top).toBe(!isSmall, 'incorrect sort button vertical position based on the sort title'); + expect(sortHeaderRect.right <= sortButtons[0].getBoundingClientRect().left, 'incorrect sort button horizontal position based on the sort title').toBe(isSmall); + expect(sortHeaderRect.right <= sortButtons[1].getBoundingClientRect().left, 'incorrect sort button horizontal position based on the sort title').toBe(isSmall); + expect(sortHeaderRect.bottom <= sortButtons[0].getBoundingClientRect().top, 'incorrect sort button vertical position based on the sort title').toBe(!isSmall); + expect(sortHeaderRect.bottom <= sortButtons[1].getBoundingClientRect().top, 'incorrect sort button vertical position based on the sort title').toBe(!isSmall); // Verify move buttons are on right of the move title if size is 'small' // or that they are under the sort title if size is not 'small'. - expect(moveHeaderRect.right < moveButtons[0].getBoundingClientRect().left).toBe(isSmall, 'incorrect move button horizontal position based on the sort title'); - expect(moveHeaderRect.right < moveButtons[1].getBoundingClientRect().left).toBe(isSmall, 'incorrect move button horizontal position based on the sort title'); - expect(moveHeaderRect.bottom <= moveButtons[0].getBoundingClientRect().top).toBe(!isSmall, 'incorrect move button vertical position based on the sort title'); - expect(moveHeaderRect.bottom <= moveButtons[1].getBoundingClientRect().top).toBe(!isSmall, 'incorrect move button vertical position based on the sort title'); + expect(moveHeaderRect.right < moveButtons[0].getBoundingClientRect().left, 'incorrect move button horizontal position based on the sort title').toBe(isSmall); + expect(moveHeaderRect.right < moveButtons[1].getBoundingClientRect().left, 'incorrect move button horizontal position based on the sort title').toBe(isSmall); + expect(moveHeaderRect.bottom <= moveButtons[0].getBoundingClientRect().top, 'incorrect move button vertical position based on the sort title').toBe(!isSmall); + expect(moveHeaderRect.bottom <= moveButtons[1].getBoundingClientRect().top, 'incorrect move button vertical position based on the sort title').toBe(!isSmall); }; const verifyExcelCustomFilterSize = (fix: ComponentFixture, expectedSize: ɵSize) => { @@ -7295,7 +7295,7 @@ const verifyExcelCustomFilterSize = (fix: ComponentFixture, expectedSize: // Verify size of all input groups in custom filter dialog. const inputGroups = customFilterMenu.querySelectorAll('igx-input-group'); inputGroups.forEach((inputGroup) => { - expect(getComponentSize(inputGroup)).toBe(expectedSize, 'incorrect inputGroup size in custom filter dialog'); + expect(getComponentSize(inputGroup), 'incorrect inputGroup size in custom filter dialog').toBe(expectedSize); }); }; @@ -7306,7 +7306,7 @@ const verifyGridSubmenuSize = (gridNativeElement: HTMLElement, expectedSize: ɵS const dropdownItems = visibleDropdown.querySelectorAll('igx-drop-down-item'); dropdownItems.forEach((dropdownItem) => { - expect(getComponentSize(dropdownItem)).toBe(expectedSize, 'incorrect dropdown item size'); + expect(getComponentSize(dropdownItem), 'incorrect dropdown item size').toBe(expectedSize); }); }; @@ -7321,7 +7321,7 @@ const verifyExcelStyleFilterAvailableOptions = (fix, labels: string[], checked: const labelElements: any[] = Array.from(GridFunctions.getExcelStyleSearchComponentListItems(fix, excelMenu)); const checkboxElements: any[] = Array.from(GridFunctions.getExcelStyleFilteringCheckboxes(fix, excelMenu)); - expect(labelElements.length).toBe(labels.length, 'incorrect rendered list items count'); + expect(labelElements.length, 'incorrect rendered list items count').toBe(labels.length); labels.forEach((l, index) => { expect(l).toEqual(labelElements[index].innerText.normalize("NFKD")); }); @@ -7369,8 +7369,7 @@ const verifyChipVisibility = (fix, index: number, shouldBeFullyVisible: boolean) const chip = GridFunctions.getFilterConditionChip(fix, index); const chipRect = chip.getBoundingClientRect(); - expect(chipRect.left >= visibleChipAreaRect.left && chipRect.right <= visibleChipAreaRect.right) - .toBe(shouldBeFullyVisible, 'chip[' + index + '] visibility is incorrect'); + expect(chipRect.left >= visibleChipAreaRect.left && chipRect.right <= visibleChipAreaRect.right, 'chip[' + index + '] visibility is incorrect').toBe(shouldBeFullyVisible); }; const emitFilteringDoneOnResetClick = (fix, grid, filterVal: any, columnName: string, condition) => { diff --git a/projects/igniteui-angular/grids/grid/src/grid-row-editing.spec.ts b/projects/igniteui-angular/grids/grid/src/grid-row-editing.spec.ts index 61c56ca137e..056bf4afcb9 100644 --- a/projects/igniteui-angular/grids/grid/src/grid-row-editing.spec.ts +++ b/projects/igniteui-angular/grids/grid/src/grid-row-editing.spec.ts @@ -2733,8 +2733,8 @@ describe('IgxGrid - Row Editing #grid', () => { targetRowElement = targetRow.element.nativeElement; targetCellElement = targetRow.cells.toArray()[1].nativeElement; - expect(targetRowElement.classList).toContain(ROW_EDITED_CLASS, 'row does not contain edited class w/ edits'); - expect(targetCellElement.classList).toContain('igx-grid__td--edited', 'cell does not contain edited class w/ edits'); + expect(targetRowElement.classList, 'row does not contain edited class w/ edits').toContain(ROW_EDITED_CLASS); + expect(targetCellElement.classList, 'cell does not contain edited class w/ edits').toContain('igx-grid__td--edited'); }); it('Should change pages when the only item on the last page is a pending added row that gets deleted', () => { diff --git a/projects/igniteui-angular/grids/grid/src/grid-row-selection.spec.ts b/projects/igniteui-angular/grids/grid/src/grid-row-selection.spec.ts index e768f9ab973..9357615b3ed 100644 --- a/projects/igniteui-angular/grids/grid/src/grid-row-selection.spec.ts +++ b/projects/igniteui-angular/grids/grid/src/grid-row-selection.spec.ts @@ -1657,14 +1657,14 @@ describe('IgxGrid - Row Selection #grid', () => { it('Should be able to select row through primaryKey and index', () => { expect(grid.primaryKey).toBeTruthy(); - expect(grid.rowList.length).toEqual(10, 'All 10 rows should initialized'); + expect(grid.rowList.length, 'All 10 rows should initialized').toEqual(10); expect(grid.getRowByKey(2).data['ProductName']).toMatch('Aniseed Syrup'); expect(grid.gridAPI.get_row_by_index(1).data['ProductName']).toMatch('Aniseed Syrup'); }); it('Should be able to update a cell in a row through primaryKey', () => { expect(grid.primaryKey).toBeTruthy(); - expect(grid.rowList.length).toEqual(10, 'All 10 rows should initialized'); + expect(grid.rowList.length, 'All 10 rows should initialized').toEqual(10); expect(grid.getRowByKey(2).data['UnitsInStock']).toEqual(198); grid.updateCell(300, 2, 'UnitsInStock'); fix.detectChanges(); @@ -1673,7 +1673,7 @@ describe('IgxGrid - Row Selection #grid', () => { it('Should be able to update row through primaryKey', () => { expect(grid.primaryKey).toBeTruthy(); - expect(grid.rowList.length).toEqual(10, 'All 10 rows should initialized'); + expect(grid.rowList.length, 'All 10 rows should initialized').toEqual(10); expect(grid.getRowByKey(2).data['UnitsInStock']).toEqual(198); grid.updateRow({ ProductID: 2, ProductName: 'Aniseed Syrup', UnitsInStock: 300 }, 2); fix.detectChanges(); @@ -1683,7 +1683,7 @@ describe('IgxGrid - Row Selection #grid', () => { it('Should be able to delete a row through primaryKey', () => { expect(grid.primaryKey).toBeTruthy(); - expect(grid.rowList.length).toEqual(10, 'All 10 rows should initialized'); + expect(grid.rowList.length, 'All 10 rows should initialized').toEqual(10); expect(grid.getRowByKey(2)).toBeDefined(); grid.deleteRow(2); fix.detectChanges(); @@ -1693,7 +1693,7 @@ describe('IgxGrid - Row Selection #grid', () => { it('Should handle update by not overwriting the value in the data column specified as primaryKey', () => { expect(grid.primaryKey).toBeTruthy(); - expect(grid.rowList.length).toEqual(10, 'All 10 rows should initialized'); + expect(grid.rowList.length, 'All 10 rows should initialized').toEqual(10); expect(grid.getRowByKey(2)).toBeDefined(); grid.updateRow({ ProductID: 7, ProductName: 'Aniseed Syrup', UnitsInStock: 300 }, 2); fix.detectChanges(); diff --git a/projects/igniteui-angular/grids/grid/src/grid-summary.spec.ts b/projects/igniteui-angular/grids/grid/src/grid-summary.spec.ts index dcc02a23c36..a899fc4ba3f 100644 --- a/projects/igniteui-angular/grids/grid/src/grid-summary.spec.ts +++ b/projects/igniteui-angular/grids/grid/src/grid-summary.spec.ts @@ -264,8 +264,8 @@ describe('IgxGrid - Summaries #grid', () => { const lastColumnSummaryCell = GridSummaryFunctions.getSummaryCellByVisibleIndex(summaryRow, 4); const lastColumnSummaryCellRect = lastColumnSummaryCell.nativeElement.getBoundingClientRect(); - expect(lastColumnSummaryCellRect.left).toBe(lastColumnNormalCellRect.left, 'summary cell and data cell are not left aligned'); - expect(lastColumnSummaryCellRect.right).toBe(lastColumnNormalCellRect.right, 'summary cell and data cell are not right aligned'); + expect(lastColumnSummaryCellRect.left, 'summary cell and data cell are not left aligned').toBe(lastColumnNormalCellRect.left); + expect(lastColumnSummaryCellRect.right, 'summary cell and data cell are not right aligned').toBe(lastColumnNormalCellRect.right); }); it('should apply disabledSummaries with custom summary', fakeAsync(() => { diff --git a/projects/igniteui-angular/grids/grid/src/grid.component.spec.ts b/projects/igniteui-angular/grids/grid/src/grid.component.spec.ts index 6e20d0d96b3..fc915f6ec02 100644 --- a/projects/igniteui-angular/grids/grid/src/grid.component.spec.ts +++ b/projects/igniteui-angular/grids/grid/src/grid.component.spec.ts @@ -49,9 +49,9 @@ describe('IgxGrid Component Tests #grid', () => { const grid = fix.componentInstance.instance; const domGrid = fix.debugElement.query(By.css('igx-grid')).nativeElement; - expect(grid).toBeDefined('Grid initializing through markup failed'); - expect(grid.columnList.length).toEqual(2, 'Invalid number of columns initialized'); - expect(grid.rowList.length).toEqual(3, 'Invalid number of rows initialized'); + expect(grid, 'Grid initializing through markup failed').toBeDefined(); + expect(grid.columnList.length, 'Invalid number of columns initialized').toEqual(2); + expect(grid.rowList.length, 'Invalid number of rows initialized').toEqual(3); expect(grid.id).toContain('igx-grid-'); expect(domGrid.id).toContain('igx-grid-'); @@ -77,15 +77,13 @@ describe('IgxGrid Component Tests #grid', () => { const grid = fix.componentInstance.grid; - expect(grid).toBeDefined('Grid initializing through autoGenerate failed'); - expect(grid.columns.length).toEqual(4, 'Invalid number of columns initialized'); - expect(grid.rowList.length).toEqual(1, 'Invalid number of rows initialized'); - expect(grid.columns[0].dataType).toEqual(GridColumnDataType.Number, 'Invalid dataType set on column'); - expect(grid.columns.find((col) => col.index === 1).dataType) - .toEqual(GridColumnDataType.String, 'Invalid dataType set on column'); - expect(grid.columns.find((col) => col.index === 2).dataType) - .toEqual(GridColumnDataType.Boolean, 'Invalid dataType set on column'); - expect(grid.columns[grid.columns.length - 1].dataType).toEqual(GridColumnDataType.Date, 'Invalid dataType set on column'); + expect(grid, 'Grid initializing through autoGenerate failed').toBeDefined(); + expect(grid.columns.length, 'Invalid number of columns initialized').toEqual(4); + expect(grid.rowList.length, 'Invalid number of rows initialized').toEqual(1); + expect(grid.columns[0].dataType, 'Invalid dataType set on column').toEqual(GridColumnDataType.Number); + expect(grid.columns.find((col) => col.index === 1).dataType, 'Invalid dataType set on column').toEqual(GridColumnDataType.String); + expect(grid.columns.find((col) => col.index === 2).dataType, 'Invalid dataType set on column').toEqual(GridColumnDataType.Boolean); + expect(grid.columns[grid.columns.length - 1].dataType, 'Invalid dataType set on column').toEqual(GridColumnDataType.Date); expect(fix.componentInstance.columnEventCount).toEqual(4); }); @@ -116,7 +114,7 @@ describe('IgxGrid Component Tests #grid', () => { fix.detectChanges(); const grid = fix.componentInstance.grid; - expect(grid.columns.map(col => col.field)).toEqual(['Number', 'Boolean'], 'Invalid columns after exclusion initialized'); + expect(grid.columns.map(col => col.field), 'Invalid columns after exclusion initialized').toEqual(['Number', 'Boolean']); }); it('should initialize a grid and allow changing columns runtime with @for', () => { diff --git a/projects/igniteui-angular/grids/grid/src/grid.pagination.spec.ts b/projects/igniteui-angular/grids/grid/src/grid.pagination.spec.ts index bd9b529d956..0c607f62e4d 100644 --- a/projects/igniteui-angular/grids/grid/src/grid.pagination.spec.ts +++ b/projects/igniteui-angular/grids/grid/src/grid.pagination.spec.ts @@ -13,7 +13,7 @@ const verifyGridPager = (fix, rowsCount, firstCellValue, pagerText, buttonsVisib const grid = fix.componentInstance.grid; expect(grid.getCellByColumn(0, 'ID').value).toMatch(firstCellValue); - expect(grid.rowList.length).toEqual(rowsCount, 'Invalid number of rows initialized'); + expect(grid.rowList.length, 'Invalid number of rows initialized').toEqual(rowsCount); if (pagerText != null) { expect(grid.nativeElement.querySelector(PAGER_CLASS)).toBeDefined(); @@ -149,14 +149,14 @@ describe('IgxGrid - Grid Paging #grid', () => { fix.detectChanges(); expect(paginator).toBeDefined(); - expect(paginator.perPage).toEqual(5, 'Invalid page size'); + expect(paginator.perPage, 'Invalid page size').toEqual(5); expect(grid.totalRecords).toBe(10); verifyGridPager(fix, 5, '1', '1\xA0of\xA02', []); grid.totalRecords = 4; fix.detectChanges(); - expect(paginator.perPage).toEqual(5, 'Invalid page size'); + expect(paginator.perPage, 'Invalid page size').toEqual(5); expect(grid.totalRecords).toBe(4); verifyGridPager(fix, 4, '1', '1\xA0of\xA01', []); }); @@ -165,7 +165,7 @@ describe('IgxGrid - Grid Paging #grid', () => { it('change paging settings UI', () => { fix.detectChanges(); expect(paginator).toBeDefined(); - expect(paginator.perPage).toEqual(3, 'Invalid page size'); + expect(paginator.perPage, 'Invalid page size').toEqual(3); verifyGridPager(fix, 3, '1', '1\xA0of\xA04', []); @@ -175,7 +175,7 @@ describe('IgxGrid - Grid Paging #grid', () => { ControlsFunction.clickDropDownItem(fix, 2); expect(paginator).toBeDefined(); - expect(paginator.perPage).toEqual(10, 'Invalid page size'); + expect(paginator.perPage, 'Invalid page size').toEqual(10); verifyGridPager(fix, 10, '1', '1\xA0of\xA01', []); }); @@ -186,7 +186,7 @@ describe('IgxGrid - Grid Paging #grid', () => { fix.detectChanges(); expect(paginator).toBeDefined(); - expect(paginator.perPage).toEqual(2, 'Invalid page size'); + expect(paginator.perPage, 'Invalid page size').toEqual(2); verifyGridPager(fix, 2, '1', '1\xA0of\xA05', []); // Turn off paging @@ -212,7 +212,7 @@ describe('IgxGrid - Grid Paging #grid', () => { fix.detectChanges(); expect(grid.paginator).toBeDefined(); - expect(paginator.perPage).toEqual(2, 'Invalid page size'); + expect(paginator.perPage, 'Invalid page size').toEqual(2); verifyGridPager(fix, 2, '3', '2\xA0of\xA05', []); // Change page size to be 5 diff --git a/projects/igniteui-angular/grids/hierarchical-grid/src/hierarchical-grid.spec.ts b/projects/igniteui-angular/grids/hierarchical-grid/src/hierarchical-grid.spec.ts index 76a37fff44f..093861203bb 100644 --- a/projects/igniteui-angular/grids/hierarchical-grid/src/hierarchical-grid.spec.ts +++ b/projects/igniteui-angular/grids/hierarchical-grid/src/hierarchical-grid.spec.ts @@ -1066,15 +1066,15 @@ describe('Basic IgxHierarchicalGrid #hGrid', () => { it('should update columns property of row islands on columns change.', fakeAsync(() => { - expect(hierarchicalGrid.childLayoutList.first.columns.length).toEqual(2, 'Initial columns length should be 2'); - expect(hierarchicalGrid.childLayoutList.first.columnList.length).toEqual(2, 'Initial columnList length should be 2'); + expect(hierarchicalGrid.childLayoutList.first.columns.length, 'Initial columns length should be 2').toEqual(2); + expect(hierarchicalGrid.childLayoutList.first.columnList.length, 'Initial columnList length should be 2').toEqual(2); fixture.componentInstance.toggleColumns = false; fixture.detectChanges(); tick(); - expect(hierarchicalGrid.childLayoutList.first.columns.length).toEqual(0, 'Columns length should be 0 after toggle'); - expect(hierarchicalGrid.childLayoutList.first.columnList.length).toEqual(0, 'ColumnList length should be 0 after toggle'); + expect(hierarchicalGrid.childLayoutList.first.columns.length, 'Columns length should be 0 after toggle').toEqual(0); + expect(hierarchicalGrid.childLayoutList.first.columnList.length, 'ColumnList length should be 0 after toggle').toEqual(0); })); it('should resolve child grid cols default editable prop correctly based on row island\'s rowEditable.', () => { diff --git a/projects/igniteui-angular/grids/pivot-grid/src/pivot-grid-keyboard-nav.spec.ts b/projects/igniteui-angular/grids/pivot-grid/src/pivot-grid-keyboard-nav.spec.ts index 918af0da92d..716660acece 100644 --- a/projects/igniteui-angular/grids/pivot-grid/src/pivot-grid-keyboard-nav.spec.ts +++ b/projects/igniteui-angular/grids/pivot-grid/src/pivot-grid-keyboard-nav.spec.ts @@ -342,7 +342,7 @@ describe('IgxPivotGrid - Keyboard navigation #pivotGrid', () => { const rowDimension = fixture.debugElement.queryAll(By.css(CSS_CLASS_ROW_DIMENSION_CONTAINER)); let allHeaders = fixture.debugElement.queryAll(By.directive(IgxPivotRowDimensionHeaderComponent)); - expect(allHeaders.length).toBe(5, 'There should initially be 5 row dimension headers'); + expect(allHeaders.length, 'There should initially be 5 row dimension headers').toBe(5); UIInteractions.simulateClickAndSelectEvent(allHeaders[0]); UIInteractions.triggerEventHandlerKeyDown('ArrowUp', rowDimension[0], true); @@ -350,7 +350,7 @@ describe('IgxPivotGrid - Keyboard navigation #pivotGrid', () => { allHeaders = fixture.debugElement.queryAll(By.directive(IgxPivotRowDimensionHeaderComponent)); - expect(allHeaders.length).toBe(1, 'There should be only 1 row dimension header after collapse with Alt + ArrowUp'); + expect(allHeaders.length, 'There should be only 1 row dimension header after collapse with Alt + ArrowUp').toBe(1); UIInteractions.simulateClickAndSelectEvent(allHeaders[0]); UIInteractions.triggerEventHandlerKeyDown('ArrowDown', rowDimension[0], true); @@ -358,7 +358,7 @@ describe('IgxPivotGrid - Keyboard navigation #pivotGrid', () => { allHeaders = fixture.debugElement.queryAll(By.directive(IgxPivotRowDimensionHeaderComponent)); - expect(allHeaders.length).toBe(5, 'There should be 5 row dimension headers after expand with Alt + ArrowDown'); + expect(allHeaders.length, 'There should be 5 row dimension headers after expand with Alt + ArrowDown').toBe(5); UIInteractions.simulateClickAndSelectEvent(allHeaders[0]); UIInteractions.triggerEventHandlerKeyDown('ArrowLeft', rowDimension[0], true); @@ -366,7 +366,7 @@ describe('IgxPivotGrid - Keyboard navigation #pivotGrid', () => { allHeaders = fixture.debugElement.queryAll(By.directive(IgxPivotRowDimensionHeaderComponent)); - expect(allHeaders.length).toBe(1, 'There should be 1 row dimension header after collapse with Alt + ArrowLeft'); + expect(allHeaders.length, 'There should be 1 row dimension header after collapse with Alt + ArrowLeft').toBe(1); UIInteractions.simulateClickAndSelectEvent(allHeaders[0]); UIInteractions.triggerEventHandlerKeyDown('ArrowRight', rowDimension[0], true); @@ -374,7 +374,7 @@ describe('IgxPivotGrid - Keyboard navigation #pivotGrid', () => { allHeaders = fixture.debugElement.queryAll(By.directive(IgxPivotRowDimensionHeaderComponent)); - expect(allHeaders.length).toBe(5, 'There should be 5 row dimension headers after expand with Alt + ArrowRight'); + expect(allHeaders.length, 'There should be 5 row dimension headers after expand with Alt + ArrowRight').toBe(5); }); }); }); diff --git a/projects/igniteui-angular/grids/pivot-grid/src/pivot-grid.spec.ts b/projects/igniteui-angular/grids/pivot-grid/src/pivot-grid.spec.ts index 17f5626d7ca..ca79ec065d7 100644 --- a/projects/igniteui-angular/grids/pivot-grid/src/pivot-grid.spec.ts +++ b/projects/igniteui-angular/grids/pivot-grid/src/pivot-grid.spec.ts @@ -796,7 +796,7 @@ describe('IgxPivotGrid #pivotGrid', () => { const pivotGrid = fixture.componentInstance.pivotGrid; const colSum = pivotGrid.featureColumnsWidth() + pivotGrid.columns.filter(x => !x.columnGroup).map(x => x.calcPixelWidth).reduce((x, y) => x + y); const expectedSize = Math.min(window.innerWidth, colSum); - expect(pivotGrid.nativeElement.clientWidth - expectedSize).toBeLessThan(50, "should take sum of columns as width."); + expect(pivotGrid.nativeElement.clientWidth - expectedSize, "should take sum of columns as width.").toBeLessThan(50); }); it('should render cell values for dimension columns containing dots - issue #16445', () => { diff --git a/projects/igniteui-angular/grids/tree-grid/src/tree-grid-crud.spec.ts b/projects/igniteui-angular/grids/tree-grid/src/tree-grid-crud.spec.ts index ac438c2791d..d1c3ecd342d 100644 --- a/projects/igniteui-angular/grids/tree-grid/src/tree-grid-crud.spec.ts +++ b/projects/igniteui-angular/grids/tree-grid/src/tree-grid-crud.spec.ts @@ -563,28 +563,28 @@ describe('IgxTreeGrid - CRUD #tGrid', () => { UIInteractions.simulateDoubleClickAndSelectEvent(treeGrid.gridAPI.get_cell_by_index(0, 'ID')); fix.detectChanges(); - expect(cell.editMode).toBe(true, 'cannot enter edit mode with double click'); + expect(cell.editMode, 'cannot enter edit mode with double click').toBe(true); UIInteractions.triggerEventHandlerKeyDown('escape', gridContent); fix.detectChanges(); - expect(cell.editMode).toBe(false, 'cannot exit edit mode after entering with double click'); + expect(cell.editMode, 'cannot exit edit mode after entering with double click').toBe(false); UIInteractions.triggerEventHandlerKeyDown('enter', gridContent); fix.detectChanges(); - expect(cell.editMode).toBe(true, 'cannot enter edit mode with enter'); + expect(cell.editMode, 'cannot enter edit mode with enter').toBe(true); UIInteractions.triggerEventHandlerKeyDown('escape', gridContent); fix.detectChanges(); - expect(cell.editMode).toBe(false, 'cannot exit edit mode after entering with enter'); + expect(cell.editMode, 'cannot exit edit mode after entering with enter').toBe(false); UIInteractions.triggerEventHandlerKeyDown('f2', gridContent); fix.detectChanges(); - expect(cell.editMode).toBe(true, 'cannot enter edit mode with F2'); + expect(cell.editMode, 'cannot enter edit mode with F2').toBe(true); UIInteractions.triggerEventHandlerKeyDown('escape', gridContent); fix.detectChanges(); - expect(cell.editMode).toBe(false, 'cannot exit edit mode after entering with F2'); + expect(cell.editMode, 'cannot exit edit mode after entering with F2').toBe(false); }); it('should be able to enter edit mode of a non-tree-grid column on dblclick, enter and F2', () => { @@ -592,27 +592,27 @@ describe('IgxTreeGrid - CRUD #tGrid', () => { UIInteractions.simulateDoubleClickAndSelectEvent(treeGrid.gridAPI.get_cell_by_index(0, 'Name')); fix.detectChanges(); - expect(cell.editMode).toBe(true, 'cannot enter edit mode with double click'); + expect(cell.editMode, 'cannot enter edit mode with double click').toBe(true); UIInteractions.triggerEventHandlerKeyDown('escape', gridContent); fix.detectChanges(); - expect(cell.editMode).toBe(false, 'cannot exit edit mode after entering with double click'); + expect(cell.editMode, 'cannot exit edit mode after entering with double click').toBe(false); UIInteractions.triggerEventHandlerKeyDown('enter', gridContent); fix.detectChanges(); - expect(cell.editMode).toBe(true, 'cannot enter edit mode with enter'); + expect(cell.editMode, 'cannot enter edit mode with enter').toBe(true); UIInteractions.triggerEventHandlerKeyDown('escape', gridContent); fix.detectChanges(); - expect(cell.editMode).toBe(false, 'cannot exit edit mode after entering with enter'); + expect(cell.editMode, 'cannot exit edit mode after entering with enter').toBe(false); UIInteractions.triggerEventHandlerKeyDown('f2', gridContent); fix.detectChanges(); - expect(cell.editMode).toBe(true, 'cannot enter edit mode with F2'); + expect(cell.editMode, 'cannot enter edit mode with F2').toBe(true); UIInteractions.triggerEventHandlerKeyDown('escape', gridContent); fix.detectChanges(); - expect(cell.editMode).toBe(false, 'cannot exit edit mode after entering with F2'); + expect(cell.editMode, 'cannot exit edit mode after entering with F2').toBe(false); }); it('should be able to edit a tree-grid cell through UI', () => { @@ -704,27 +704,27 @@ describe('IgxTreeGrid - CRUD #tGrid', () => { UIInteractions.simulateDoubleClickAndSelectEvent(treeGrid.gridAPI.get_cell_by_index(0, 'ID')); fix.detectChanges(); - expect(cell.editMode).toBe(true, 'cannot enter edit mode with double click'); + expect(cell.editMode, 'cannot enter edit mode with double click').toBe(true); UIInteractions.triggerEventHandlerKeyDown('escape', gridContent); fix.detectChanges(); - expect(cell.editMode).toBe(false, 'cannot exit edit mode after entering with double click'); + expect(cell.editMode, 'cannot exit edit mode after entering with double click').toBe(false); UIInteractions.triggerEventHandlerKeyDown('enter', gridContent); fix.detectChanges(); - expect(cell.editMode).toBe(true, 'cannot enter edit mode with enter'); + expect(cell.editMode, 'cannot enter edit mode with enter').toBe(true); UIInteractions.triggerEventHandlerKeyDown('escape', gridContent); fix.detectChanges(); - expect(cell.editMode).toBe(false, 'cannot exit edit mode after entering with enter'); + expect(cell.editMode, 'cannot exit edit mode after entering with enter').toBe(false); UIInteractions.triggerEventHandlerKeyDown('f2', gridContent); fix.detectChanges(); - expect(cell.editMode).toBe(true, 'cannot enter edit mode with F2'); + expect(cell.editMode, 'cannot enter edit mode with F2').toBe(true); UIInteractions.triggerEventHandlerKeyDown('escape', gridContent); fix.detectChanges(); - expect(cell.editMode).toBe(false, 'cannot exit edit mode after entering with F2'); + expect(cell.editMode, 'cannot exit edit mode after entering with F2').toBe(false); }); it('should be able to enter edit mode of a non-tree-grid column on dblclick, enter and F2', () => { @@ -732,27 +732,27 @@ describe('IgxTreeGrid - CRUD #tGrid', () => { UIInteractions.simulateDoubleClickAndSelectEvent(treeGrid.gridAPI.get_cell_by_index(0, 'Name')); fix.detectChanges(); - expect(cell.editMode).toBe(true, 'cannot enter edit mode with double click'); + expect(cell.editMode, 'cannot enter edit mode with double click').toBe(true); UIInteractions.triggerEventHandlerKeyDown('escape', gridContent); fix.detectChanges(); - expect(cell.editMode).toBe(false, 'cannot exit edit mode after entering with double click'); + expect(cell.editMode, 'cannot exit edit mode after entering with double click').toBe(false); UIInteractions.triggerEventHandlerKeyDown('enter', gridContent); fix.detectChanges(); - expect(cell.editMode).toBe(true, 'cannot enter edit mode with enter'); + expect(cell.editMode, 'cannot enter edit mode with enter').toBe(true); UIInteractions.triggerEventHandlerKeyDown('escape', gridContent); fix.detectChanges(); - expect(cell.editMode).toBe(false, 'cannot exit edit mode after entering with enter'); + expect(cell.editMode, 'cannot exit edit mode after entering with enter').toBe(false); UIInteractions.triggerEventHandlerKeyDown('f2', gridContent); fix.detectChanges(); - expect(cell.editMode).toBe(true, 'cannot enter edit mode with F2'); + expect(cell.editMode, 'cannot enter edit mode with F2').toBe(true); UIInteractions.triggerEventHandlerKeyDown('escape', gridContent); fix.detectChanges(); - expect(cell.editMode).toBe(false, 'cannot exit edit mode after entering with F2'); + expect(cell.editMode, 'cannot exit edit mode after entering with F2').toBe(false); }); it('should be able to edit a tree-grid cell through UI', () => { @@ -1120,9 +1120,9 @@ describe('IgxTreeGrid - CRUD #tGrid', () => { const verifyRowsCount = (fix, expectedRootRowsCount, expectedVisibleRowsCount) => { const treeGrid = fix.componentInstance.treeGrid; - expect(TreeGridFunctions.getAllRows(fix).length).toBe(expectedVisibleRowsCount, 'Incorrect DOM rows length.'); - expect(treeGrid.data.length).toBe(expectedRootRowsCount, 'Incorrect data length.'); - expect(treeGrid.dataRowList.length).toBe(expectedVisibleRowsCount, 'Incorrect dataRowList length.'); + expect(TreeGridFunctions.getAllRows(fix).length, 'Incorrect DOM rows length.').toBe(expectedVisibleRowsCount); + expect(treeGrid.data.length, 'Incorrect data length.').toBe(expectedRootRowsCount); + expect(treeGrid.dataRowList.length, 'Incorrect dataRowList length.').toBe(expectedVisibleRowsCount); }; const verifyTreeGridRecordsCount = (fix, expectedRootRecordsCount, expectedFlatRecordsCount) => { @@ -1141,6 +1141,6 @@ const verifyCellValue = (fix, rowIndex, columnKey, expectedCellValue) => { const treeGrid = fix.componentInstance.treeGrid; const actualValue = TreeGridFunctions.getCellValue(fix, rowIndex, columnKey); const actualAPIValue = treeGrid.gridAPI.get_row_by_index(rowIndex).cells.filter((c) => c.column.field === columnKey)[0].value; - expect(actualValue.toString()).toBe(expectedCellValue, 'incorrect cell value'); - expect(actualAPIValue.toString()).toBe(expectedCellValue, 'incorrect api cell value'); + expect(actualValue.toString(), 'incorrect cell value').toBe(expectedCellValue); + expect(actualAPIValue.toString(), 'incorrect api cell value').toBe(expectedCellValue); }; diff --git a/projects/igniteui-angular/grids/tree-grid/src/tree-grid-expanding.spec.ts b/projects/igniteui-angular/grids/tree-grid/src/tree-grid-expanding.spec.ts index 471ebee6e09..5e035c3e086 100644 --- a/projects/igniteui-angular/grids/tree-grid/src/tree-grid-expanding.spec.ts +++ b/projects/igniteui-angular/grids/tree-grid/src/tree-grid-expanding.spec.ts @@ -211,44 +211,44 @@ describe('IgxTreeGrid - Expanding / Collapsing #tGrid', () => { // expand a root level row let aRow = treeGrid.gridAPI.get_row_by_index(0); let cells = (aRow.cells as QueryList).toArray(); - expect(cells[0].value).toBe(147, 'wrong root level row'); + expect(cells[0].value, 'wrong root level row').toBe(147); expect(aRow.expanded).toBe(false); aRow.expanded = true; fix.detectChanges(); rows = TreeGridFunctions.getAllRows(fix); - expect(rows.length).toBe(7, 'root level row expanding problem'); + expect(rows.length, 'root level row expanding problem').toBe(7); // expand a second level row aRow = treeGrid.gridAPI.get_row_by_index(3); cells = (aRow.cells as QueryList).toArray(); - expect(cells[0].value).toBe(317, 'wrong second level row'); + expect(cells[0].value, 'wrong second level row').toBe(317); expect(aRow.expanded).toBe(false); aRow.expanded = true; fix.detectChanges(); rows = TreeGridFunctions.getAllRows(fix); - expect(rows.length).toBe(9, 'second level row expanding problem'); + expect(rows.length, 'second level row expanding problem').toBe(9); // check third level rows are having the correct values aRow = treeGrid.gridAPI.get_row_by_index(4); cells = (aRow.cells as QueryList).toArray(); - expect(cells[0].value).toBe(711, 'wrong third level row'); + expect(cells[0].value, 'wrong third level row').toBe(711); aRow = treeGrid.gridAPI.get_row_by_index(5); cells = (aRow.cells as QueryList).toArray(); - expect(cells[0].value).toBe(998, 'wrong third level row'); + expect(cells[0].value, 'wrong third level row').toBe(998); // collapse a second level row aRow = treeGrid.gridAPI.get_row_by_index(3); aRow.expanded = false; fix.detectChanges(); rows = TreeGridFunctions.getAllRows(fix); - expect(rows.length).toBe(7, 'second level row collapsing problem'); + expect(rows.length, 'second level row collapsing problem').toBe(7); // collapse a root level row aRow = treeGrid.gridAPI.get_row_by_index(0); aRow.expanded = false; fix.detectChanges(); rows = TreeGridFunctions.getAllRows(fix); - expect(rows.length).toBe(4, 'root level row collapsing problem'); + expect(rows.length, 'root level row collapsing problem').toBe(4); }); it('should expand/collapse when using \'expandAll\' and \'collapseAll\' methods', () => { @@ -652,32 +652,32 @@ describe('IgxTreeGrid - Expanding / Collapsing #tGrid', () => { // expand a root level row let aRow = treeGrid.gridAPI.get_row_by_index(0); let cells = (aRow.cells as QueryList).toArray(); - expect(cells[0].value).toBe(1, 'wrong root level row'); + expect(cells[0].value, 'wrong root level row').toBe(1); expect(aRow.expanded).toBe(false); aRow.expanded = true; fix.detectChanges(); rows = TreeGridFunctions.getAllRows(fix); - expect(rows.length).toBe(5, 'root level row expanding problem'); + expect(rows.length, 'root level row expanding problem').toBe(5); // expand a second level row aRow = treeGrid.gridAPI.get_row_by_index(1); cells = (aRow.cells as QueryList).toArray(); - expect(cells[0].value).toBe(2, 'wrong second level row'); + expect(cells[0].value, 'wrong second level row').toBe(2); expect(aRow.expanded).toBe(false); aRow.expanded = true; fix.detectChanges(); rows = TreeGridFunctions.getAllRows(fix); - expect(rows.length).toBe(7, 'second level row expanding problem'); + expect(rows.length, 'second level row expanding problem').toBe(7); // check third level rows are having the correct values aRow = treeGrid.gridAPI.get_row_by_index(2); cells = (aRow.cells as QueryList).toArray(); - expect(cells[0].value).toBe(3, 'wrong third level row'); + expect(cells[0].value, 'wrong third level row').toBe(3); aRow = treeGrid.gridAPI.get_row_by_index(3); cells = (aRow.cells as QueryList).toArray(); - expect(cells[0].value).toBe(7, 'wrong third level row'); + expect(cells[0].value, 'wrong third level row').toBe(7); // collapse a second level row aRow = treeGrid.gridAPI.get_row_by_index(1); @@ -685,7 +685,7 @@ describe('IgxTreeGrid - Expanding / Collapsing #tGrid', () => { fix.detectChanges(); rows = TreeGridFunctions.getAllRows(fix); - expect(rows.length).toBe(5, 'second level row collapsing problem'); + expect(rows.length, 'second level row collapsing problem').toBe(5); // collapse a root level row aRow = treeGrid.gridAPI.get_row_by_index(0); @@ -693,7 +693,7 @@ describe('IgxTreeGrid - Expanding / Collapsing #tGrid', () => { fix.detectChanges(); rows = TreeGridFunctions.getAllRows(fix); - expect(rows.length).toBe(3, 'root level row collapsing problem'); + expect(rows.length, 'root level row collapsing problem').toBe(3); }); it('should expand/collapse when using \'expandAll\' and \'collapseAll\' methods', () => { @@ -1149,11 +1149,11 @@ describe('IgxTreeGrid - Expanding / Collapsing #tGrid', () => { const cell = treeGrid.getCellByColumn(1, 'Name'); const overlayContent = GridFunctions.getRowEditingBanner(fix); expect(overlayContent.getBoundingClientRect().height).toBe(0); - expect(treeGrid.rowEditingOverlay.collapsed).toBeTruthy('Edit overlay should not be visible'); + expect(treeGrid.rowEditingOverlay.collapsed, 'Edit overlay should not be visible').toBeTruthy(); cell.editMode = true; fix.detectChanges(); - expect(treeGrid.rowEditingOverlay.collapsed).toBeFalsy('Edit overlay should be visible'); + expect(treeGrid.rowEditingOverlay.collapsed, 'Edit overlay should be visible').toBeFalsy(); expect(overlayContent.getBoundingClientRect().height).toBeGreaterThan(0); expect(overlayContent.getBoundingClientRect().top).toBeLessThan(treeGrid.nativeElement.getBoundingClientRect().top + treeGrid.nativeElement.getBoundingClientRect().height); @@ -1163,7 +1163,7 @@ describe('IgxTreeGrid - Expanding / Collapsing #tGrid', () => { indicatorDiv.triggerEventHandler('click', new Event('click')); fix.detectChanges(); - expect(treeGrid.rowEditingOverlay.collapsed).toBeFalsy('Edit overlay should not hide'); + expect(treeGrid.rowEditingOverlay.collapsed, 'Edit overlay should not hide').toBeFalsy(); expect(overlayContent.getBoundingClientRect().height).toBeGreaterThan(0); expect(overlayContent.getBoundingClientRect().top).toBeLessThan(treeGrid.nativeElement.getBoundingClientRect().top + treeGrid.nativeElement.getBoundingClientRect().height); @@ -1171,7 +1171,7 @@ describe('IgxTreeGrid - Expanding / Collapsing #tGrid', () => { indicatorDiv.triggerEventHandler('click', new Event('click')); fix.detectChanges(); - expect(treeGrid.rowEditingOverlay.collapsed).toBeFalsy('Edit overlay should still be shown'); + expect(treeGrid.rowEditingOverlay.collapsed, 'Edit overlay should still be shown').toBeFalsy(); expect(overlayContent.getBoundingClientRect().height).toBeGreaterThan(0); expect(overlayContent.getBoundingClientRect().top).toBeLessThan(treeGrid.nativeElement.getBoundingClientRect().top + treeGrid.nativeElement.getBoundingClientRect().height); @@ -1181,26 +1181,26 @@ describe('IgxTreeGrid - Expanding / Collapsing #tGrid', () => { const cell = treeGrid.getCellByColumn(1, 'Name'); const overlayContent = GridFunctions.getRowEditingBanner(fix); expect(overlayContent.getBoundingClientRect().height).toBe(0); - expect(treeGrid.rowEditingOverlay.collapsed).toBeTruthy('Edit overlay should not be visible'); + expect(treeGrid.rowEditingOverlay.collapsed, 'Edit overlay should not be visible').toBeTruthy(); cell.editMode = true; fix.detectChanges(); - expect(treeGrid.rowEditingOverlay.collapsed).toBeFalsy('Edit overlay should be visible'); + expect(treeGrid.rowEditingOverlay.collapsed, 'Edit overlay should be visible').toBeFalsy(); expect(overlayContent.getBoundingClientRect().height).toBeGreaterThan(0); expect(overlayContent.getBoundingClientRect().top).toBeLessThan(treeGrid.nativeElement.getBoundingClientRect().top + treeGrid.nativeElement.getBoundingClientRect().height); treeGrid.toggleRow(treeGrid.getRowByIndex(0).key); fix.detectChanges(); - expect(treeGrid.rowEditingOverlay.collapsed).toBeFalsy('Edit overlay should not hide'); + expect(treeGrid.rowEditingOverlay.collapsed, 'Edit overlay should not hide').toBeFalsy(); expect(overlayContent.getBoundingClientRect().height).toBeGreaterThan(0); expect(overlayContent.getBoundingClientRect().top).toBeLessThan(treeGrid.nativeElement.getBoundingClientRect().top + treeGrid.nativeElement.getBoundingClientRect().height); treeGrid.toggleRow(treeGrid.getRowByIndex(0).key); fix.detectChanges(); - expect(treeGrid.rowEditingOverlay.collapsed).toBeFalsy('Edit overlay should still be shown'); + expect(treeGrid.rowEditingOverlay.collapsed, 'Edit overlay should still be shown').toBeFalsy(); expect(overlayContent.getBoundingClientRect().height).toBeGreaterThan(0); expect(overlayContent.getBoundingClientRect().top).toBeLessThan(treeGrid.nativeElement.getBoundingClientRect().top + treeGrid.nativeElement.getBoundingClientRect().height); @@ -1220,7 +1220,7 @@ describe('IgxTreeGrid - Expanding / Collapsing #tGrid', () => { const cell = treeGrid.getCellByColumn(0, 'Name'); const overlayContent = GridFunctions.getRowEditingBanner(fix); expect(overlayContent.getBoundingClientRect().height).toBe(0); - expect(treeGrid.rowEditingOverlay.collapsed).toBeTruthy('Edit overlay should not be visible'); + expect(treeGrid.rowEditingOverlay.collapsed, 'Edit overlay should not be visible').toBeTruthy(); cell.editMode = true; fix.detectChanges(); @@ -1231,7 +1231,7 @@ describe('IgxTreeGrid - Expanding / Collapsing #tGrid', () => { fix.detectChanges(); expect(overlayContent.getBoundingClientRect().height).toBeGreaterThan(0); - expect(treeGrid.rowEditingOverlay.collapsed).toBeFalsy('Edit overlay should be visible'); + expect(treeGrid.rowEditingOverlay.collapsed, 'Edit overlay should be visible').toBeFalsy(); expect(overlayContent.getBoundingClientRect().top).toBeLessThan(treeGrid.nativeElement.getBoundingClientRect().top + treeGrid.nativeElement.getBoundingClientRect().height); @@ -1239,7 +1239,7 @@ describe('IgxTreeGrid - Expanding / Collapsing #tGrid', () => { fix.detectChanges(); expect(overlayContent.getBoundingClientRect().height).toBeGreaterThan(0); - expect(treeGrid.rowEditingOverlay.collapsed).toBeFalsy('Edit overlay should be visible'); + expect(treeGrid.rowEditingOverlay.collapsed, 'Edit overlay should be visible').toBeFalsy(); expect(overlayContent.getBoundingClientRect().top).toBeLessThan(treeGrid.nativeElement.getBoundingClientRect().top + treeGrid.nativeElement.getBoundingClientRect().height); }); @@ -1250,7 +1250,7 @@ describe('IgxTreeGrid - Expanding / Collapsing #tGrid', () => { const cell = treeGrid.getCellByColumn(1, 'Name'); const overlayContent = GridFunctions.getRowEditingBanner(fix); expect(overlayContent.getBoundingClientRect().height).toBe(0); - expect(treeGrid.rowEditingOverlay.collapsed).toBeTruthy('Edit overlay should not be visible'); + expect(treeGrid.rowEditingOverlay.collapsed, 'Edit overlay should not be visible').toBeTruthy(); cell.editMode = true; fix.detectChanges(); @@ -1259,7 +1259,7 @@ describe('IgxTreeGrid - Expanding / Collapsing #tGrid', () => { fix.detectChanges(); expect(overlayContent.getBoundingClientRect().height).toBeGreaterThan(0); - expect(treeGrid.rowEditingOverlay.collapsed).toBeFalsy('Edit overlay should be visible'); + expect(treeGrid.rowEditingOverlay.collapsed, 'Edit overlay should be visible').toBeFalsy(); expect(overlayContent.getBoundingClientRect().top).toBeLessThan(treeGrid.nativeElement.getBoundingClientRect().top + treeGrid.nativeElement.getBoundingClientRect().height); @@ -1267,7 +1267,7 @@ describe('IgxTreeGrid - Expanding / Collapsing #tGrid', () => { fix.detectChanges(); expect(overlayContent.getBoundingClientRect().height).toBeGreaterThan(0); - expect(treeGrid.rowEditingOverlay.collapsed).toBeFalsy('Edit overlay should be visible'); + expect(treeGrid.rowEditingOverlay.collapsed, 'Edit overlay should be visible').toBeFalsy(); expect(overlayContent.getBoundingClientRect().top).toBeLessThan(treeGrid.nativeElement.getBoundingClientRect().top + treeGrid.nativeElement.getBoundingClientRect().height); }); @@ -1279,7 +1279,7 @@ describe('IgxTreeGrid - Expanding / Collapsing #tGrid', () => { const cell = treeGrid.getCellByColumn(9, 'Name'); const overlayContent = GridFunctions.getRowEditingBanner(fix); expect(overlayContent.getBoundingClientRect().height).toBe(0); - expect(treeGrid.rowEditingOverlay.collapsed).toBeTruthy('Edit overlay should not be visible'); + expect(treeGrid.rowEditingOverlay.collapsed, 'Edit overlay should not be visible').toBeTruthy(); cell.editMode = true; fix.detectChanges(); @@ -1290,7 +1290,7 @@ describe('IgxTreeGrid - Expanding / Collapsing #tGrid', () => { fix.detectChanges(); expect(overlayContent.getBoundingClientRect().height).toBeGreaterThan(0); - expect(treeGrid.rowEditingOverlay.collapsed).toBeFalsy('Edit overlay should be visible'); + expect(treeGrid.rowEditingOverlay.collapsed, 'Edit overlay should be visible').toBeFalsy(); expect(overlayContent.getBoundingClientRect().top).toBeLessThan(treeGrid.nativeElement.getBoundingClientRect().top + treeGrid.nativeElement.getBoundingClientRect().height); @@ -1298,7 +1298,7 @@ describe('IgxTreeGrid - Expanding / Collapsing #tGrid', () => { fix.detectChanges(); expect(overlayContent.getBoundingClientRect().height).toBeGreaterThan(0); - expect(treeGrid.rowEditingOverlay.collapsed).toBeFalsy('Edit overlay should be visible'); + expect(treeGrid.rowEditingOverlay.collapsed, 'Edit overlay should be visible').toBeFalsy(); expect(overlayContent.getBoundingClientRect().top).toBeLessThan(treeGrid.nativeElement.getBoundingClientRect().top + treeGrid.nativeElement.getBoundingClientRect().height); }); @@ -1309,7 +1309,7 @@ describe('IgxTreeGrid - Expanding / Collapsing #tGrid', () => { const cell = treeGrid.getCellByColumn(9, 'Name'); const overlayContent = GridFunctions.getRowEditingBanner(fix); expect(overlayContent.getBoundingClientRect().height).toBe(0); - expect(treeGrid.rowEditingOverlay.collapsed).toBeTruthy('Edit overlay should not be visible'); + expect(treeGrid.rowEditingOverlay.collapsed, 'Edit overlay should not be visible').toBeTruthy(); cell.editMode = true; fix.detectChanges(); @@ -1318,7 +1318,7 @@ describe('IgxTreeGrid - Expanding / Collapsing #tGrid', () => { fix.detectChanges(); expect(overlayContent.getBoundingClientRect().height).toBeGreaterThan(0); - expect(treeGrid.rowEditingOverlay.collapsed).toBeFalsy('Edit overlay should be visible'); + expect(treeGrid.rowEditingOverlay.collapsed, 'Edit overlay should be visible').toBeFalsy(); expect(overlayContent.getBoundingClientRect().top).toBeLessThan(treeGrid.nativeElement.getBoundingClientRect().top + treeGrid.nativeElement.getBoundingClientRect().height); @@ -1326,7 +1326,7 @@ describe('IgxTreeGrid - Expanding / Collapsing #tGrid', () => { fix.detectChanges(); expect(overlayContent.getBoundingClientRect().height).toBeGreaterThan(0); - expect(treeGrid.rowEditingOverlay.collapsed).toBeFalsy('Edit overlay should be visible'); + expect(treeGrid.rowEditingOverlay.collapsed, 'Edit overlay should be visible').toBeFalsy(); expect(overlayContent.getBoundingClientRect().top).toBeLessThan(treeGrid.nativeElement.getBoundingClientRect().top + treeGrid.nativeElement.getBoundingClientRect().height); }); @@ -1351,7 +1351,7 @@ describe('IgxTreeGrid - Expanding / Collapsing #tGrid', () => { let overlayContent = GridFunctions.getRowEditingBanner(fix); expect(overlayContent.getBoundingClientRect().height).toBe(0); - expect(treeGrid.rowEditingOverlay.collapsed).toBeTruthy('Edit overlay should not be visible'); + expect(treeGrid.rowEditingOverlay.collapsed, 'Edit overlay should not be visible').toBeTruthy(); const cell = treeGrid.getCellByColumn(2, 'Name'); cell.editMode = true; fix.detectChanges(); @@ -1361,14 +1361,14 @@ describe('IgxTreeGrid - Expanding / Collapsing #tGrid', () => { indicatorDiv.triggerEventHandler('click', new Event('click')); fix.detectChanges(); - expect(treeGrid.rowEditingOverlay.collapsed).toBeFalsy('Edit overlay should be visible'); + expect(treeGrid.rowEditingOverlay.collapsed, 'Edit overlay should be visible').toBeFalsy(); expect(overlayContent.getBoundingClientRect().top).toBeGreaterThan(treeGrid.nativeElement.getBoundingClientRect().top + treeGrid.nativeElement.getBoundingClientRect().height); indicatorDiv.triggerEventHandler('click', new Event('click')); fix.detectChanges(); - expect(treeGrid.rowEditingOverlay.collapsed).toBeFalsy('Edit overlay should be visible but outside of bounds'); + expect(treeGrid.rowEditingOverlay.collapsed, 'Edit overlay should be visible but outside of bounds').toBeFalsy(); expect(overlayContent.getBoundingClientRect().top).toBeLessThan(treeGrid.nativeElement.getBoundingClientRect().top + treeGrid.nativeElement.getBoundingClientRect().height); }); @@ -1400,7 +1400,7 @@ const verifyGridPager = (fix, rowsCount, firstCellValue, pagerText, buttonsVisib const gridElement: HTMLElement = fix.nativeElement.querySelector('.igx-grid'); expect(grid.getCellByColumn(0, 'ID').value).toMatch(firstCellValue); - expect(grid.rowList.length).toEqual(rowsCount, 'Invalid number of rows initialized'); + expect(grid.rowList.length, 'Invalid number of rows initialized').toEqual(rowsCount); if (pagerText != null) { expect(gridElement.querySelector('igx-page-nav')).toBeDefined(); diff --git a/projects/igniteui-angular/grids/tree-grid/src/tree-grid-filtering.spec.ts b/projects/igniteui-angular/grids/tree-grid/src/tree-grid-filtering.spec.ts index 1ee5653c894..f42077b92a5 100644 --- a/projects/igniteui-angular/grids/tree-grid/src/tree-grid-filtering.spec.ts +++ b/projects/igniteui-angular/grids/tree-grid/src/tree-grid-filtering.spec.ts @@ -289,12 +289,12 @@ describe('IgxTreeGrid - Filtering actions #tGrid', () => { grid.filter('ID', 0, IgxNumberFilteringOperand.instance().condition('equals')); fix.detectChanges(); let rows = TreeGridFunctions.getAllRows(fix); - expect(rows.length).toEqual(5, 'Wrong rows count'); + expect(rows.length, 'Wrong rows count').toEqual(5); grid.filter('ID', 1, IgxNumberFilteringOperand.instance().condition('equals')); fix.detectChanges(); rows = TreeGridFunctions.getAllRows(fix); - expect(rows.length).toEqual(17, 'Wrong rows count'); + expect(rows.length, 'Wrong rows count').toEqual(17); }); it('\'Blanks\' should be always visible', fakeAsync(() => { @@ -368,14 +368,14 @@ describe('IgxTreeGrid - Filtering actions #tGrid', () => { tick(); let treeItems = GridFunctions.getExcelStyleSearchComponentTreeNodes(fix, null); - expect(treeItems.length).toBe(4, 'incorrect rendered tree node count'); + expect(treeItems.length, 'incorrect rendered tree node count').toBe(4); GridFunctions.clickExcelTreeNodeExpandIcon(fix, 0); fix.detectChanges(); tick(); treeItems = GridFunctions.getExcelStyleSearchComponentTreeNodes(fix, null); - expect(treeItems.length).toBe(6, 'incorrect rendered tree node count'); + expect(treeItems.length, 'incorrect rendered tree node count').toBe(6); })); it('Should change arrow icon on expand', fakeAsync(() => { @@ -385,14 +385,14 @@ describe('IgxTreeGrid - Filtering actions #tGrid', () => { const icon = GridFunctions.getExcelFilterTreeNodeIcon(fix, 0); let iconText = icon.children[0].innerText; - expect(iconText).toBe('chevron_right', 'incorrect rendered icon'); + expect(iconText, 'incorrect rendered icon').toBe('chevron_right'); GridFunctions.clickExcelTreeNodeExpandIcon(fix, 0); fix.detectChanges(); tick(); iconText = icon.children[0].innerText; - expect(iconText).toBe('expand_more', 'incorrect rendered icon'); + expect(iconText, 'incorrect rendered icon').toBe('expand_more'); })); it('Should display Select All item', fakeAsync(() => { @@ -473,7 +473,7 @@ describe('IgxTreeGrid - Filtering actions #tGrid', () => { const searchComponent = GridFunctions.getExcelStyleSearchComponent(fix, null, 'igx-tree-grid'); let treeItems = GridFunctions.getExcelStyleSearchComponentTreeNodes(fix, searchComponent); - expect(treeItems.length).toBe(4, 'incorrect rendered items count'); + expect(treeItems.length, 'incorrect rendered items count').toBe(4); const inputNativeElement = GridFunctions.getExcelStyleSearchComponentInput(fix, searchComponent, 'igx-tree-grid'); UIInteractions.clickAndSendInputElementValue(inputNativeElement, '6', fix); @@ -481,7 +481,7 @@ describe('IgxTreeGrid - Filtering actions #tGrid', () => { tick(); treeItems = GridFunctions.getExcelStyleSearchComponentTreeNodes(fix, searchComponent); - expect(treeItems.length).toBe(2, 'incorrect rendered items count'); + expect(treeItems.length, 'incorrect rendered items count').toBe(2); const clearIcon: any = Array.from(searchComponent.querySelectorAll('igx-icon')) .find((icon: any) => icon.innerText === 'clear'); @@ -490,7 +490,7 @@ describe('IgxTreeGrid - Filtering actions #tGrid', () => { fix.detectChanges(); treeItems = GridFunctions.getExcelStyleSearchComponentTreeNodes(fix, searchComponent); - expect(treeItems.length).toBe(4, 'incorrect rendered items count'); + expect(treeItems.length, 'incorrect rendered items count').toBe(4); })); it('Should filter items and clear filters correctly', fakeAsync(() => { @@ -506,7 +506,7 @@ describe('IgxTreeGrid - Filtering actions #tGrid', () => { let searchComponent = GridFunctions.getExcelStyleSearchComponent(fix, null, 'igx-tree-grid'); let treeItems = GridFunctions.getExcelStyleSearchComponentTreeNodes(fix, searchComponent); - expect(treeItems.length).toBe(4, 'incorrect rendered items count'); + expect(treeItems.length, 'incorrect rendered items count').toBe(4); const inputNativeElement = GridFunctions.getExcelStyleSearchComponentInput(fix, searchComponent, 'igx-tree-grid'); UIInteractions.clickAndSendInputElementValue(inputNativeElement, '8', fix); @@ -514,7 +514,7 @@ describe('IgxTreeGrid - Filtering actions #tGrid', () => { tick(); treeItems = GridFunctions.getExcelStyleSearchComponentTreeNodes(fix, searchComponent); - expect(treeItems.length).toBe(4, 'incorrect rendered items count'); + expect(treeItems.length, 'incorrect rendered items count').toBe(4); GridFunctions.clickApplyExcelStyleFiltering(fix, null, 'igx-tree-grid'); fix.detectChanges(); @@ -539,7 +539,7 @@ describe('IgxTreeGrid - Filtering actions #tGrid', () => { searchComponent = GridFunctions.getExcelStyleSearchComponent(fix, null, 'igx-tree-grid'); treeItems = GridFunctions.getExcelStyleSearchComponentTreeNodes(fix, searchComponent); - expect(treeItems.length).toBe(4, 'incorrect rendered tree node items count'); + expect(treeItems.length, 'incorrect rendered tree node items count').toBe(4); GridFunctions.clickApplyExcelStyleFiltering(fix, null, 'igx-tree-grid'); fix.detectChanges(); @@ -549,7 +549,7 @@ describe('IgxTreeGrid - Filtering actions #tGrid', () => { .map(c => c.nativeElement.innerText) .sort(); - expect(gridCellValues.length).toEqual(18, 'incorrect rendered grid items count'); + expect(gridCellValues.length, 'incorrect rendered grid items count').toEqual(18); })); it('Should update checkboxes after clearing column filters correctly', fakeAsync(() => { @@ -580,7 +580,7 @@ describe('IgxTreeGrid - Filtering actions #tGrid', () => { tick(); let checkboxes: any[] = Array.from(GridFunctions.getExcelStyleFilteringCheckboxes(fix, excelMenu, 'igx-tree-grid')); - checkboxes.forEach(ch => expect(ch.checked).toBe(true, 'incorrect checkbox state')); + checkboxes.forEach(ch => expect(ch.checked, 'incorrect checkbox state').toBe(true)); searchComponent = GridFunctions.getExcelStyleSearchComponent(fix, null, 'igx-tree-grid'); inputNativeElement = GridFunctions.getExcelStyleSearchComponentInput(fix, searchComponent, 'igx-tree-grid'); @@ -591,8 +591,8 @@ describe('IgxTreeGrid - Filtering actions #tGrid', () => { checkboxes = Array.from(GridFunctions.getExcelStyleFilteringCheckboxes(fix, excelMenu, 'igx-tree-grid')); const addToFilterCheckbox = checkboxes.splice(1, 1)[0]; - expect(addToFilterCheckbox.checked).toBe(false, 'incorrect checkbox state'); - checkboxes.forEach(ch => expect(ch.checked).toBe(true, 'incorrect checkbox state')); + expect(addToFilterCheckbox.checked, 'incorrect checkbox state').toBe(false); + checkboxes.forEach(ch => expect(ch.checked, 'incorrect checkbox state').toBe(true)); })); it('Should filter tree grid correctly', fakeAsync(() => { @@ -608,7 +608,7 @@ describe('IgxTreeGrid - Filtering actions #tGrid', () => { tick(); const treeItems = GridFunctions.getExcelStyleSearchComponentTreeNodes(fix, searchComponent); - expect(treeItems.length).toEqual(2, 'incorrect rendered items count'); + expect(treeItems.length, 'incorrect rendered items count').toEqual(2); GridFunctions.clickApplyExcelStyleFiltering(fix, null, 'igx-tree-grid'); fix.detectChanges(); @@ -821,7 +821,7 @@ describe('IgxTreeGrid - Filtering actions #tGrid', () => { tick(); const treeItems = GridFunctions.getExcelStyleSearchComponentTreeNodes(fix, searchComponent); - expect(treeItems.length).toEqual(2, 'incorrect rendered items count'); + expect(treeItems.length, 'incorrect rendered items count').toEqual(2); GridFunctions.clickApplyExcelStyleFiltering(fix, null, 'igx-tree-grid'); fix.detectChanges(); diff --git a/projects/igniteui-angular/grids/tree-grid/src/tree-grid-indentation.spec.ts b/projects/igniteui-angular/grids/tree-grid/src/tree-grid-indentation.spec.ts index 297f39372a4..2a2e24139e0 100644 --- a/projects/igniteui-angular/grids/tree-grid/src/tree-grid-indentation.spec.ts +++ b/projects/igniteui-angular/grids/tree-grid/src/tree-grid-indentation.spec.ts @@ -95,7 +95,7 @@ describe('IgxTreeGrid - Indentation #tGrid', () => { // Verify page 1 let rows = TreeGridFunctions.sortElementsVertically(TreeGridFunctions.getAllRows(fix)); - expect(rows.length).toBe(4, 'Incorrect number of rows on page 1.'); + expect(rows.length, 'Incorrect number of rows on page 1.').toBe(4); TreeGridFunctions.verifyRowIndentationLevel(treeGrid.getRowByIndex(0), rows[0], 0); TreeGridFunctions.verifyRowIndentationLevel(treeGrid.getRowByIndex(1), rows[1], 1); TreeGridFunctions.verifyRowIndentationLevel(treeGrid.getRowByIndex(2), rows[2], 1); @@ -107,7 +107,7 @@ describe('IgxTreeGrid - Indentation #tGrid', () => { // Verify page 2 rows = TreeGridFunctions.sortElementsVertically(TreeGridFunctions.getAllRows(fix)); - expect(rows.length).toBe(4, 'Incorrect number of rows on page 2.'); + expect(rows.length, 'Incorrect number of rows on page 2.').toBe(4); TreeGridFunctions.verifyRowIndentationLevel(treeGrid.getRowByIndex(0), rows[0], 2); TreeGridFunctions.verifyRowIndentationLevel(treeGrid.getRowByIndex(1), rows[1], 2); TreeGridFunctions.verifyRowIndentationLevel(treeGrid.getRowByIndex(2), rows[2], 2); @@ -119,7 +119,7 @@ describe('IgxTreeGrid - Indentation #tGrid', () => { // Verify page 3 rows = TreeGridFunctions.sortElementsVertically(TreeGridFunctions.getAllRows(fix)); - expect(rows.length).toBe(2, 'Incorrect number of rows on page 3.'); + expect(rows.length, 'Incorrect number of rows on page 3.').toBe(2); TreeGridFunctions.verifyRowIndentationLevel(treeGrid.getRowByIndex(0), rows[0], 0); TreeGridFunctions.verifyRowIndentationLevel(treeGrid.getRowByIndex(1), rows[1], 1); })); @@ -256,7 +256,7 @@ describe('IgxTreeGrid - Indentation #tGrid', () => { // Verify page 1 let rows = TreeGridFunctions.sortElementsVertically(TreeGridFunctions.getAllRows(fix)); - expect(rows.length).toBe(3, 'Incorrect number of rows on page 1.'); + expect(rows.length, 'Incorrect number of rows on page 1.').toBe(3); TreeGridFunctions.verifyRowIndentationLevel(treeGrid.getRowByIndex(0), rows[0], 0); TreeGridFunctions.verifyRowIndentationLevel(treeGrid.getRowByIndex(1), rows[1], 1); TreeGridFunctions.verifyRowIndentationLevel(treeGrid.getRowByIndex(2), rows[2], 2); @@ -267,7 +267,7 @@ describe('IgxTreeGrid - Indentation #tGrid', () => { // Verify page 2 rows = TreeGridFunctions.sortElementsVertically(TreeGridFunctions.getAllRows(fix)); - expect(rows.length).toBe(3, 'Incorrect number of rows on page 2.'); + expect(rows.length, 'Incorrect number of rows on page 2.').toBe(3); TreeGridFunctions.verifyRowIndentationLevel(treeGrid.getRowByIndex(0), rows[0], 2); TreeGridFunctions.verifyRowIndentationLevel(treeGrid.getRowByIndex(1), rows[1], 1); TreeGridFunctions.verifyRowIndentationLevel(treeGrid.getRowByIndex(2), rows[2], 0); @@ -278,7 +278,7 @@ describe('IgxTreeGrid - Indentation #tGrid', () => { // Verify page 3 rows = TreeGridFunctions.sortElementsVertically(TreeGridFunctions.getAllRows(fix)); - expect(rows.length).toBe(2, 'Incorrect number of rows on page 3.'); + expect(rows.length, 'Incorrect number of rows on page 3.').toBe(2); TreeGridFunctions.verifyRowIndentationLevel(treeGrid.getRowByIndex(0), rows[0], 0); TreeGridFunctions.verifyRowIndentationLevel(treeGrid.getRowByIndex(1), rows[1], 1); })); @@ -346,8 +346,7 @@ const verifyCellsContentAlignment = (fix, columnKey, shouldBeLeftAligned: boolea const cells = TreeGridFunctions.getColumnCells(fix, columnKey); if (shouldBeLeftAligned) { cells.forEach((cell) => { - expect(cell.nativeElement.classList.contains(NUMBER_CELL_CSS_CLASS)) - .toBe(false, 'cell has number css class'); + expect(cell.nativeElement.classList.contains(NUMBER_CELL_CSS_CLASS), 'cell has number css class').toBe(false); // TreeCells have either 2 or 3 div children (2 for root rows and 3 for child rows). const cellDivChildren = cell.queryAll(By.css('div')); @@ -355,8 +354,7 @@ const verifyCellsContentAlignment = (fix, columnKey, shouldBeLeftAligned: boolea }); } else { // Should be right-aligned cells.forEach((cell) => { - expect(cell.nativeElement.classList.contains(NUMBER_CELL_CSS_CLASS)) - .toBe(true, 'cell does not have number css class'); + expect(cell.nativeElement.classList.contains(NUMBER_CELL_CSS_CLASS), 'cell does not have number css class').toBe(true); // NormalCells have 1 div child (no div for indentation and no div for expander). const cellDivChildren = cell.queryAll(By.css('div')); diff --git a/projects/igniteui-angular/grids/tree-grid/src/tree-grid-integration.spec.ts b/projects/igniteui-angular/grids/tree-grid/src/tree-grid-integration.spec.ts index 069a8ba6954..3bd67eedc04 100644 --- a/projects/igniteui-angular/grids/tree-grid/src/tree-grid-integration.spec.ts +++ b/projects/igniteui-angular/grids/tree-grid/src/tree-grid-integration.spec.ts @@ -154,14 +154,14 @@ describe('IgxTreeGrid - Integration #tGrid', () => { const headerCell = TreeGridFunctions.getHeaderCell(fix, 'ID'); const column = treeGrid.columnList.filter(c => c.field === 'ID')[0]; - expect(headerCell.nativeElement.getBoundingClientRect().width).toBe(225, 'incorrect column width'); + expect(headerCell.nativeElement.getBoundingClientRect().width, 'incorrect column width').toBe(225); expect(parseInt(column.width, 10)).toBe(225); // API autosizing column.autosize(); fix.detectChanges(); - expect(headerCell.nativeElement.getBoundingClientRect().width).toBe(148, 'incorrect headerCell width'); + expect(headerCell.nativeElement.getBoundingClientRect().width, 'incorrect headerCell width').toBe(148); expect(parseInt(column.width, 10)).toBe(148); }); @@ -171,7 +171,7 @@ describe('IgxTreeGrid - Integration #tGrid', () => { column.resizable = true; treeGrid.cdr.detectChanges(); - expect(headerCell.nativeElement.getBoundingClientRect().width).toBe(225, 'incorrect column width'); + expect(headerCell.nativeElement.getBoundingClientRect().width, 'incorrect column width').toBe(225); expect(parseInt(column.width, 10)).toBe(225); // UI autosizing @@ -179,7 +179,7 @@ describe('IgxTreeGrid - Integration #tGrid', () => { UIInteractions.simulateMouseEvent('dblclick', resizer, 225, 5); fix.detectChanges(); - expect(headerCell.nativeElement.getBoundingClientRect().width).toBe(148, 'incorrect headerCell width'); + expect(headerCell.nativeElement.getBoundingClientRect().width, 'incorrect headerCell width').toBe(148); expect(parseInt(column.width, 10)).toBe(148); }); }); @@ -338,14 +338,14 @@ describe('IgxTreeGrid - Integration #tGrid', () => { const headerCell = TreeGridFunctions.getHeaderCell(fix, 'ID'); const column = treeGrid.columnList.filter(c => c.field === 'ID')[0]; - expect(headerCell.nativeElement.getBoundingClientRect().width).toBe(180, 'incorrect column width'); + expect(headerCell.nativeElement.getBoundingClientRect().width, 'incorrect column width').toBe(180); expect(parseInt(column.width, 10)).toBe(180); // API autosizing column.autosize(); fix.detectChanges(); - expect(headerCell.nativeElement.getBoundingClientRect().width).toBe(135, 'incorrect headerCell width'); + expect(headerCell.nativeElement.getBoundingClientRect().width, 'incorrect headerCell width').toBe(135); expect(parseInt(column.width, 10)).toBe(135); }); @@ -355,7 +355,7 @@ describe('IgxTreeGrid - Integration #tGrid', () => { column.resizable = true; treeGrid.cdr.detectChanges(); - expect(headerCell.nativeElement.getBoundingClientRect().width).toBe(180, 'incorrect column width'); + expect(headerCell.nativeElement.getBoundingClientRect().width, 'incorrect column width').toBe(180); expect(parseInt(column.width, 10)).toBe(180); // UI autosizing @@ -363,7 +363,7 @@ describe('IgxTreeGrid - Integration #tGrid', () => { UIInteractions.simulateMouseEvent('dblclick', resizer, 225, 5); fix.detectChanges(); - expect(headerCell.nativeElement.getBoundingClientRect().width).toBe(135, 'incorrect headerCell width'); + expect(headerCell.nativeElement.getBoundingClientRect().width, 'incorrect headerCell width').toBe(135); expect(parseInt(column.width, 10)).toBe(135); }); }); diff --git a/projects/igniteui-angular/grids/tree-grid/src/tree-grid-search.spec.ts b/projects/igniteui-angular/grids/tree-grid/src/tree-grid-search.spec.ts index dfbcdda7e26..aabcb3bfbad 100644 --- a/projects/igniteui-angular/grids/tree-grid/src/tree-grid-search.spec.ts +++ b/projects/igniteui-angular/grids/tree-grid/src/tree-grid-search.spec.ts @@ -406,17 +406,17 @@ const verifySearchResult = (nativeParent, expectedHighlightSpansCount, expectedA const activeSpan = getActiveSpan(nativeParent); if (actualAPISearchCount) { - expect(actualAPISearchCount).toBe(expectedHighlightSpansCount, 'incorrect highlight elements count returned from api'); + expect(actualAPISearchCount, 'incorrect highlight elements count returned from api').toBe(expectedHighlightSpansCount); } - expect(spans.length).toBe(expectedHighlightSpansCount, 'incorrect highlight elements count'); + expect(spans.length, 'incorrect highlight elements count').toBe(expectedHighlightSpansCount); if (expectedActiveSpanIndex !== -1) { // If active element should exist. - expect(activeSpan).toBe(spans[expectedActiveSpanIndex], 'incorrect active element'); + expect(activeSpan, 'incorrect active element').toBe(spans[expectedActiveSpanIndex]); } else { // If active element should not exist. (used when spans.length is expected to be 0 as well) - expect(activeSpan).toBeNull('active element was found'); + expect(activeSpan, 'active element was found').toBeNull(); } }; @@ -434,7 +434,7 @@ const verifyVisibleCellValueDivsCount = (fix) => { allCells.forEach(cell => { const valueDivs: HTMLElement[] = Array.from(cell.nativeElement.querySelectorAll(CELL_VALUE_DIV_CSS_CLASS)); // only one visible 'value div' should be present - expect(valueDivs.filter(div => !div.hidden).length).toBe(1, 'incorrect visible value divs count'); + expect(valueDivs.filter(div => !div.hidden).length, 'incorrect visible value divs count').toBe(1); }); }; diff --git a/projects/igniteui-angular/navbar/src/navbar/navbar.component.spec.ts b/projects/igniteui-angular/navbar/src/navbar/navbar.component.spec.ts index cfa9dbc0e46..39ea184bf41 100644 --- a/projects/igniteui-angular/navbar/src/navbar/navbar.component.spec.ts +++ b/projects/igniteui-angular/navbar/src/navbar/navbar.component.spec.ts @@ -87,14 +87,14 @@ describe('IgxNavbar', () => { // Verify there is no custom content on the left const customContent = leftArea.query(By.css('igx-navbar-action')); - expect(customContent).toBeNull('Custom action icon content is found on the left.'); + expect(customContent, 'Custom action icon content is found on the left.').toBeNull(); // Verify there is a default icon on the left. const defaultIcon = leftArea.query(By.css('igx-icon')); expect(defaultIcon).not.toBeNull('Default icon is not found on the left.'); const leftAreaLeft = leftArea.nativeElement.getBoundingClientRect().left; const defaultIconLeft = defaultIcon.nativeElement.getBoundingClientRect().left; - expect(leftAreaLeft).toBe(defaultIconLeft, 'Default icon is not first on the left.'); + expect(leftAreaLeft, 'Default icon is not first on the left.').toBe(defaultIconLeft); }); }); @@ -107,14 +107,14 @@ describe('IgxNavbar', () => { // Verify there is no default icon on the left. const defaultIcon = leftArea.query(By.css('igx-icon')); - expect(defaultIcon).toBeNull('Default icon is found on the left.'); + expect(defaultIcon, 'Default icon is found on the left.').toBeNull(); // Verify there is a custom content on the left. const customContent = leftArea.query(By.css('igx-navbar-action')); expect(customContent).not.toBeNull('Custom action icon content is not found on the left.'); const leftAreaLeft = leftArea.nativeElement.getBoundingClientRect().left; const customContentLeft = customContent.nativeElement.getBoundingClientRect().left; - expect(leftAreaLeft).toBe(customContentLeft, 'Custom action icon content is not first on the left.'); + expect(leftAreaLeft, 'Custom action icon content is not first on the left.').toBe(customContentLeft); }); it('should have vertically-centered custom action icon content', (async () => { @@ -133,7 +133,7 @@ describe('IgxNavbar', () => { const navbarMidpoint = Math.round(navbarRect.top + (navbarRect.height / 2)); const iconMidpoint = Math.round(iconRect.top + (iconRect.height / 2)); - expect(navbarMidpoint).toBe(iconMidpoint, 'Custom icon is not exactly vertically centered within the navbar.'); + expect(navbarMidpoint, 'Custom icon is not exactly vertically centered within the navbar.').toBe(iconMidpoint); })); it('action icon via directive', (async () => { @@ -146,7 +146,7 @@ describe('IgxNavbar', () => { const leftAreaLeft = leftArea.nativeElement.getBoundingClientRect().left; const customContentLeft = customContent.nativeElement.getBoundingClientRect().left; - expect(leftAreaLeft).toBe(customContentLeft, 'Custom action icon content is not first on the left.'); + expect(leftAreaLeft, 'Custom action icon content is not first on the left.').toBe(customContentLeft); })); }); @@ -166,10 +166,10 @@ describe('IgxNavbar', () => { // Verify there is no default icon on the left. const customTitle = midArea.query(By.css('igx-navbar-title')); - expect(customTitle.nativeElement.textContent).toBe('Custom Title', 'Custom title is missing'); + expect(customTitle.nativeElement.textContent, 'Custom title is missing').toBe('Custom Title'); const defaultTitle = midArea.query(By.css('igx-navbar__title')); - expect(defaultTitle).toBeNull('Default title should not be present'); + expect(defaultTitle, 'Default title should not be present').toBeNull(); }); it('Custom content should override the default title property', () => { @@ -180,11 +180,11 @@ describe('IgxNavbar', () => { // Verify there is no default icon on the left. const customTitle = midArea.query(By.directive(IgxNavbarTitleDirective)); - expect(customTitle.nativeElement.children[0].textContent).toBe('Custom', 'Custom title is missing'); - expect(customTitle.nativeElement.children[1].textContent).toBe('Title', 'Custom title is missing'); + expect(customTitle.nativeElement.children[0].textContent, 'Custom title is missing').toBe('Custom'); + expect(customTitle.nativeElement.children[1].textContent, 'Custom title is missing').toBe('Title'); const defaultTitle = midArea.query(By.css('igx-navbar__title')); - expect(defaultTitle).toBeNull('Default title should not be present'); + expect(defaultTitle, 'Default title should not be present').toBeNull(); }); }); }); diff --git a/projects/igniteui-angular/navigation-drawer/src/navigation-drawer/navigation-drawer.component.spec.ts b/projects/igniteui-angular/navigation-drawer/src/navigation-drawer/navigation-drawer.component.spec.ts index 89d42da3b9e..bade2699e60 100644 --- a/projects/igniteui-angular/navigation-drawer/src/navigation-drawer/navigation-drawer.component.spec.ts +++ b/projects/igniteui-angular/navigation-drawer/src/navigation-drawer/navigation-drawer.component.spec.ts @@ -369,12 +369,11 @@ describe('Navigation Drawer', () => { return swipe(document.body, 80, 10, 100, 250, 0); }) .then(() => { - expect(fixture.componentInstance.navDrawer.isOpen) - .toEqual(false, 'should ignore swipes too far away from the edge'); + expect(fixture.componentInstance.navDrawer.isOpen, 'should ignore swipes too far away from the edge').toEqual(false); return swipe(document.body, 10, 10, 150, 250, 0); }) .then(() => { - expect(fixture.componentInstance.navDrawer.isOpen).toEqual(true, 'Should accept edge swipe'); + expect(fixture.componentInstance.navDrawer.isOpen, 'Should accept edge swipe').toEqual(true); return swipe(document.body, 180, 10, 150, -180, 0); }) .then(() => { @@ -406,30 +405,29 @@ describe('Navigation Drawer', () => { // mid gesture expect(navDrawer.drawer.classList).toContain('panning'); - expect(navDrawer.drawer.style.transform) - .toMatch(/translate3d\(-2\d\dpx, 0px, 0px\)/, 'Drawer should be moving with the pan'); + expect(navDrawer.drawer.style.transform, 'Drawer should be moving with the pan').toMatch(/translate3d\(-2\d\dpx, 0px, 0px\)/); listener(); }); return pan(document.body, 10, 10, 150, 20, 0); }) .then(() => { - expect(navDrawer.isOpen).toEqual(false, 'should ignore too short pan'); + expect(navDrawer.isOpen, 'should ignore too short pan').toEqual(false); // valid pan return pan(document.body, 10, 10, 100, 200, 0); }).then(() => { - expect(navDrawer.isOpen).toEqual(true, 'should open on valid pan'); + expect(navDrawer.isOpen, 'should open on valid pan').toEqual(true); // not enough distance, closing return pan(document.body, 200, 10, 100, -20, 0); }).then(() => { - expect(navDrawer.isOpen).toEqual(true, 'should remain open on too short pan'); + expect(navDrawer.isOpen, 'should remain open on too short pan').toEqual(true); // close return pan(document.body, 250, 10, 100, -200, 0); }).then(() => { - expect(navDrawer.isOpen).toEqual(false, 'should close on valid pan'); + expect(navDrawer.isOpen, 'should close on valid pan').toEqual(false); done(); }).catch(() => { done(); @@ -549,8 +547,8 @@ describe('Navigation Drawer', () => { await fixture.whenStable(); // defaults: - expect(fixture.componentInstance.navDrawer.pin).toBe(false, 'Should be initially unpinned'); - expect(fixture.componentInstance.pin).toBe(false, 'Parent component pin should update initially'); + expect(fixture.componentInstance.navDrawer.pin, 'Should be initially unpinned').toBe(false); + expect(fixture.componentInstance.pin, 'Parent component pin should update initially').toBe(false); // manual pin override fixture.componentInstance.pin = true; @@ -559,8 +557,8 @@ describe('Navigation Drawer', () => { // wait for debounce await wait(200); - expect(fixture.componentInstance.navDrawer.pin).toBe(false, `Shouldn't change state on resize if window width is the same`); - expect(fixture.componentInstance.pin).toBe(true, 'Parent component pin remain on resize if window width is the same'); + expect(fixture.componentInstance.navDrawer.pin, `Shouldn't change state on resize if window width is the same`).toBe(false); + expect(fixture.componentInstance.pin, 'Parent component pin remain on resize if window width is the same').toBe(true); fixture.componentInstance.pin = true; fixture.detectChanges(); @@ -569,21 +567,21 @@ describe('Navigation Drawer', () => { // wait for debounce await wait(200); - expect(fixture.componentInstance.navDrawer.pin).toBe(true, 'Should pin on window resize over threshold'); - expect(fixture.componentInstance.pin).toBe(true, 'Parent pin update on window resize over threshold'); + expect(fixture.componentInstance.navDrawer.pin, 'Should pin on window resize over threshold').toBe(true); + expect(fixture.componentInstance.pin, 'Parent pin update on window resize over threshold').toBe(true); widthSpyOverride.mockReturnValue(768); window.dispatchEvent(new Event('resize')); // wait for debounce await wait(200); - expect(fixture.componentInstance.navDrawer.pin).toBe(false, 'Should un-pin on window resize below threshold'); - expect(fixture.componentInstance.pin).toBe(false, 'Parent pin update on window resize below threshold'); + expect(fixture.componentInstance.navDrawer.pin, 'Should un-pin on window resize below threshold').toBe(false); + expect(fixture.componentInstance.pin, 'Parent pin update on window resize below threshold').toBe(false); fixture.componentInstance.pinThreshold = 500; expect(() => fixture.detectChanges()).not.toThrow(); await fixture.whenStable(); - expect(fixture.componentInstance.navDrawer.pin).toBe(true, 'Should re-pin on window resize over threshold'); - expect(fixture.componentInstance.pin).toBe(true, 'Parent pin update on re-pin'); + expect(fixture.componentInstance.navDrawer.pin, 'Should re-pin on window resize over threshold').toBe(true); + expect(fixture.componentInstance.pin, 'Parent pin update on re-pin').toBe(true); }); it('should get correct window width', async () => { diff --git a/projects/igniteui-angular/query-builder/src/query-builder/query-builder-functions.spec.ts b/projects/igniteui-angular/query-builder/src/query-builder/query-builder-functions.spec.ts index 971058e4940..da9cde2a49e 100644 --- a/projects/igniteui-angular/query-builder/src/query-builder/query-builder-functions.spec.ts +++ b/projects/igniteui-angular/query-builder/src/query-builder/query-builder-functions.spec.ts @@ -521,24 +521,24 @@ export class QueryBuilderFunctions { * (NOTE: The 'operator' argument must be a string with a value that is either 'and' or 'or'.) */ public static verifyOperatorLine(operatorLine: HTMLElement, operator: string) { - expect(operator === 'and' || operator === 'or').toBe(true, 'operator must be \'and\' or \'or\''); + expect(operator === 'and' || operator === 'or', 'operator must be \'and\' or \'or\'').toBe(true); if (operator === 'and') { - expect(operatorLine.classList.contains(QueryBuilderSelectors.FILTER_TREE_LINE_AND)).toBe(true, 'incorrect operator line'); - expect(operatorLine.classList.contains(QueryBuilderSelectors.FILTER_TREE_LINE_OR)).toBe(false, 'incorrect operator line'); + expect(operatorLine.classList.contains(QueryBuilderSelectors.FILTER_TREE_LINE_AND), 'incorrect operator line').toBe(true); + expect(operatorLine.classList.contains(QueryBuilderSelectors.FILTER_TREE_LINE_OR), 'incorrect operator line').toBe(false); } else { - expect(operatorLine.classList.contains(QueryBuilderSelectors.FILTER_TREE_LINE_AND)).toBe(false, 'incorrect operator line'); - expect(operatorLine.classList.contains(QueryBuilderSelectors.FILTER_TREE_LINE_OR)).toBe(true, 'incorrect operator line'); + expect(operatorLine.classList.contains(QueryBuilderSelectors.FILTER_TREE_LINE_AND), 'incorrect operator line').toBe(false); + expect(operatorLine.classList.contains(QueryBuilderSelectors.FILTER_TREE_LINE_OR), 'incorrect operator line').toBe(true); } } public static verifyEditModeQueryExpressionInputStates(fix, entitySelectEnabled: boolean, fieldComboEnabled: boolean, columnSelectEnabled?: boolean, operatorSelectEnabled?: boolean, valueInputEnabled?: boolean, commitButtonEnabled?: boolean, level = 0) { // Verify the entity select state. const entityInputGroup = QueryBuilderFunctions.getQueryBuilderEntitySelect(fix, level).querySelector('igx-input-group'); - expect(!entityInputGroup.classList.contains('igx-input-group--disabled')).toBe(entitySelectEnabled, 'incorrect entity select state'); + expect(!entityInputGroup.classList.contains('igx-input-group--disabled'), 'incorrect entity select state').toBe(entitySelectEnabled); // Verify the fields combo state. const fieldInputGroup = QueryBuilderFunctions.getQueryBuilderFieldsCombo(fix, level).querySelector('igx-input-group'); - expect(!fieldInputGroup.classList.contains('igx-input-group--disabled')).toBe(fieldComboEnabled, 'incorrect fields combo state'); + expect(!fieldInputGroup.classList.contains('igx-input-group--disabled'), 'incorrect fields combo state').toBe(fieldComboEnabled); if (columnSelectEnabled || operatorSelectEnabled || valueInputEnabled || commitButtonEnabled) { QueryBuilderFunctions.verifyEditModeExpressionInputStates(fix, columnSelectEnabled, operatorSelectEnabled, valueInputEnabled, commitButtonEnabled, level); @@ -549,16 +549,16 @@ export class QueryBuilderFunctions { public static verifyEditModeExpressionInputStates(fix, columnSelectEnabled: boolean, operatorSelectEnabled: boolean, valueInputEnabled: boolean, commitButtonEnabled: boolean, level = 0) { // Verify the column select state. const columnInputGroup = QueryBuilderFunctions.getQueryBuilderColumnSelect(fix, level).querySelector('igx-input-group'); - expect(!columnInputGroup.classList.contains('igx-input-group--disabled')).toBe(columnSelectEnabled, 'incorrect column select state'); + expect(!columnInputGroup.classList.contains('igx-input-group--disabled'), 'incorrect column select state').toBe(columnSelectEnabled); // Verify the operator select state. const operatorInputGroup = QueryBuilderFunctions.getQueryBuilderOperatorSelect(fix, level).querySelector('igx-input-group'); - expect(!operatorInputGroup.classList.contains('igx-input-group--disabled')).toBe(operatorSelectEnabled, 'incorrect operator select state'); + expect(!operatorInputGroup.classList.contains('igx-input-group--disabled'), 'incorrect operator select state').toBe(operatorSelectEnabled); // Verify the value input state. const editModeContainer = QueryBuilderFunctions.getQueryBuilderEditModeContainer(fix, false, level); const valueInputGroup = Array.from(editModeContainer.querySelectorAll('igx-input-group'))[2]; - expect(!valueInputGroup.classList.contains('igx-input-group--disabled')).toBe(valueInputEnabled, 'incorrect value input state'); + expect(!valueInputGroup.classList.contains('igx-input-group--disabled'), 'incorrect value input state').toBe(valueInputEnabled); // Verify commit expression button state const commitButton = QueryBuilderFunctions.getQueryBuilderExpressionCommitButton(fix, level); @@ -752,10 +752,10 @@ export class QueryBuilderFunctions { const columnSpan = chipSpans[0]; const operatorSpan = chipSpans[1]; const valueSpan = chipSpans[2]; - expect(columnSpan.textContent.toLowerCase().trim()).toBe(columnText.toLowerCase(), 'incorrect chip column'); - expect(operatorSpan.textContent.toLowerCase().trim()).toBe(operatorText.toLowerCase(), 'incorrect chip operator'); + expect(columnSpan.textContent.toLowerCase().trim(), 'incorrect chip column').toBe(columnText.toLowerCase()); + expect(operatorSpan.textContent.toLowerCase().trim(), 'incorrect chip operator').toBe(operatorText.toLowerCase()); if (valueSpan != undefined && valueText != undefined) { - expect(valueSpan.textContent.toLowerCase().trim().replaceAll(/\s/g, '')).toBe(valueText.toLowerCase().replaceAll(/\s/g, ''), 'incorrect chip filter value'); + expect(valueSpan.textContent.toLowerCase().trim().replaceAll(/\s/g, ''), 'incorrect chip filter value').toBe(valueText.toLowerCase().replaceAll(/\s/g, '')); } } ; @@ -765,23 +765,23 @@ export class QueryBuilderFunctions { const orLines = fix.debugElement.queryAll(By.css(`.${QueryBuilderSelectors.FILTER_TREE_LINE_OR}`)); if (andLineCount) - expect(andLines.length).toBe(andLineCount, "AND groups not the right count"); + expect(andLines.length, "AND groups not the right count").toBe(andLineCount); if (orLineCount) - expect(orLines.length).toBe(orLineCount, "OR groups not the right count"); + expect(orLines.length, "OR groups not the right count").toBe(orLineCount); } ; public static verifyRootAndSubGroupExpressionsCount(fix: ComponentFixture, rootDirect: number, rootTotal: number = null, subGroupPath: number[] = null, subGroupDirect: number = null, subGroupTotal: number = null) { const rootGroup = QueryBuilderFunctions.getQueryBuilderTreeRootGroup(fix) as HTMLElement; expect(rootGroup).not.toBeNull('There is no root group.'); - expect(QueryBuilderFunctions.getQueryBuilderTreeChildItems(rootGroup, true).length).toBe(rootDirect, 'Root direct condition count not correct'); - expect(QueryBuilderFunctions.getQueryBuilderTreeChildItems(rootGroup, false).length).toBe(rootTotal, 'Root direct + child condition count not correct'); + expect(QueryBuilderFunctions.getQueryBuilderTreeChildItems(rootGroup, true).length, 'Root direct condition count not correct').toBe(rootDirect); + expect(QueryBuilderFunctions.getQueryBuilderTreeChildItems(rootGroup, false).length, 'Root direct + child condition count not correct').toBe(rootTotal); if (subGroupPath) { const subGroup = QueryBuilderFunctions.getQueryBuilderTreeItem(fix, subGroupPath) as HTMLElement; if (subGroupDirect) - expect(QueryBuilderFunctions.getQueryBuilderTreeChildItems(subGroup, true).length).toBe(subGroupDirect, 'Child direct condition count not correct'); + expect(QueryBuilderFunctions.getQueryBuilderTreeChildItems(subGroup, true).length, 'Child direct condition count not correct').toBe(subGroupDirect); if (subGroupTotal) - expect(QueryBuilderFunctions.getQueryBuilderTreeChildItems(subGroup, false).length).toBe(subGroupTotal, 'Child direct + child condition count not correct'); + expect(QueryBuilderFunctions.getQueryBuilderTreeChildItems(subGroup, false).length, 'Child direct + child condition count not correct').toBe(subGroupTotal); } } ; diff --git a/projects/igniteui-angular/query-builder/src/query-builder/query-builder.component.spec.ts b/projects/igniteui-angular/query-builder/src/query-builder/query-builder.component.spec.ts index f3182dcf0cc..f04b4291ebb 100644 --- a/projects/igniteui-angular/query-builder/src/query-builder/query-builder.component.spec.ts +++ b/projects/igniteui-angular/query-builder/src/query-builder/query-builder.component.spec.ts @@ -1058,7 +1058,7 @@ describe('IgxQueryBuilder', () => { //Check for the active element const searchValueInput = QueryBuilderFunctions.getQueryBuilderValueInput(fix).querySelector('input'); - expect(document.activeElement).toBe(searchValueInput, 'The input should be the active element.'); + expect(document.activeElement, 'The input should be the active element.').toBe(searchValueInput); })); it('Should display add button when hovering a chip.', fakeAsync(() => { @@ -1066,8 +1066,7 @@ describe('IgxQueryBuilder', () => { fix.detectChanges(); // Verify actions container is not visible. (This container contains the 'add' button.) - expect(QueryBuilderFunctions.getQueryBuilderTreeExpressionActionsContainer(fix, [0])) - .toBeNull('actions container is visible'); + expect(QueryBuilderFunctions.getQueryBuilderTreeExpressionActionsContainer(fix, [0]), 'actions container is visible').toBeNull(); // Hover the first chip and verify actions container is visible. UIInteractions.hoverElement(QueryBuilderFunctions.getQueryBuilderTreeItem(fix, [0]) as HTMLElement); @@ -1080,8 +1079,7 @@ describe('IgxQueryBuilder', () => { UIInteractions.unhoverElement(QueryBuilderFunctions.getQueryBuilderTreeItem(fix, [0]) as HTMLElement); tick(50); fix.detectChanges(); - expect(QueryBuilderFunctions.getQueryBuilderTreeExpressionActionsContainer(fix, [0])) - .toBeNull('actions container is visible'); + expect(QueryBuilderFunctions.getQueryBuilderTreeExpressionActionsContainer(fix, [0]), 'actions container is visible').toBeNull(); })); it('Should have disabled adding buttons when an expression is in edit mode.', fakeAsync(() => { diff --git a/projects/igniteui-angular/simple-combo/src/simple-combo/simple-combo.component.spec.ts b/projects/igniteui-angular/simple-combo/src/simple-combo/simple-combo.component.spec.ts index 088bbb69440..94f04c49557 100644 --- a/projects/igniteui-angular/simple-combo/src/simple-combo/simple-combo.component.spec.ts +++ b/projects/igniteui-angular/simple-combo/src/simple-combo/simple-combo.component.spec.ts @@ -2893,7 +2893,7 @@ describe('IgxSimpleCombo', () => { const targetCell = grid.gridAPI.get_cell_by_index(i, 'Region') as any; comboNativeEl = targetCell.nativeElement.querySelector(SIMPLE_COMBO_ELEMENT); const comboInput = comboNativeEl.querySelector('input'); - expect(comboInput.value).toBe('', `Failed on index: ${i.toString()}`); + expect(comboInput.value, `Failed on index: ${i.toString()}`).toBe(''); } for (let i = virtState.startIndex; i < virtState.startIndex + virtState.chunkSize && i < grid.dataView.length; i++) { diff --git a/projects/igniteui-angular/snackbar/src/snackbar/snackbar.component.spec.ts b/projects/igniteui-angular/snackbar/src/snackbar/snackbar.component.spec.ts index add834a529a..c249559818a 100644 --- a/projects/igniteui-angular/snackbar/src/snackbar/snackbar.component.spec.ts +++ b/projects/igniteui-angular/snackbar/src/snackbar/snackbar.component.spec.ts @@ -213,7 +213,7 @@ describe('IgxSnackbar with custom content', () => { expect(messageEl.nativeElement.innerText).toContain('Item shown'); const customContent = fixture.debugElement.query(By.css('.igx-snackbar__content')); - expect(customContent).toBeTruthy('Custom content is not found'); + expect(customContent, 'Custom content is not found').toBeTruthy(); // Verify the custom button is displayed instead of the snackbar actionText const button = fixture.debugElement.query(By.css('.igx-button')); @@ -223,12 +223,12 @@ describe('IgxSnackbar with custom content', () => { // Verify the message is displayed on the left side of the custom content const messageElRect = messageEl.nativeElement.getBoundingClientRect(); const customContentRect = customContent.nativeElement.getBoundingClientRect(); - expect(messageElRect.left <= customContentRect.left).toBe(true, 'The message is not on the left of the custom content'); + expect(messageElRect.left <= customContentRect.left, 'The message is not on the left of the custom content').toBe(true); // Verify the custom content element is on the left side of the button const buttonRect = button.nativeElement.getBoundingClientRect(); - expect(customContentRect.right <= buttonRect.left).toBe(true, 'The custom element is not on the left of the button'); - expect(messageElRect.right <= buttonRect.left).toBe(true, 'The button is not on the right side of the snackbar content'); + expect(customContentRect.right <= buttonRect.left, 'The custom element is not on the left of the button').toBe(true); + expect(messageElRect.right <= buttonRect.left, 'The button is not on the right side of the snackbar content').toBe(true); snackbar.close(); }); diff --git a/projects/igniteui-angular/test-utils/tree-grid-functions.spec.ts b/projects/igniteui-angular/test-utils/tree-grid-functions.spec.ts index ed9d5d8fcfa..6d98ccd435b 100644 --- a/projects/igniteui-angular/test-utils/tree-grid-functions.spec.ts +++ b/projects/igniteui-angular/test-utils/tree-grid-functions.spec.ts @@ -133,13 +133,13 @@ export class TreeGridFunctions { // Verify each row's cell count const treeCell = TreeGridFunctions.getTreeCell(row); const normalCells = TreeGridFunctions.getNormalCells(row); - expect(1 + normalCells.length).toBe(expectedColumnsCount, 'incorrect cell count for a row'); + expect(1 + normalCells.length, 'incorrect cell count for a row').toBe(expectedColumnsCount); const treeCellRectRight = treeCell.nativeElement.getBoundingClientRect().right; normalCells.forEach((normalCell) => { // Verify that the treeCell is the first cell (on the left of all the other cells) const normalCellRectLeft = normalCell.nativeElement.getBoundingClientRect().left; - expect(treeCellRectRight <= normalCellRectLeft).toBe(true, 'TreeCell is not on the left of a normal cell.'); + expect(treeCellRectRight <= normalCellRectLeft, 'TreeCell is not on the left of a normal cell.').toBe(true); }); }); } @@ -155,10 +155,10 @@ export class TreeGridFunctions { // and thus it has no indentation div. const indentationDiv = treeCell.query(By.css(TREE_CELL_DIV_INDENTATION_CSS_CLASS + expectedIndentationLevel)); if (expectedIndentationLevel === 0) { - expect(divChildren.length).toBe(2, 'root treeCell has incorrect divs count'); + expect(divChildren.length, 'root treeCell has incorrect divs count').toBe(2); expect(indentationDiv).toBeNull(); } else { - expect(divChildren.length).toBe(3, 'child treeCell has incorrect divs count'); + expect(divChildren.length, 'child treeCell has incorrect divs count').toBe(3); expect(indentationDiv).toBeDefined(); expect(indentationDiv).not.toBeNull(); } @@ -197,9 +197,9 @@ export class TreeGridFunctions { const headerCellRect = headerCell.nativeElement.getBoundingClientRect(); treeCells.forEach(treeCell => { const treeCellRect = treeCell.nativeElement.getBoundingClientRect(); - expect(headerCellRect.bottom <= treeCellRect.top).toBe(true, 'headerCell is not on top of a treeCell'); - expect(headerCellRect.left).toBe(treeCellRect.left, 'headerCell and treeCell are not left-aligned'); - expect(headerCellRect.right).toBe(treeCellRect.right, 'headerCell and treeCell are not right-aligned'); + expect(headerCellRect.bottom <= treeCellRect.top, 'headerCell is not on top of a treeCell').toBe(true); + expect(headerCellRect.left, 'headerCell and treeCell are not left-aligned').toBe(treeCellRect.left); + expect(headerCellRect.right, 'headerCell and treeCell are not right-aligned').toBe(treeCellRect.right); }); } @@ -220,9 +220,9 @@ export class TreeGridFunctions { const headerCellRect = headerCell.nativeElement.getBoundingClientRect(); treeCells.forEach(treeCell => { const treeCellRect = treeCell.nativeElement.getBoundingClientRect(); - expect(headerCellRect.bottom <= treeCellRect.top).toBe(true, 'headerCell is not above a treeCell'); - expect(headerCellRect.left).toBe(treeCellRect.left, 'headerCell and treeCell are not left-aligned'); - expect(headerCellRect.right).toBe(treeCellRect.right, 'headerCell and treeCell are not right-aligned'); + expect(headerCellRect.bottom <= treeCellRect.top, 'headerCell is not above a treeCell').toBe(true); + expect(headerCellRect.left, 'headerCell and treeCell are not left-aligned').toBe(treeCellRect.left); + expect(headerCellRect.right, 'headerCell and treeCell are not right-aligned').toBe(treeCellRect.right); }); } @@ -269,8 +269,7 @@ export class TreeGridFunctions { const iconDiv = TreeGridFunctions.getExpansionIndicatorDiv(treeRowDOM); const iconDivRect = iconDiv.nativeElement.getBoundingClientRect(); - expect((iconDivRect.left - (treeCellRect.left + treeCellPaddingLeft + indentation)) < 2) - .toBe(true, 'TreeRow icon has incorrect position'); + expect((iconDivRect.left - (treeCellRect.left + treeCellPaddingLeft + indentation)) < 2, 'TreeRow icon has incorrect position').toBe(true); } /** @@ -294,11 +293,11 @@ export class TreeGridFunctions { // Verfiy selection of checkbox const checkboxDiv = rowDOM.query(By.css(TREE_ROW_DIV_SELECTION_CHECKBOX_CSS_CLASS)); const checkboxComponent = checkboxDiv.query(By.css('igx-checkbox')).componentInstance as IgxCheckboxComponent; - expect(checkboxComponent.checked).toBe(expectedSelection, 'Incorrect checkbox selection state'); - expect(checkboxComponent.nativeInput.nativeElement.checked).toBe(expectedSelection, 'Incorrect native checkbox selection state'); + expect(checkboxComponent.checked, 'Incorrect checkbox selection state').toBe(expectedSelection); + expect(checkboxComponent.nativeInput.nativeElement.checked, 'Incorrect native checkbox selection state').toBe(expectedSelection); // Verify selection of row - expect(rowComponent.selected).toBe(expectedSelection, 'Incorrect row selection state'); + expect(rowComponent.selected, 'Incorrect row selection state').toBe(expectedSelection); expect(rowDOM.nativeElement.classList.contains(TREE_ROW_SELECTION_CSS_CLASS)).toBe(expectedSelection); // Verify selection of row through treeGrid @@ -325,7 +324,7 @@ export class TreeGridFunctions { public static verifyDataRowsSelection(fix, expectedSelectedRowIndices: any[], expectedSelection: boolean) { if (expectedSelection) { const treeGrid = fix.debugElement.query(By.css('igx-tree-grid')).componentInstance as IgxTreeGridComponent; - expect(treeGrid.selectedRows.length).toBe(expectedSelectedRowIndices.length, 'Incorrect number of rows that are selected.'); + expect(treeGrid.selectedRows.length, 'Incorrect number of rows that are selected.').toBe(expectedSelectedRowIndices.length); } expectedSelectedRowIndices.forEach(rowIndex => { @@ -346,22 +345,22 @@ export class TreeGridFunctions { if (expectedCheckboxState === null) { expect(checkboxComponent.indeterminate).toBe(true); - expect(checkboxComponent.checked).toBe(false, 'Incorrect checkbox selection state'); - expect(checkboxComponent.nativeInput.nativeElement.checked).toBe(false, 'Incorrect native checkbox selection state'); + expect(checkboxComponent.checked, 'Incorrect checkbox selection state').toBe(false); + expect(checkboxComponent.nativeInput.nativeElement.checked, 'Incorrect native checkbox selection state').toBe(false); // Verify selection of row - expect(rowComponent.selected).toBe(false, 'Incorrect row selection state'); + expect(rowComponent.selected, 'Incorrect row selection state').toBe(false); expect((rowDOM.nativeElement as HTMLElement).classList.contains(TREE_ROW_SELECTION_CSS_CLASS)).toBe(false); // Verify selection of row through treeGrid const selectedRows = (treeGrid as IgxTreeGridComponent).selectedRows; expect(selectedRows.includes(rowComponent.key)).toBe(false); } else { - expect(checkboxComponent.checked).toBe(expectedCheckboxState, 'Incorrect checkbox selection state'); - expect(checkboxComponent.nativeInput.nativeElement.checked).toBe(expectedCheckboxState, 'Incorrect native checkbox selection state'); + expect(checkboxComponent.checked, 'Incorrect checkbox selection state').toBe(expectedCheckboxState); + expect(checkboxComponent.nativeInput.nativeElement.checked, 'Incorrect native checkbox selection state').toBe(expectedCheckboxState); // Verify selection of row - expect(rowComponent.selected).toBe(expectedSelection, 'Incorrect row selection state'); + expect(rowComponent.selected, 'Incorrect row selection state').toBe(expectedSelection); expect((rowDOM.nativeElement as HTMLElement).classList.contains(TREE_ROW_SELECTION_CSS_CLASS)).toBe(expectedSelection); // Verify selection of row through treeGrid @@ -381,12 +380,12 @@ export class TreeGridFunctions { if (expectedSelection === null) { expect(checkboxComponent.indeterminate).toBe(true); - expect(checkboxComponent.checked).toBe(false, 'Incorrect checkbox selection state'); - expect(checkboxComponent.nativeInput.nativeElement.checked).toBe(false, 'Incorrect native checkbox selection state'); + expect(checkboxComponent.checked, 'Incorrect checkbox selection state').toBe(false); + expect(checkboxComponent.nativeInput.nativeElement.checked, 'Incorrect native checkbox selection state').toBe(false); } else { expect(checkboxComponent.indeterminate).toBe(false); - expect(checkboxComponent.checked).toBe(expectedSelection, 'Incorrect checkbox selection state'); - expect(checkboxComponent.nativeInput.nativeElement.checked).toBe(expectedSelection, 'Incorrect native checkbox selection state'); + expect(checkboxComponent.checked, 'Incorrect checkbox selection state').toBe(expectedSelection); + expect(checkboxComponent.nativeInput.nativeElement.checked, 'Incorrect native checkbox selection state').toBe(expectedSelection); } }