Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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'))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(() => {
Expand Down Expand Up @@ -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');
}
Expand All @@ -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');
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
Expand All @@ -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');
});
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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!');
});
Expand All @@ -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!');

Expand All @@ -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!');
});
Expand Down Expand Up @@ -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');

Expand All @@ -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', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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!');
});
Expand All @@ -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!');

Expand All @@ -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!');
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
14 changes: 7 additions & 7 deletions projects/igniteui-angular/grids/core/src/state.directive.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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));
});

Expand Down Expand Up @@ -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', () => {
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -826,17 +826,17 @@ 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]));
});
}

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]));
});
Expand Down
Loading