Skip to content

Commit 438986f

Browse files
MKirovaMKirova
authored andcommitted
chore(*): Split test in 3.
1 parent f361b41 commit 438986f

File tree

1 file changed

+24
-26
lines changed

1 file changed

+24
-26
lines changed

projects/igniteui-angular/src/lib/grids/grid/row-pinning.spec.ts

Lines changed: 24 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import { IPinningConfig } from '../common/grid.interface';
1010
import { SampleTestData } from '../../test-utils/sample-test-data.spec';
1111
import { IgxGridTransaction } from '../tree-grid';
1212
import { IgxTransactionService } from '../../services';
13-
import { wait } from '../../test-utils/ui-interactions.spec';
1413

1514
describe('Row Pinning #grid', () => {
1615
const FIXED_ROW_CONTAINER = '.igx-grid__tr--pinned ';
@@ -223,7 +222,7 @@ describe('Row Pinning #grid', () => {
223222
});
224223
});
225224

226-
describe(' Editing ', () => {
225+
fdescribe(' Editing ', () => {
227226
beforeEach(fakeAsync(() => {
228227
fix = TestBed.createComponent(GridRowPinningWithTransactionsComponent);
229228
fix.detectChanges();
@@ -232,46 +231,45 @@ describe('Row Pinning #grid', () => {
232231
fix.detectChanges();
233232
}));
234233

235-
it('should allow pinning edited/deleted/added row.', async() => {
236-
// test with added row
237-
grid.addRow({ 'ID': 'Test', 'CompanyName': 'Test'});
234+
it('should allow pinning edited row.', () => {
235+
grid.updateCell('New value', 'ANTON', 'CompanyName');
238236
fix.detectChanges();
239-
240-
grid.pinRow('Test');
237+
grid.pinRow('ANTON');
241238
fix.detectChanges();
239+
242240
expect(grid.pinnedRows.length).toBe(1);
243-
let pinRowContainer = fix.debugElement.queryAll(By.css(FIXED_ROW_CONTAINER));
241+
const pinRowContainer = fix.debugElement.queryAll(By.css(FIXED_ROW_CONTAINER));
244242
expect(pinRowContainer.length).toBe(1);
245243
expect(pinRowContainer[0].children.length).toBe(1);
246-
expect(pinRowContainer[0].children[0].context.rowID).toBe('Test');
244+
expect(pinRowContainer[0].children[0].context.rowID).toBe('ANTON');
245+
expect(pinRowContainer[0].children[0].context.rowData.CompanyName).toBe('New value');
246+
});
247247

248-
// test with deleted row
248+
it('should allow pinning deleted row.', () => {
249249
grid.deleteRow('ALFKI');
250250
fix.detectChanges();
251251
grid.pinRow('ALFKI');
252252
fix.detectChanges();
253253

254-
expect(grid.pinnedRows.length).toBe(2);
255-
pinRowContainer = fix.debugElement.queryAll(By.css(FIXED_ROW_CONTAINER));
254+
expect(grid.pinnedRows.length).toBe(1);
255+
const pinRowContainer = fix.debugElement.queryAll(By.css(FIXED_ROW_CONTAINER));
256256
expect(pinRowContainer.length).toBe(1);
257-
expect(pinRowContainer[0].children.length).toBe(2);
258-
expect(pinRowContainer[0].children[0].context.rowID).toBe('Test');
259-
expect(pinRowContainer[0].children[1].context.rowID).toBe('ALFKI');
257+
expect(pinRowContainer[0].children.length).toBe(1);
258+
expect(pinRowContainer[0].children[0].context.rowID).toBe('ALFKI');
259+
});
260260

261-
// test with edited
262-
grid.updateCell('New value', 'ANTON', 'CompanyName');
263-
fix.detectChanges();
264-
grid.pinRow('ANTON');
265-
fix.detectChanges();
266-
await wait(100);
261+
it('should allow pinning added row.', () => {
262+
263+
grid.addRow({ 'ID': 'Test', 'CompanyName': 'Test'});
267264
fix.detectChanges();
268265

269-
expect(grid.pinnedRows.length).toBe(3);
270-
pinRowContainer = fix.debugElement.queryAll(By.css(FIXED_ROW_CONTAINER));
266+
grid.pinRow('Test');
267+
fix.detectChanges();
268+
expect(grid.pinnedRows.length).toBe(1);
269+
const pinRowContainer = fix.debugElement.queryAll(By.css(FIXED_ROW_CONTAINER));
271270
expect(pinRowContainer.length).toBe(1);
272-
expect(pinRowContainer[0].children.length).toBe(3);
273-
expect(pinRowContainer[0].children[2].context.rowID).toBe('ANTON');
274-
expect(pinRowContainer[0].children[2].context.rowData.CompanyName).toBe('New value');
271+
expect(pinRowContainer[0].children.length).toBe(1);
272+
expect(pinRowContainer[0].children[0].context.rowID).toBe('Test');
275273
});
276274

277275
it('should stop editing when edited row is pinned/unpinned.', () => {

0 commit comments

Comments
 (0)