Skip to content

Commit

Permalink
test: fix e2e test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
dmitry-stepanenko committed Apr 18, 2022
1 parent 1d7d623 commit a688532
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export const linkAttr = 'href';
export const secondaryAttr = 'secondary';
export const secondaryTypes = ['positive', 'negative', 'neutral', 'informative', 'critical'];
export const secondaryTypes = ['positive', 'negative', 'no status', 'informative', 'critical'];
export const toolbarTextValue = [
'1 : Items selected',
'2 : Items selected',
Expand Down
24 changes: 17 additions & 7 deletions libs/platform/src/lib/form/multi-input/base-multi-input.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,13 @@ import {
EventEmitter,
Host,
Input,
OnChanges,
OnDestroy,
Optional,
Output,
QueryList,
Self,
SimpleChanges,
SkipSelf,
TemplateRef,
ViewChild
Expand All @@ -29,8 +31,8 @@ import {
UP_ARROW
} from '@angular/cdk/keycodes';

import { fromEvent, isObservable, Observable, Subject, Subscription } from 'rxjs';
import { takeUntil } from 'rxjs/operators';
import { combineLatest, fromEvent, isObservable, Observable, Subject, Subscription } from 'rxjs';
import { takeUntil, startWith } from 'rxjs/operators';

import { DialogConfig } from '@fundamental-ngx/core/dialog';
import { ContentDensity, FocusEscapeDirection, KeyUtil, TemplateDirective } from '@fundamental-ngx/core/utils';
Expand Down Expand Up @@ -66,7 +68,7 @@ export class MultiInputSelectionChangeEvent {
}

@Directive()
export abstract class BaseMultiInput extends CollectionBaseInput implements AfterViewInit, OnDestroy {
export abstract class BaseMultiInput extends CollectionBaseInput implements AfterViewInit, OnChanges, OnDestroy {
/** Provides maximum height for the optionPanel */
@Input()
maxHeight = '250px';
Expand Down Expand Up @@ -243,6 +245,9 @@ export abstract class BaseMultiInput extends CollectionBaseInput implements Afte
*/
openChange = new Subject<boolean>();

/** @hidden emits whenever there're changes to the inputs, that affect the data creation from data source */
private readonly _updateDataSourceValues$ = new Subject<void>();

protected _dataSource: FdpMultiInputDataSource<any>;

/** @hidden */
Expand Down Expand Up @@ -300,6 +305,13 @@ export abstract class BaseMultiInput extends CollectionBaseInput implements Afte
super.ngAfterViewInit();
}

/** @hidden */
ngOnChanges(changes: SimpleChanges): void {
if ('group' in changes || 'groupKey' in changes) {
this._updateDataSourceValues$.next();
}
}

/** @hidden */
ngOnDestroy(): void {
super.ngOnDestroy();
Expand Down Expand Up @@ -493,12 +505,10 @@ export abstract class BaseMultiInput extends CollectionBaseInput implements Afte
* its here.
*/
this._dsSubscription = new Subscription();
const dsSub = initDataSource
.open()
const dsSub = combineLatest([initDataSource.open(), this._updateDataSourceValues$.pipe(startWith(null))])
.pipe(takeUntil(this._destroyed))
.subscribe((data) => {
.subscribe(([data]) => {
this._suggestions = this._convertToOptionItems(data);

this.stateChanges.next('initDataSource.open().');

this.cd.markForCheck();
Expand Down

0 comments on commit a688532

Please sign in to comment.