Skip to content

Commit 5e89306

Browse files
committed
chore(dropdown): Addressing comments and removing unnecessary code and imports
1 parent 56d5179 commit 5e89306

File tree

2 files changed

+15
-27
lines changed

2 files changed

+15
-27
lines changed

projects/igniteui-angular/src/lib/drop-down/drop-down.component.spec.ts

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -34,18 +34,6 @@ const CSS_CLASS_TABS = '.igx-tabs__header-item';
3434
describe('IgxDropDown ', () => {
3535
let fixture;
3636
let dropdown: IgxDropDownComponent;
37-
38-
const defaultOverlaySettings: OverlaySettings = {
39-
closeOnOutsideClick: true,
40-
modal: false,
41-
positionStrategy: new ConnectedPositioningStrategy({
42-
horizontalStartPoint: HorizontalAlignment.Left,
43-
verticalStartPoint: VerticalAlignment.Bottom,
44-
horizontalDirection: HorizontalAlignment.Right,
45-
verticalDirection: VerticalAlignment.Bottom
46-
})
47-
};
48-
4937
describe('Unit tests', () => {
5038
const data = [
5139
{ value: 'Item0', index: 0 } as IgxDropDownItemComponent,
@@ -258,8 +246,8 @@ describe('IgxDropDown ', () => {
258246
expect(toggle.open).toHaveBeenCalledTimes(1);
259247

260248
const appliedSettings = (toggle.open as jasmine.Spy).calls.mostRecent().args[0];
261-
expect(appliedSettings.closeOnOutsideClick).toBe(defaultOverlaySettings.closeOnOutsideClick);
262-
expect(appliedSettings.modal).toBe(defaultOverlaySettings.modal);
249+
expect(appliedSettings.closeOnOutsideClick).toBe(true);
250+
expect(appliedSettings.modal).toBe(false);
263251
expect(appliedSettings.positionStrategy instanceof ConnectedPositioningStrategy).toBe(true);
264252

265253
const positionStrategy = appliedSettings.positionStrategy as ConnectedPositioningStrategy;

projects/igniteui-angular/src/lib/drop-down/drop-down.component.ts

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ import { Subject } from 'rxjs';
2929
import { IgxDropDownItemBaseDirective } from './drop-down-item.base';
3030
import { IgxForOfToken } from '../directives/for-of/for_of.directive';
3131
import { take } from 'rxjs/operators';
32-
import { HorizontalAlignment, OverlaySettings, VerticalAlignment } from '../services/overlay/utilities';
32+
import { OverlaySettings } from '../services/overlay/utilities';
3333
import { DOCUMENT, NgIf } from '@angular/common';
3434
import { ConnectedPositioningStrategy } from '../services/overlay/position';
3535

@@ -50,17 +50,6 @@ import { ConnectedPositioningStrategy } from '../services/overlay/position';
5050
* ```
5151
*/
5252

53-
const defaultOverlaySettings: OverlaySettings = {
54-
closeOnOutsideClick: true,
55-
modal: false,
56-
positionStrategy: new ConnectedPositioningStrategy({
57-
horizontalStartPoint: HorizontalAlignment.Left,
58-
verticalStartPoint: VerticalAlignment.Bottom,
59-
horizontalDirection: HorizontalAlignment.Right,
60-
verticalDirection: VerticalAlignment.Bottom
61-
})
62-
};
63-
6453
@Component({
6554
selector: 'igx-drop-down',
6655
templateUrl: './drop-down.component.html',
@@ -255,11 +244,22 @@ export class IgxDropDownComponent extends IgxDropDownBaseDirective implements ID
255244
* ```
256245
*/
257246
public open(overlaySettings?: OverlaySettings) {
258-
const settings = overlaySettings || { ...defaultOverlaySettings };
247+
const settings = overlaySettings || this.getDefaultOverlaySettings();
259248
this.toggleDirective.open(settings);
260249
this.updateScrollPosition();
261250
}
262251

252+
/**
253+
* @hidden @internal
254+
*/
255+
public getDefaultOverlaySettings(): OverlaySettings {
256+
return {
257+
closeOnOutsideClick: true,
258+
modal: false,
259+
positionStrategy: new ConnectedPositioningStrategy()
260+
};
261+
}
262+
263263
/**
264264
* Closes the dropdown
265265
*

0 commit comments

Comments
 (0)