Skip to content

Commit 8580ae3

Browse files
committed
chore(*): add new test data
1 parent 40bfe97 commit 8580ae3

File tree

3 files changed

+82
-33
lines changed

3 files changed

+82
-33
lines changed

projects/igniteui-angular/src/lib/grids/grid/grid-filtering-ui.spec.ts

Lines changed: 31 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -119,12 +119,12 @@ describe('IgxGrid - Filtering Row UI actions #grid', () => {
119119
// iterate over unary conditions
120120
GridFunctions.openFilterDDAndSelectCondition(fix, 6);
121121

122-
expect(grid.rowList.length).toEqual(6);
122+
expect(grid.rowList.length).toEqual(4);
123123
verifyFilterRowUI(input, close, reset, false);
124124

125125
GridFunctions.openFilterDDAndSelectCondition(fix, 0);
126126

127-
expect(grid.rowList.length).toEqual(6);
127+
expect(grid.rowList.length).toEqual(4);
128128
verifyFilterRowUI(input, close, reset, false);
129129
}));
130130

@@ -163,7 +163,7 @@ describe('IgxGrid - Filtering Row UI actions #grid', () => {
163163
GridFunctions.typeValueInFilterRowInput('script', fix, input);
164164

165165
verifyFilterRowUI(input, close, reset, false);
166-
expect(grid.rowList.length).toEqual(8);
166+
expect(grid.rowList.length).toEqual(6);
167167
}));
168168

169169
// UI tests number column
@@ -200,15 +200,15 @@ describe('IgxGrid - Filtering Row UI actions #grid', () => {
200200
// not empty
201201
GridFunctions.openFilterDDAndSelectCondition(fix, 7);
202202

203-
expect(grid.rowList.length).toEqual(8);
203+
expect(grid.rowList.length).toEqual(7);
204204
verifyFilterRowUI(input, close, reset, false);
205205

206206
// changing from unary to not unary condition when input is empty - filtering should keep its state
207207
// open dropdown
208208
GridFunctions.openFilterDDAndSelectCondition(fix, 0);
209209

210210
input = filterUIRow.query(By.directive(IgxInputDirective));
211-
expect(grid.rowList.length).toEqual(8);
211+
expect(grid.rowList.length).toEqual(7);
212212
verifyFilterRowUI(input, close, reset, false);
213213
}));
214214

@@ -225,7 +225,7 @@ describe('IgxGrid - Filtering Row UI actions #grid', () => {
225225
GridFunctions.openFilterDDAndSelectCondition(fix, 1);
226226
GridFunctions.typeValueInFilterRowInput(100, fix, input);
227227

228-
expect(grid.rowList.length).toEqual(8);
228+
expect(grid.rowList.length).toEqual(7);
229229
verifyFilterRowUI(input, close, reset, false);
230230

231231
// less than
@@ -237,7 +237,7 @@ describe('IgxGrid - Filtering Row UI actions #grid', () => {
237237
GridFunctions.openFilterDDAndSelectCondition(fix, 4);
238238
GridFunctions.typeValueInFilterRowInput(254, fix, input);
239239

240-
expect(grid.rowList.length).toEqual(5);
240+
expect(grid.rowList.length).toEqual(3);
241241
verifyFilterRowUI(input, close, reset, false);
242242
}));
243243

@@ -276,7 +276,7 @@ describe('IgxGrid - Filtering Row UI actions #grid', () => {
276276
// not null condition
277277
GridFunctions.openFilterDDAndSelectCondition(fix, 6);
278278

279-
expect(grid.rowList.length).toEqual(8);
279+
expect(grid.rowList.length).toEqual(6);
280280
verifyFilterRowUI(input, close, reset, false);
281281
}));
282282

