Skip to content

Commit dc2eb7d

Browse files
committed
test(overlay): should use provided in show overlay settings
1 parent 1a19cde commit dc2eb7d

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

projects/igniteui-angular/src/lib/services/overlay/overlay.spec.ts

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1378,6 +1378,37 @@ describe('igxOverlay', () => {
13781378
expect(overlayContent.style.getPropertyValue('--ig-size')).toEqual('1');
13791379
overlayInstance.detach(firstCallId);
13801380
}));
1381+
1382+
fit('#15228 - Should use provided in show overlay settings ', fakeAsync(() => {
1383+
const fixture = TestBed.createComponent(SimpleRefComponent);
1384+
fixture.detectChanges();
1385+
const overlayInstance = fixture.componentInstance.overlay;
1386+
const id = overlayInstance.attach(SimpleDynamicComponent);
1387+
const info = overlayInstance.getOverlayById(id);
1388+
const initialPositionSpy = spyOn(info.settings.positionStrategy, 'position').and.callThrough();
1389+
1390+
overlayInstance.show(id);
1391+
tick();
1392+
1393+
expect(initialPositionSpy).toHaveBeenCalledTimes(1);
1394+
overlayInstance.hide(id);
1395+
tick();
1396+
1397+
const os: OverlaySettings = {
1398+
excludeFromOutsideClick: [],
1399+
positionStrategy: new GlobalPositionStrategy(),
1400+
scrollStrategy: new CloseScrollStrategy(),
1401+
modal: false,
1402+
closeOnOutsideClick: false,
1403+
closeOnEscape: true
1404+
};
1405+
const lastPositionSpy = spyOn(os.positionStrategy, 'position').and.callThrough();
1406+
overlayInstance.show(id, os);
1407+
tick();
1408+
1409+
expect(lastPositionSpy).toHaveBeenCalledTimes(1);
1410+
expect(info.settings).toBe(os);
1411+
}));
13811412
});
13821413

13831414
describe('Unit Tests - Scroll Strategies: ', () => {

0 commit comments

Comments
 (0)