@@ -1901,6 +1901,96 @@ describe('NgSelectComponent', () => {
19011901 const listboxElement = fixture . debugElement . nativeElement . querySelector ( '.ng-dropdown-panel-items[role="listbox"]' ) ;
19021902 expect ( listboxElement . getAttribute ( 'aria-label' ) ) . toBe ( 'Template Aria Label' ) ;
19031903 } ) ) ;
1904+
1905+ describe ( 'Popover' , ( ) => {
1906+ it ( 'should have popover input with default value false' , fakeAsync ( ( ) => {
1907+ const fixture = createTestingModule ( NgSelectTestComponent , `<ng-select [items]="cities" bindLabel="name"></ng-select>` ) ;
1908+
1909+ const select = fixture . componentInstance . select ( ) ;
1910+ expect ( select . popover ( ) ) . toBe ( false ) ;
1911+ } ) ) ;
1912+
1913+ it ( 'should pass popover false to dropdown panel by default' , fakeAsync ( ( ) => {
1914+ const fixture = createTestingModule ( NgSelectTestComponent , `<ng-select [items]="cities" bindLabel="name"></ng-select>` ) ;
1915+
1916+ const select = fixture . componentInstance . select ( ) ;
1917+ select . open ( ) ;
1918+ tickAndDetectChanges ( fixture ) ;
1919+
1920+ const dropdownPanel = select . dropdownPanel ( ) ;
1921+ expect ( dropdownPanel . popover ( ) ) . toBe ( false ) ;
1922+
1923+ const panelElement = fixture . debugElement . nativeElement . querySelector ( '.ng-dropdown-panel' ) ;
1924+ expect ( panelElement ?. matches ( ':popover-open' ) ) . toBe ( false ) ;
1925+ } ) ) ;
1926+
1927+ it ( 'should pass popover true to dropdown panel when set to true' , fakeAsync ( ( ) => {
1928+ const fixture = createTestingModule (
1929+ NgSelectTestComponent ,
1930+ `<ng-select [items]="cities" bindLabel="name" [popover]="true"></ng-select>` ,
1931+ ) ;
1932+
1933+ const select = fixture . componentInstance . select ( ) ;
1934+ expect ( select . popover ( ) ) . toBe ( true ) ;
1935+
1936+ select . open ( ) ;
1937+ tickAndDetectChanges ( fixture ) ;
1938+
1939+ const dropdownPanel = select . dropdownPanel ( ) ;
1940+ expect ( dropdownPanel . popover ( ) ) . toBe ( true ) ;
1941+
1942+ const panelElement = fixture . debugElement . nativeElement . querySelector ( '.ng-dropdown-panel' ) ;
1943+ expect ( panelElement ?. matches ( ':popover-open' ) ) . toBe ( true ) ;
1944+ } ) ) ;
1945+
1946+ it ( 'should pass popover false to dropdown panel when explicitly set to false' , fakeAsync ( ( ) => {
1947+ const fixture = createTestingModule (
1948+ NgSelectTestComponent ,
1949+ `<ng-select [items]="cities" bindLabel="name" [popover]="false"></ng-select>` ,
1950+ ) ;
1951+
1952+ const select = fixture . componentInstance . select ( ) ;
1953+ expect ( select . popover ( ) ) . toBe ( false ) ;
1954+
1955+ select . open ( ) ;
1956+ tickAndDetectChanges ( fixture ) ;
1957+
1958+ const dropdownPanel = select . dropdownPanel ( ) ;
1959+ expect ( dropdownPanel . popover ( ) ) . toBe ( false ) ;
1960+
1961+ const panelElement = fixture . debugElement . nativeElement . querySelector ( '.ng-dropdown-panel' ) ;
1962+ expect ( panelElement ?. matches ( ':popover-open' ) ) . toBe ( false ) ;
1963+ } ) ) ;
1964+
1965+ it ( 'should toggle popover value dynamically' , fakeAsync ( ( ) => {
1966+ const fixture = createTestingModule (
1967+ NgSelectTestComponent ,
1968+ `<ng-select [items]="cities" bindLabel="name" [popover]="popoverEnabled"></ng-select>` ,
1969+ ) ;
1970+
1971+ const component = fixture . componentInstance as any ;
1972+ component . popoverEnabled = false ;
1973+ fixture . detectChanges ( ) ;
1974+
1975+ let select = fixture . componentInstance . select ( ) ;
1976+ expect ( select . popover ( ) ) . toBe ( false ) ;
1977+
1978+ component . popoverEnabled = true ;
1979+ fixture . detectChanges ( ) ;
1980+
1981+ select = fixture . componentInstance . select ( ) ;
1982+ expect ( select . popover ( ) ) . toBe ( true ) ;
1983+
1984+ select . open ( ) ;
1985+ tickAndDetectChanges ( fixture ) ;
1986+
1987+ const dropdownPanel = select . dropdownPanel ( ) ;
1988+ expect ( dropdownPanel . popover ( ) ) . toBe ( true ) ;
1989+
1990+ const panelElement = fixture . debugElement . nativeElement . querySelector ( '.ng-dropdown-panel' ) ;
1991+ expect ( panelElement ?. matches ( ':popover-open' ) ) . toBe ( true ) ;
1992+ } ) ) ;
1993+ } ) ;
19041994 } ) ;
19051995
19061996 describe ( 'Keyboard events' , ( ) => {
@@ -5518,6 +5608,7 @@ class NgSelectTestComponent {
55185608 typeahead = undefined ;
55195609 preventToggleOnRightClick = false ;
55205610 searchWhileComposing = true ;
5611+ popoverEnabled = false ;
55215612
55225613 citiesLoading = false ;
55235614 selectedCityId : number ;
0 commit comments