@@ -326,11 +326,11 @@ describe('IgxGrid - Filtering Row UI actions #grid', () => {
326326
// Today condition
327327
GridFunctions.openFilterDDAndSelectCondition(fix, 4);
328328

329-
expect(grid.rowList.length).toEqual(3);
329+
expect(grid.rowList.length).toEqual(1);
330330
verifyFilterRowUI(input, close, reset, false);
331331
verifyFilterUIPosition(filterUIRow, grid);
332332

333-
expect(grid.rowList.length).toEqual(3);
333+
expect(grid.rowList.length).toEqual(1);
334334

335335
// This Month condition
336336
GridFunctions.openFilterDDAndSelectCondition(fix, 6);
@@ -1400,15 +1400,15 @@ describe('IgxGrid - Filtering Row UI actions #grid', () => {
14001400
let filterChip = filterUIRow.query(By.directive(IgxChipComponent));
14011401
expect(filterChip).toBeTruthy();
14021402
expect(filterChip.componentInstance.selected).toBeTruthy();
1403-
expect(grid.rowList.length).toEqual(6);
1403+
expect(grid.rowList.length).toEqual(4);
14041404
verifyFilterRowUI(input, close, reset, false);
14051405

14061406
// select not unary conditions
14071407
GridFunctions.openFilterDDAndSelectCondition(fix, 1);
14081408

14091409
expect(filterChip).toBeTruthy();
14101410
expect(filterChip.componentInstance.selected).toBeTruthy();
1411-
expect(grid.rowList.length).toEqual(6);
1411+
expect(grid.rowList.length).toEqual(4);
14121412
verifyFilterRowUI(input, close, reset, false);
14131413

14141414
// submit the input with empty value
@@ -2228,7 +2228,7 @@ describe('IgxGrid - Filtering Row UI actions #grid', () => {
22282228
fix.detectChanges();
22292229

22302230
expect(grid.filteringRow.expression.condition.name).toEqual('equals');
2231-
expect(grid.rowList.length).toEqual(3);
2231+
expect(grid.rowList.length).toEqual(1);
22322232

22332233
// This Month condition
22342234
const expectedResults = GridFunctions.createDateFilterConditions(grid, today);
@@ -2268,7 +2268,7 @@ describe('IgxGrid - Filtering Row UI actions #grid', () => {
22682268

22692269
// const cells = GridFunctions.getColumnCells(fix, 'Downloads');
22702270
const rows = GridFunctions.getRows(fix);
2271-
expect(rows.length).toEqual(4);
2271+
expect(rows.length).toEqual(2);
22722272
}));
22732273

22742274
it('Should filter by cells formatted data when using FormattedValuesFilteringStrategy with rowData', fakeAsync(() => {
@@ -2909,11 +2909,11 @@ describe('IgxGrid - Filtering Row UI actions #grid', () => {
29092909
// Today condition
29102910
GridFunctions.openFilterDDAndSelectCondition(fix, 4);
29112911

2912-
expect(grid.rowList.length).toEqual(3);
2912+
expect(grid.rowList.length).toEqual(1);
29132913
verifyFilterRowUI(input, close, reset, false);
29142914
verifyFilterUIPosition(filterUIRow, grid);
29152915

2916-
expect(grid.rowList.length).toEqual(3);
2916+
expect(grid.rowList.length).toEqual(1);
29172917

29182918
// This Month condition
29192919
GridFunctions.openFilterDDAndSelectCondition(fix, 6);
@@ -2957,7 +2957,7 @@ describe('IgxGrid - Filtering Row UI actions #grid', () => {
29572957
tick();
29582958
fix.detectChanges();
29592959

2960-
expect(grid.rowList.length).toEqual(3);
2960+
expect(grid.rowList.length).toEqual(1);
29612961
}));
29622962

29632963
});
@@ -3640,7 +3640,7 @@ describe('IgxGrid - Filtering actions - Excel style filtering #grid', () => {
36403640

36413641
GridFunctions.clickApplyExcelStyleCustomFiltering(fix);
36423642

3643-
expect(grid.filteredData.length).toEqual(7);
3643+
expect(grid.filteredData.length).toEqual(5);
36443644
}));
36453645

36463646
it('Should not be able to exit custom dialog when press tab on apply button', fakeAsync(() => {
@@ -4592,7 +4592,7 @@ describe('IgxGrid - Filtering actions - Excel style filtering #grid', () => {
45924592
tick();
45934593
fix.detectChanges();
45944594

4595-
expect(grid.rowList.length).toBe(8);
4595+
expect(grid.rowList.length).toBe(6);
45964596
const operands =
45974597
(grid.filteringExpressionsTree.filteringOperands[0] as IFilteringExpressionsTree)
45984598
.filteringOperands as IFilteringExpression[];
@@ -4669,7 +4669,7 @@ describe('IgxGrid - Filtering actions - Excel style filtering #grid', () => {
46694669

46704670
toggleExcelStyleFilteringItems(fix, true, 3);
46714671

4672-
expect(grid.rowList.length).toBe(7);
4672+
expect(grid.rowList.length).toBe(5);
46734673

46744674
GridFunctions.clickExcelFilterIcon(fix, 'Released');
46754675
tick(100);
@@ -5052,7 +5052,7 @@ describe('IgxGrid - Filtering actions - Excel style filtering #grid', () => {
50525052
const cellText = pipe.transform(filteredDate, column.pipeArgs.format, column.pipeArgs.timezone);
50535053
const cell = GridFunctions.getColumnCells(fix, 'ReleaseDate')[0].nativeElement;
50545054
expect(cell.innerText).toMatch(cellText);
5055-
expect(grid.filteredData.length).toEqual(3);
5055+
expect(grid.filteredData.length).toEqual(1);
50565056
}));
50575057

50585058
it('Should take pipeArgs weekStart property as calendar\'s default.', fakeAsync(() => {
@@ -5134,7 +5134,7 @@ describe('IgxGrid - Filtering actions - Excel style filtering #grid', () => {
51345134
const cellText = pipe.transform(filteredDate, column.pipeArgs.format, column.pipeArgs.timezone);
51355135
const cell = GridFunctions.getColumnCells(fix, 'ReleaseDate')[0].nativeElement;
51365136
expect(cell.innerText).toMatch(cellText);
5137-
expect(grid.filteredData.length).toEqual(3);
5137+
expect(grid.filteredData.length).toEqual(1);
51385138
}));
51395139

51405140
it('Should filter grid with miliseconds dates through custom date filter dialog', fakeAsync(() => {
@@ -5181,7 +5181,7 @@ describe('IgxGrid - Filtering actions - Excel style filtering #grid', () => {
51815181
const cellText = pipe.transform(filteredDate, column.pipeArgs.format, column.pipeArgs.timezone);
51825182
const cell = GridFunctions.getColumnCells(fix, 'ReleaseDate')[0].nativeElement;
51835183
expect(cell.innerText).toMatch(cellText);
5184-
expect(grid.filteredData.length).toEqual(3);
5184+
expect(grid.filteredData.length).toEqual(1);
51855185
}));
51865186

51875187
it('DateTime: Should use editorOptions.dateTimeFormat as inputFormat to the filter editor in the custom filtering dialog', fakeAsync(() => {
@@ -5348,7 +5348,7 @@ describe('IgxGrid - Filtering actions - Excel style filtering #grid', () => {
53485348
const cellText = pipe.transform(filteredDate, column.pipeArgs.format, column.pipeArgs.timezone);
53495349
const cell = GridFunctions.getColumnCells(fix, 'ReleaseDate')[0].nativeElement;
53505350
expect(cell.innerText).toMatch(cellText);
5351-
expect(grid.filteredData.length).toEqual(3);
5351+
expect(grid.filteredData.length).toEqual(1);
53525352
}));
53535353

53545354
it('Should filter grid through custom date filter dialog when using pipeArgs and formatter for the column', fakeAsync(() => {
@@ -5399,7 +5399,7 @@ describe('IgxGrid - Filtering actions - Excel style filtering #grid', () => {
53995399
const cellText = column.formatter(filteredDate, null);
54005400
const cell = GridFunctions.getColumnCells(fix, 'ReleaseDate')[0].nativeElement;
54015401
expect(cell.innerText).toMatch(cellText);
5402-
expect(grid.filteredData.length).toEqual(3);
5402+
expect(grid.filteredData.length).toEqual(1);
54035403
}));
54045404

54055405
it('Should correctly update \'SelectAll\' based on checkboxes.', fakeAsync(() => {
@@ -5604,7 +5604,7 @@ describe('IgxGrid - Filtering actions - Excel style filtering #grid', () => {
56045604
const cell1 = GridFunctions.getRowCells(fix, 0)[4].nativeElement;
56055605
const cell2 = GridFunctions.getRowCells(fix, 3)[4].nativeElement;
56065606
expect(cell1.textContent.toString()).toEqual(cell2.textContent.toString());
5607-
expect(rows.length).toBe(8, 'incorrect number of rows');
5607+
expect(rows.length).toBe(6, 'incorrect number of rows');
56085608

56095609
//Check if checkboxes have correct state on ESF menu reopening
56105610
GridFunctions.clickExcelFilterIcon(fix, 'ReleaseDate');
@@ -5736,7 +5736,7 @@ describe('IgxGrid - Filtering actions - Excel style filtering #grid', () => {
57365736
fix.detectChanges();
57375737

57385738
verifyExcelStyleFilterAvailableOptions(fix,
5739-
['Select All', 'a', 'Custom', 'custom_1', 'custom_A'],
5739+
['Select All', 'a', 'Custom'],
57405740
[true, true, true]);
57415741
}));
57425742

@@ -5750,7 +5750,7 @@ describe('IgxGrid - Filtering actions - Excel style filtering #grid', () => {
57505750
fix.detectChanges();
57515751

57525752
verifyExcelStyleFilterAvailableOptions(fix,
5753-
['Select All', 'a', 'Custom', 'custoM', 'custom', 'custom_1', 'custom_A'],
5753+
['Select All', 'a', 'Custom', 'custoM', 'custom'],
57545754
[true, true, true, true, true]);
57555755
}));
57565756

@@ -5829,6 +5829,8 @@ describe('IgxGrid - Filtering actions - Excel style filtering #grid', () => {
58295829
}));
58305830

58315831
it('Should filter grid correctly with case insensitive duplicates', fakeAsync(() => {
5832+
grid.data = SampleTestData.excelFilteringDataDuplicateValues();
5833+
fix.detectChanges();
58325834
// Open excel style custom filtering dialog.
58335835
GridFunctions.clickExcelFilterIconFromCode(fix, grid, 'AnotherField');
58345836

@@ -6191,7 +6193,7 @@ describe('IgxGrid - Filtering actions - Excel style filtering #grid', () => {
61916193
fix.detectChanges();
61926194
await wait(100);
61936195

6194-
expect(grid.filteredData.length).toEqual(7);
6196+
expect(grid.filteredData.length).toEqual(5);
61956197
});
61966198

61976199
it('Should display the custom resource strings when specified in the search list for boolean column.', async () => {

projects/igniteui-angular/src/lib/test-utils/grid-functions.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -347,10 +347,10 @@ export class GridFunctions {
347347
const dateItem6 = GridFunctions.generateICalendarDate(grid.data[6].ReleaseDate,
348348
today.getFullYear(), today.getMonth());
349349

350-
let thisMonthCountItems = 3;
350+
let thisMonthCountItems = 1;
351351
let nextMonthCountItems = 1;
352352
let lastMonthCountItems = 1;
353-
let thisYearCountItems = 8;
353+
let thisYearCountItems = 6;
354354
let nextYearCountItems = 0;
355355
let lastYearCountItems = 0;
356356

projects/igniteui-angular/src/lib/test-utils/sample-test-data.spec.ts

Lines changed: 49 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1985,10 +1985,57 @@ export class SampleTestData {
19851985
Released: undefined,
19861986
AnotherField: 'custom',
19871987
Revenue: 50000
1988+
}
1989+
]);
1990+
1991+
public static excelFilteringDataDuplicateValues = () => ([
1992+
{
1993+
Downloads: 254,
1994+
ID: 1,
1995+
ProductName: 'Ignite UI for JavaScript',
1996+
ReleaseDate: SampleTestData.timeGenerator.timedelta(SampleTestData.today, 'day', 1),
1997+
ReleaseDateTime: SampleTestData.timeGenerator.timedelta(SampleTestData.todayFullDate, 'hour', 1),
1998+
ReleaseTime: SampleTestData.timeGenerator.timedelta(SampleTestData.todayFullDate, 'hour', 1),
1999+
Released: false,
2000+
AnotherField: 'a',
2001+
Revenue: 100000
2002+
},
2003+
{
2004+
Downloads: 702,
2005+
ID: 2,
2006+
ProductName: 'Some other item with Script',
2007+
ReleaseDate: SampleTestData.timeGenerator.timedelta(SampleTestData.today, 'day', 1),
2008+
ReleaseDateTime: SampleTestData.timeGenerator.timedelta(SampleTestData.todayFullDate, 'second', 20),
2009+
ReleaseTime: SampleTestData.timeGenerator.timedelta(SampleTestData.todayFullDate, 'second', 20),
2010+
Released: null,
2011+
AnotherField: 'Custom',
2012+
Revenue: 60000
2013+
},
2014+
{
2015+
Downloads: 0,
2016+
ID: 3,
2017+
ProductName: null,
2018+
ReleaseDate: SampleTestData.timeGenerator.timedelta(SampleTestData.today, 'month', 1),
2019+
ReleaseDateTime: SampleTestData.timeGenerator.timedelta(SampleTestData.todayFullDate, 'minute', +10),
2020+
ReleaseTime: SampleTestData.timeGenerator.timedelta(SampleTestData.todayFullDate, 'minute', +10),
2021+
Released: true,
2022+
AnotherField: 'custoM',
2023+
Revenue: 10000
19882024
},
19892025
{
19902026
Downloads: 1000,
1991-
ID: 9,
2027+
ID: 4,
2028+
ProductName: null,
2029+
ReleaseDate: SampleTestData.today,
2030+
ReleaseDateTime: SampleTestData.todayFullDate,
2031+
ReleaseTime: SampleTestData.todayFullDate,
2032+
Released: undefined,
2033+
AnotherField: 'custom',
2034+
Revenue: 50000
2035+
},
2036+
{
2037+
Downloads: 1000,
2038+
ID: 5,
19922039
ProductName: null,
19932040
ReleaseDate: SampleTestData.today,
19942041
ReleaseDateTime: SampleTestData.todayFullDate,
@@ -1999,7 +2046,7 @@ export class SampleTestData {
19992046
},
20002047
{
20012048
Downloads: 1000,
2002-
ID: 10,
2049+
ID: 6,
20032050
ProductName: null,
20042051
ReleaseDate: SampleTestData.today,
20052052
ReleaseDateTime: SampleTestData.todayFullDate,

0 commit comments

Comments
 (0)