@theseam/ui-common 1.0.2-beta.17 → 1.0.2-beta.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"file":"theseam-ui-common-story-helpers.mjs","sources":["../../../projects/ui-common/story-helpers/arg-type-helpers.ts","../../../projects/ui-common/story-helpers/args-to-tpl.ts","../../../projects/ui-common/story-helpers/story-empty.component.ts","../../../projects/ui-common/story-helpers/initial-route-factory.ts","../../../projects/ui-common/story-helpers/initial-route.service.ts","../../../projects/ui-common/story-helpers/story-initial-route.ts","../../../projects/ui-common/story-helpers/route-button.ts","../../../projects/ui-common/story-helpers/routes-arg-type.ts","../../../projects/ui-common/story-helpers/story-empty-with-route.component.ts","../../../projects/ui-common/story-helpers/story-modal-container.component.ts","../../../projects/ui-common/story-helpers/story-helper-components.module.ts","../../../projects/ui-common/story-helpers/story-toastr.service.ts","../../../projects/ui-common/story-helpers/on-story-bootstrapped-exec.ts","../../../projects/ui-common/story-helpers/on-story-bootstrapped-trigger.ts","../../../projects/ui-common/story-helpers/story-preferences-accessor.service.ts","../../../projects/ui-common/story-helpers/add-injector-to-args.ts","../../../projects/ui-common/story-helpers/theseam-ui-common-story-helpers.ts"],"sourcesContent":["// import { ArgType } from '@storybook/addons'\n\nimport { OutlineThemeNames, ThemeNames } from '@theseam/ui-common/models'\n\ndeclare type ArgType = any\n\nexport const themeArgType: ArgType = {\n options: ThemeNames,\n control: {\n type: 'select',\n },\n description: `Theme style.`,\n}\n\nexport const themeWithOutlineArgType: ArgType = {\n options: [...ThemeNames, ...OutlineThemeNames],\n control: {\n type: 'select',\n },\n description: `Theme style.`,\n}\n\nexport const sizeArgType: ArgType = {\n options: [undefined, 'sm', 'lg'],\n control: {\n type: 'select',\n },\n description: `Size.`,\n}\n\nexport const buttonTypeArgType: ArgType = {\n options: ['button', 'submit'],\n control: {\n type: 'select',\n },\n description: `Button type.`,\n}\n","/* eslint-disable no-prototype-builtins */\nimport { action, HandlerFunction } from 'storybook/actions'\nimport { AngularRenderer, ArgTypes } from '@storybook/angular'\nimport { useStoryContext } from 'storybook/preview-api'\n\nexport interface ArgsTplParts {\n actions: { [prop: string]: HandlerFunction }\n tplfragment: string\n}\n\n/**\n * This is an attempt at simplifying the use of auto-generated args in stories\n * defined with `template`, since Angular doesn't have a way to simply use a\n * spread operator syntax.\n *\n * @experimental\n */\n// export function argsToTplParts(args: any, argTypes: ArgTypes): ArgsTplParts {\n// // console.log({ args, argTypes })\n// const parts: ArgsTplParts = {\n// actions: {},\n// tplfragment: ''\n// }\n\n// Object.keys(argTypes).forEach(k => {\n// // Inputs\n// if (\n// // Is in the inputs category\n// argTypes[k].table.category === 'inputs' &&\n// // Needs a control to be able to change from auto-generated args.\n// argTypes[k]?.hasOwnProperty('control') &&\n// // Assuming the arg might not be in props if there isn't an arg value.\n// args.hasOwnProperty(k)\n// ) {\n// parts.tplfragment += `[${k}]=\"${k}\" `\n// }\n\n// // Outputs\n// if (\n// // Is in the outputs category\n// argTypes[k]?.table?.category === 'outputs'\n// ) {\n// // Without access to props, I don't know if I can get an action into the\n// // template context like this.\n// parts.tplfragment += `(${k})=\"${k}($event)\" `\n// parts.actions[k] = action(k)\n// }\n// })\n\n// return parts\n// }\n\nfunction removeDuplicates(arr: string[]) {\n const seen: { [k: string]: boolean } = {}\n return arr.filter((item) => {\n if (!seen[item]) {\n seen[item] = true\n return true\n }\n return false\n })\n}\n\nexport interface ArgsTplOptions {\n /**\n * Properties to always bind to the template.\n */\n alwaysBind?: string[]\n /**\n * Properties to exclude from bidning to the template.\n */\n exclude?: string[]\n}\n\n/**\n * This is an attempt at simplifying the use of auto-generated args in stories\n * defined with `template`, since Angular doesn't have a way to simply use a\n * spread operator syntax.\n *\n * @experimental\n */\nexport function argsToTpl(options?: ArgsTplOptions) {\n const context = useStoryContext<AngularRenderer>()\n\n const exclude = [\n ...(context?.parameters?.argsToTplOptions?.exclude || []),\n ...(options?.exclude || []),\n ]\n\n const alwaysBind = context?.parameters?.argsToTplOptions?.alwaysBind || []\n\n const props = removeDuplicates([...alwaysBind, ...Object.keys(context.args)])\n\n const parts = props\n .filter((k) => exclude.indexOf(k) === -1)\n .map((k) => {\n // Outputs\n if (\n context.argTypes[k]?.hasOwnProperty('action') &&\n (context.args.hasOwnProperty(k) || alwaysBind.indexOf(k) !== -1)\n ) {\n return `(${k})=\"${k}($event)\"`\n }\n\n // Inputs\n if (context.args.hasOwnProperty(k) || alwaysBind.indexOf(k) !== -1) {\n return `[${k}]=\"${k}\"`\n }\n })\n\n return parts.length > 0 ? parts.join(' ') : ''\n}\n","import { Component } from '@angular/core'\n\n@Component({ template: ``, standalone: true })\nexport class StoryEmptyComponent {}\n","import { StoryInitialRouteService } from './initial-route.service'\n\nexport function storyInitialRouteFactory(\n _storyInitialRouteService: StoryInitialRouteService,\n) {\n return () => _storyInitialRouteService.setInitialRoute()\n}\n","import { Injectable, InjectionToken, Injector } from '@angular/core'\nimport { NavigationEnd, Router } from '@angular/router'\nimport { filter, take } from 'rxjs/operators'\n\nexport const STORY_INITIAL_ROUTE_URL = new InjectionToken<any>(\n 'STORY_INITIAL_ROUTE_URL',\n)\n\n@Injectable()\nexport class StoryInitialRouteService {\n constructor(private _injector: Injector) {}\n\n public setInitialRoute() {\n const _router = this._injector.get(Router)\n const url = this._injector.get(STORY_INITIAL_ROUTE_URL)\n if (_router.navigated) {\n _router.navigateByUrl(url)\n } else {\n _router.events\n .pipe(\n filter((e) => e instanceof NavigationEnd),\n take(1),\n )\n .subscribe(() => {\n _router.navigateByUrl(url)\n })\n }\n }\n}\n","import { APP_INITIALIZER, ModuleWithProviders, NgModule } from '@angular/core'\n\nimport { storyInitialRouteFactory } from './initial-route-factory'\nimport {\n StoryInitialRouteService,\n STORY_INITIAL_ROUTE_URL,\n} from './initial-route.service'\n\n@NgModule()\nexport class StoryInitialRouteModule {\n static forRoot(url: string): ModuleWithProviders<StoryInitialRouteModule> {\n return {\n ngModule: StoryInitialRouteModule,\n providers: [\n StoryInitialRouteService,\n {\n provide: APP_INITIALIZER,\n useFactory: storyInitialRouteFactory,\n deps: [StoryInitialRouteService],\n multi: true,\n },\n { provide: STORY_INITIAL_ROUTE_URL, useValue: url },\n ],\n }\n }\n}\n","// import { button } from '@storybook/addon-knobs'\n\n/**\n * Until I find a way to avoid '@storybook/addon-knobs' from interfering with\n * NgZone I can't import it in the knob when built by ng-packagr.\n */\nexport function routeButton(buttonKnob: any, url: string) {\n return buttonKnob(url, () => {\n location.hash = `#${url}`\n return false\n })\n}\n","// import { ArgType } from '@storybook/addons'\n\ndeclare const __STORYBOOK_ADDONS: any\n\nfunction goToHashUrl(url: string): void {\n location.hash = `#${url}`\n}\n\n// __STORYBOOK_ADDONS.getChannel().on('custom/go-to-hash', (data: { hash: string }) => {\n\n// goToHashUrl(data.hash)\n// })\n\n// __STORYBOOK_ADDONS.getChannel().on('storyArgsUpdated', (data: { hash: string }) => {\n// console.log('storyArgsUpdated')\n// })\n\nexport function routesArgType(routes: string[]) /*: ArgType*/ {\n return {\n options: routes,\n control: {\n type: 'select',\n // Runs in the 'manager', so I am emitting to a channel in the 'preview'.\n onChange: (e: any, a: any) => {\n __STORYBOOK_ADDONS.getChannel().emit('custom/go-to-hash', { hash: e })\n return e\n },\n },\n }\n}\n","import { Component } from '@angular/core'\n\n@Component({ template: `<router-outlet></router-outlet>`, standalone: false })\nexport class StoryEmptyWithRouteComponent {}\n","import { Component, Injector, Input, OnDestroy } from '@angular/core'\nimport { combineLatest, Observable, of, ReplaySubject, Subject } from 'rxjs'\nimport { auditTime, map, startWith, takeUntil } from 'rxjs/operators'\n\nimport { ModalConfig, ModalRef, MODAL_DATA } from '@theseam/ui-common/modal'\nimport type { ComponentType } from '@theseam/ui-common/models'\n\nclass FakeModalRef<T, R = any> implements Partial<ModalRef<T, R>> {\n afterOpened() {\n return of(undefined)\n }\n\n close(dialogResult?: R): void {}\n}\n\n@Component({\n // eslint-disable-next-line @angular-eslint/component-selector\n selector: 'story-modal-container-component',\n template: `\n <div class=\"cdk-overlay-container\">\n <div\n class=\"cdk-overlay-backdrop cdk-overlay-dark-backdrop cdk-overlay-backdrop-showing\"\n ></div>\n <div\n class=\"cdk-global-overlay-wrapper\"\n dir=\"ltr\"\n style=\"justify-content: flex-start; align-items: center; pointer-events: auto\"\n seamOverlayScrollbar\n >\n <div\n class=\"seam-modal-container modal-dialog modal-dialog-centered {{\n modalConfig?.modalSize\n ? 'modal-' + modalConfig?.modalSize\n : 'modal-lg'\n }}\"\n tabindex=\"-1\"\n [class.modal-lg]=\"!modalConfig\"\n >\n <div class=\"modal-content\">\n <ng-container *ngIf=\"_outletData$ | async as outletData\">\n <ng-container\n *ngComponentOutlet=\"\n outletData.component;\n injector: outletData.injector\n \"\n ></ng-container>\n </ng-container>\n </div>\n </div>\n </div>\n </div>\n `,\n styles: [\n `\n .seam-modal-container[tabindex='-1']:focus {\n outline: 0 !important;\n }\n `,\n ],\n standalone: false,\n})\nexport class StoryModalContainerComponent<T, D = any> implements OnDestroy {\n private readonly _ngUnsubscribe = new Subject<void>()\n\n @Input() set component(c: ComponentType<T>) {\n this._component.next(c)\n }\n @Input() set data(d: D) {\n this._data.next(d)\n }\n\n @Input() modalConfig?: ModalConfig<D>\n\n _component = new ReplaySubject<ComponentType<T>>(1)\n _data = new ReplaySubject<D>(1)\n\n _outletData$: Observable<{\n component: ComponentType<T>\n injector: Injector\n } | null>\n\n constructor(private _injector: Injector) {\n this._outletData$ = combineLatest([\n this._component.asObservable(),\n this._data.asObservable().pipe(startWith(undefined)),\n ]).pipe(\n auditTime(0),\n map(([component, data]) => ({\n component,\n injector: this._createInjector(data),\n })),\n takeUntil(this._ngUnsubscribe),\n )\n }\n\n ngOnDestroy() {\n this._ngUnsubscribe.next(undefined)\n this._ngUnsubscribe.complete()\n }\n\n private _createInjector(data?: D): Injector {\n return Injector.create({\n providers: [\n { provide: ModalRef, useClass: FakeModalRef, deps: [] },\n { provide: MODAL_DATA, useValue: data },\n ],\n parent: this._injector,\n })\n }\n}\n","import { CommonModule } from '@angular/common'\nimport { NgModule } from '@angular/core'\nimport { RouterModule } from '@angular/router'\n\nimport { TheSeamOverlayScrollbarDirective } from '@theseam/ui-common/scrollbar'\n\nimport { StoryEmptyWithRouteComponent } from './story-empty-with-route.component'\nimport { StoryModalContainerComponent } from './story-modal-container.component'\n\n@NgModule({\n declarations: [StoryEmptyWithRouteComponent, StoryModalContainerComponent],\n imports: [CommonModule, RouterModule, TheSeamOverlayScrollbarDirective],\n exports: [StoryEmptyWithRouteComponent, StoryModalContainerComponent],\n})\nexport class StoryHelperComponentsModule {}\n","import { Injectable } from '@angular/core'\n\nimport {\n ActiveToast,\n GlobalConfig,\n IndividualConfig,\n ToastContainerDirective,\n} from 'ngx-toastr'\n\n@Injectable()\nexport class StoryToastrService {\n toastrConfig?: GlobalConfig\n currentlyActive = 0\n toasts: ActiveToast<any>[] = []\n overlayContainer?: ToastContainerDirective\n previousToastMessage: string | undefined\n\n /** show toast */\n show(\n message?: string,\n title?: string,\n override: Partial<IndividualConfig> = {},\n type = '',\n ) {}\n\n /** show successful toast */\n success(\n message?: string,\n title?: string,\n override: Partial<IndividualConfig> = {},\n ) {}\n\n /** show error toast */\n error(\n message?: string,\n title?: string,\n override: Partial<IndividualConfig> = {},\n ) {}\n\n /** show info toast */\n info(\n message?: string,\n title?: string,\n override: Partial<IndividualConfig> = {},\n ) {}\n\n /** show warning toast */\n warning(\n message?: string,\n title?: string,\n override: Partial<IndividualConfig> = {},\n ) {}\n\n /**\n * Remove all or a single toast by id\n */\n clear(toastId?: number) {}\n\n /**\n * Remove and destroy a single toast by id\n */\n remove(toastId: number) {}\n\n /**\n * Determines if toast message is already shown\n */\n findDuplicate(\n message: string,\n resetOnDuplicate: boolean,\n countDuplicates: boolean,\n ) {}\n}\n","import { APP_BOOTSTRAP_LISTENER, ComponentRef } from '@angular/core'\n// import { STORY } from '@storybook/angular/dist/ts3.9/client/preview/angular/app.token'\n// import { StoryFnAngularReturnType } from '@storybook/angular/dist/ts3.9/client/preview/types'\nimport { Observable } from 'rxjs'\nimport { first } from 'rxjs/operators'\n\n/**\n * Can be used to access a stories component after the story has been bootstrapped.\n *\n * Example:\n * ```ts\n * @Component({\n * selector: 'story-example',\n * template: `Touched: {{ exControl.touched }}`\n * })\n * class StoryExampleComponent {\n * exControl = new FormControl('')\n * }\n *\n * export const TouchExample2 = () => ({\n * moduleMetadata: {\n * declarations: [ StoryExampleComponent ],\n * providers: [ onStoryBootstrappedExec((c: StoryExampleComponent) => c.exControl.markAsTouched()) ]\n * },\n * props: { },\n * component: StoryExampleComponent\n * })\n * ```\n */\n// export function onStoryBootstrappedExec<T = any>(callback: (component: T) => void) {\n// function bootstrapped(componentRef: ComponentRef<any>) {\n// const data = componentRef.instance.target.injector.get(STORY, null) as Observable<StoryFnAngularReturnType> | null\n// if (!data) {\n// console.warn(`STORY provider not found.`)\n// return\n// }\n// data?.pipe(first()).subscribe(story => {\n// if (!story.component) {\n// console.warn(`'onStoryBootstrappedExec' only supported on stories that provide 'component' property.`)\n// return\n// }\n\n// let c = null\n// for (let i = 0; i < componentRef.instance.target.length; i++) {\n// const tmp = componentRef.instance.target._embeddedViews[i].nodes?.find((f: any) => f?.instance instanceof story.component)\n// const comp = tmp?.instance\n// if (comp) {\n// c = comp\n// break\n// }\n// }\n\n// if (!c) {\n// console.warn(`Story component instance not found.`)\n// return\n// }\n\n// if (c) {\n// callback(c)\n// }\n// })\n// }\n\n// return {\n// provide: APP_BOOTSTRAP_LISTENER,\n// useValue: bootstrapped,\n// multi: true\n// }\n// }\n","import { APP_BOOTSTRAP_LISTENER, ComponentRef, ElementRef } from '@angular/core'\n\n// TODO: Consider supporting a target selection function, so that complex\n// selections that can't be expressed by a simple selector can be used.\n\n/**\n * Can be used to trigger an event on a target element when the story component has been bootstrapped.\n *\n * Example:\n * ```\n * export const TouchExample1 = () => ({\n * moduleMetadata: {\n * providers: [ onStoryBootstrappedTrigger('input', 'blur') ]\n * },\n * props: { control: new FormControl('') },\n * template: `\n * <input type=\"text\" [formControl]=\"control\">\n * Touched: {{ control.touched }}\n * `\n * })\n * ```\n */\nexport function onStoryBootstrappedTrigger(\n targetSelector: string,\n eventName: string,\n) {\n function bootstrapped(componentRef: ComponentRef<any>) {\n const elementRef = componentRef.injector.get(ElementRef, null)\n const target = elementRef?.nativeElement.querySelector(targetSelector)\n if (!target) {\n // eslint-disable-next-line no-console\n console.warn(\n `Unable to trigger event '${eventName}'. Target '${targetSelector}' not found.`,\n )\n }\n\n const e = document.createEvent('HTMLEvents')\n e.initEvent('blur', false, true)\n target.dispatchEvent(e)\n }\n\n return {\n provide: APP_BOOTSTRAP_LISTENER,\n useValue: bootstrapped,\n multi: true,\n }\n}\n","import { Injectable } from '@angular/core'\nimport { Observable, of } from 'rxjs'\n\nimport { TheSeamPreferencesAccessor } from '@theseam/ui-common/services'\n\nconst ACCESSOR_PREFIX = 'story-pref'\n\n@Injectable()\nexport class StoryPreferencesAccessorService\n implements TheSeamPreferencesAccessor\n{\n /**\n * Gets a preference.\n */\n public get(name: string): Observable<string> {\n // console.log('get', name)\n return of(localStorage.getItem(`${ACCESSOR_PREFIX}-${name}`) || '{}')\n }\n\n /**\n * Update a preference.\n */\n public update(name: string, value: string): Observable<string> {\n // console.log('update', name)\n localStorage.setItem(`${ACCESSOR_PREFIX}-${name}`, value)\n return this.get(name)\n }\n\n /**\n * Delete a preference.\n */\n public delete(name: string): Observable<boolean> {\n localStorage.removeItem(`${ACCESSOR_PREFIX}-${name}`)\n return of(true)\n }\n}\n","import { APP_INITIALIZER, Injector } from '@angular/core'\n\nimport { AngularRenderer, applicationConfig } from '@storybook/angular'\nimport { DecoratorFunction } from 'storybook/internal/csf'\n\nexport const INJECTOR_TO_ARGS_PROPERTY_NAME = '__getInjector'\n\n// TODO: Decide a better way to persist the injector reference than poluting\n// args with a value that isn't really meant to be an arg.\n\n/**\n * Storybook decorator that stores the Angular Injector in\n * args, for retrieval in play function.\n */\nexport const addInjectorGetterToArgs =\n (\n argName: string = INJECTOR_TO_ARGS_PROPERTY_NAME,\n ): DecoratorFunction<AngularRenderer> =>\n (story: any, context: any) => {\n // TODO: Test this more thoroughly.\n let injector: Injector | null = null\n context.args[argName] = () => injector\n return applicationConfig({\n providers: [\n {\n provide: APP_INITIALIZER,\n useFactory: (injectorService: Injector) => () => {\n injector = injectorService\n },\n deps: [Injector],\n multi: true,\n },\n ],\n })(story, context)\n }\n\nexport const getInjectorFromArgs = (\n args: any,\n argName: string = INJECTOR_TO_ARGS_PROPERTY_NAME,\n): Injector => {\n if (!args || typeof args[argName] !== 'function') {\n throw Error(`Injector getter function '${argName}' not found.`)\n }\n const injector = args[argName]()\n if (!injector) {\n throw Error(\n `Injector not found. Did you add 'addInjectorGetterToArgs' to your story dectorators?`,\n )\n }\n\n return injector\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":["i1"],"mappings":";;;;;;;;;;;;;;;AAAA;AAMO,MAAM,YAAY,GAAY;AACnC,IAAA,OAAO,EAAE,UAAU;AACnB,IAAA,OAAO,EAAE;AACP,QAAA,IAAI,EAAE,QAAQ;AACf,KAAA;AACD,IAAA,WAAW,EAAE,CAAA,YAAA,CAAc;;AAGtB,MAAM,uBAAuB,GAAY;AAC9C,IAAA,OAAO,EAAE,CAAC,GAAG,UAAU,EAAE,GAAG,iBAAiB,CAAC;AAC9C,IAAA,OAAO,EAAE;AACP,QAAA,IAAI,EAAE,QAAQ;AACf,KAAA;AACD,IAAA,WAAW,EAAE,CAAA,YAAA,CAAc;;AAGtB,MAAM,WAAW,GAAY;AAClC,IAAA,OAAO,EAAE,CAAC,SAAS,EAAE,IAAI,EAAE,IAAI,CAAC;AAChC,IAAA,OAAO,EAAE;AACP,QAAA,IAAI,EAAE,QAAQ;AACf,KAAA;AACD,IAAA,WAAW,EAAE,CAAA,KAAA,CAAO;;AAGf,MAAM,iBAAiB,GAAY;AACxC,IAAA,OAAO,EAAE,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AO,CAAC,GAAG,MAAM,QAAQ;AACtC,IAAA,OAAO,iBAAiB,CAAC;AACvB,QAAA,SAAS,EAAE;AACT,YAAA;AACE,gBAAA,OAAO,EAAE,eAAe;AACxB,gBAAA,UAAU,EAAE,CAAC,eAAyB,KAAK,MAAK;oBAC9C,QAAQ,GAAG,eAAe;gBAC5B,CAAC;gBACD,IAAI,EAAE,CAAC,QAAQ,CAAC;AAChB,gBAAA,KAAK,EAAE,IAAI;AACZ,aAAA;AACF,SAAA;AACF,KAAA,CAAC,CAAC,KAAK,EAAE,OAAO,CAAC;AACpB;AAEK,MAAM,mBAAmB,GAAG,CACjC,IAAS,EACT,OAAA,GAAkB,8BAA8B,KACpC;IACZ,IAAI,CAAC,IAAI,IAAI,OAAO,IAAI,CAAC,OAAO,CAAC,KAAK,UAAU,EAAE;AAChD,QAAA,MAAM,KAAK,CAAC,CAAA,0BAAA,EAA6B,OAAO,CAAA,YAAA,CAAc,CAAC;IACjE;AACA,IAAA,MAAM,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,EAAE;IAChC,IAAI,CAAC,QAAQ,EAAE;AACb,QAAA,MAAM,KAAK,CACT,CAAA,oFAAA,CAAsF,CACvF;IACH;AAEA,IAAA,OAAO,QAAQ;AACjB;;ACnDA;;AAEG;;;;"}
1
+ {"version":3,"file":"theseam-ui-common-story-helpers.mjs","sources":["../../../projects/ui-common/story-helpers/arg-type-helpers.ts","../../../projects/ui-common/story-helpers/args-to-tpl.ts","../../../projects/ui-common/story-helpers/story-empty.component.ts","../../../projects/ui-common/story-helpers/initial-route-factory.ts","../../../projects/ui-common/story-helpers/initial-route.service.ts","../../../projects/ui-common/story-helpers/story-initial-route.ts","../../../projects/ui-common/story-helpers/route-button.ts","../../../projects/ui-common/story-helpers/routes-arg-type.ts","../../../projects/ui-common/story-helpers/story-empty-with-route.component.ts","../../../projects/ui-common/story-helpers/story-modal-container.component.ts","../../../projects/ui-common/story-helpers/story-helper-components.module.ts","../../../projects/ui-common/story-helpers/on-story-bootstrapped-exec.ts","../../../projects/ui-common/story-helpers/on-story-bootstrapped-trigger.ts","../../../projects/ui-common/story-helpers/story-preferences-accessor.service.ts","../../../projects/ui-common/story-helpers/add-injector-to-args.ts","../../../projects/ui-common/story-helpers/theseam-ui-common-story-helpers.ts"],"sourcesContent":["// import { ArgType } from '@storybook/addons'\n\nimport { OutlineThemeNames, ThemeNames } from '@theseam/ui-common/models'\n\ndeclare type ArgType = any\n\nexport const themeArgType: ArgType = {\n options: ThemeNames,\n control: {\n type: 'select',\n },\n description: `Theme style.`,\n}\n\nexport const themeWithOutlineArgType: ArgType = {\n options: [...ThemeNames, ...OutlineThemeNames],\n control: {\n type: 'select',\n },\n description: `Theme style.`,\n}\n\nexport const sizeArgType: ArgType = {\n options: [undefined, 'sm', 'lg'],\n control: {\n type: 'select',\n },\n description: `Size.`,\n}\n\nexport const buttonTypeArgType: ArgType = {\n options: ['button', 'submit'],\n control: {\n type: 'select',\n },\n description: `Button type.`,\n}\n","/* eslint-disable no-prototype-builtins */\nimport { action, HandlerFunction } from 'storybook/actions'\nimport { AngularRenderer, ArgTypes } from '@storybook/angular'\nimport { useStoryContext } from 'storybook/preview-api'\n\nexport interface ArgsTplParts {\n actions: { [prop: string]: HandlerFunction }\n tplfragment: string\n}\n\n/**\n * This is an attempt at simplifying the use of auto-generated args in stories\n * defined with `template`, since Angular doesn't have a way to simply use a\n * spread operator syntax.\n *\n * @experimental\n */\n// export function argsToTplParts(args: any, argTypes: ArgTypes): ArgsTplParts {\n// // console.log({ args, argTypes })\n// const parts: ArgsTplParts = {\n// actions: {},\n// tplfragment: ''\n// }\n\n// Object.keys(argTypes).forEach(k => {\n// // Inputs\n// if (\n// // Is in the inputs category\n// argTypes[k].table.category === 'inputs' &&\n// // Needs a control to be able to change from auto-generated args.\n// argTypes[k]?.hasOwnProperty('control') &&\n// // Assuming the arg might not be in props if there isn't an arg value.\n// args.hasOwnProperty(k)\n// ) {\n// parts.tplfragment += `[${k}]=\"${k}\" `\n// }\n\n// // Outputs\n// if (\n// // Is in the outputs category\n// argTypes[k]?.table?.category === 'outputs'\n// ) {\n// // Without access to props, I don't know if I can get an action into the\n// // template context like this.\n// parts.tplfragment += `(${k})=\"${k}($event)\" `\n// parts.actions[k] = action(k)\n// }\n// })\n\n// return parts\n// }\n\nfunction removeDuplicates(arr: string[]) {\n const seen: { [k: string]: boolean } = {}\n return arr.filter((item) => {\n if (!seen[item]) {\n seen[item] = true\n return true\n }\n return false\n })\n}\n\nexport interface ArgsTplOptions {\n /**\n * Properties to always bind to the template.\n */\n alwaysBind?: string[]\n /**\n * Properties to exclude from bidning to the template.\n */\n exclude?: string[]\n}\n\n/**\n * This is an attempt at simplifying the use of auto-generated args in stories\n * defined with `template`, since Angular doesn't have a way to simply use a\n * spread operator syntax.\n *\n * @experimental\n */\nexport function argsToTpl(options?: ArgsTplOptions) {\n const context = useStoryContext<AngularRenderer>()\n\n const exclude = [\n ...(context?.parameters?.argsToTplOptions?.exclude || []),\n ...(options?.exclude || []),\n ]\n\n const alwaysBind = context?.parameters?.argsToTplOptions?.alwaysBind || []\n\n const props = removeDuplicates([...alwaysBind, ...Object.keys(context.args)])\n\n const parts = props\n .filter((k) => exclude.indexOf(k) === -1)\n .map((k) => {\n // Outputs\n if (\n context.argTypes[k]?.hasOwnProperty('action') &&\n (context.args.hasOwnProperty(k) || alwaysBind.indexOf(k) !== -1)\n ) {\n return `(${k})=\"${k}($event)\"`\n }\n\n // Inputs\n if (context.args.hasOwnProperty(k) || alwaysBind.indexOf(k) !== -1) {\n return `[${k}]=\"${k}\"`\n }\n })\n\n return parts.length > 0 ? parts.join(' ') : ''\n}\n","import { Component } from '@angular/core'\n\n@Component({ template: ``, standalone: true })\nexport class StoryEmptyComponent {}\n","import { StoryInitialRouteService } from './initial-route.service'\n\nexport function storyInitialRouteFactory(\n _storyInitialRouteService: StoryInitialRouteService,\n) {\n return () => _storyInitialRouteService.setInitialRoute()\n}\n","import { Injectable, InjectionToken, Injector } from '@angular/core'\nimport { NavigationEnd, Router } from '@angular/router'\nimport { filter, take } from 'rxjs/operators'\n\nexport const STORY_INITIAL_ROUTE_URL = new InjectionToken<any>(\n 'STORY_INITIAL_ROUTE_URL',\n)\n\n@Injectable()\nexport class StoryInitialRouteService {\n constructor(private _injector: Injector) {}\n\n public setInitialRoute() {\n const _router = this._injector.get(Router)\n const url = this._injector.get(STORY_INITIAL_ROUTE_URL)\n if (_router.navigated) {\n _router.navigateByUrl(url)\n } else {\n _router.events\n .pipe(\n filter((e) => e instanceof NavigationEnd),\n take(1),\n )\n .subscribe(() => {\n _router.navigateByUrl(url)\n })\n }\n }\n}\n","import { APP_INITIALIZER, ModuleWithProviders, NgModule } from '@angular/core'\n\nimport { storyInitialRouteFactory } from './initial-route-factory'\nimport {\n StoryInitialRouteService,\n STORY_INITIAL_ROUTE_URL,\n} from './initial-route.service'\n\n@NgModule()\nexport class StoryInitialRouteModule {\n static forRoot(url: string): ModuleWithProviders<StoryInitialRouteModule> {\n return {\n ngModule: StoryInitialRouteModule,\n providers: [\n StoryInitialRouteService,\n {\n provide: APP_INITIALIZER,\n useFactory: storyInitialRouteFactory,\n deps: [StoryInitialRouteService],\n multi: true,\n },\n { provide: STORY_INITIAL_ROUTE_URL, useValue: url },\n ],\n }\n }\n}\n","// import { button } from '@storybook/addon-knobs'\n\n/**\n * Until I find a way to avoid '@storybook/addon-knobs' from interfering with\n * NgZone I can't import it in the knob when built by ng-packagr.\n */\nexport function routeButton(buttonKnob: any, url: string) {\n return buttonKnob(url, () => {\n location.hash = `#${url}`\n return false\n })\n}\n","// import { ArgType } from '@storybook/addons'\n\ndeclare const __STORYBOOK_ADDONS: any\n\nfunction goToHashUrl(url: string): void {\n location.hash = `#${url}`\n}\n\n// __STORYBOOK_ADDONS.getChannel().on('custom/go-to-hash', (data: { hash: string }) => {\n\n// goToHashUrl(data.hash)\n// })\n\n// __STORYBOOK_ADDONS.getChannel().on('storyArgsUpdated', (data: { hash: string }) => {\n// console.log('storyArgsUpdated')\n// })\n\nexport function routesArgType(routes: string[]) /*: ArgType*/ {\n return {\n options: routes,\n control: {\n type: 'select',\n // Runs in the 'manager', so I am emitting to a channel in the 'preview'.\n onChange: (e: any, a: any) => {\n __STORYBOOK_ADDONS.getChannel().emit('custom/go-to-hash', { hash: e })\n return e\n },\n },\n }\n}\n","import { Component } from '@angular/core'\n\n@Component({ template: `<router-outlet></router-outlet>`, standalone: false })\nexport class StoryEmptyWithRouteComponent {}\n","import { Component, Injector, Input, OnDestroy } from '@angular/core'\nimport { combineLatest, Observable, of, ReplaySubject, Subject } from 'rxjs'\nimport { auditTime, map, startWith, takeUntil } from 'rxjs/operators'\n\nimport { ModalConfig, ModalRef, MODAL_DATA } from '@theseam/ui-common/modal'\nimport type { ComponentType } from '@theseam/ui-common/models'\n\nclass FakeModalRef<T, R = any> implements Partial<ModalRef<T, R>> {\n afterOpened() {\n return of(undefined)\n }\n\n close(dialogResult?: R): void {}\n}\n\n@Component({\n // eslint-disable-next-line @angular-eslint/component-selector\n selector: 'story-modal-container-component',\n template: `\n <div class=\"cdk-overlay-container\">\n <div\n class=\"cdk-overlay-backdrop cdk-overlay-dark-backdrop cdk-overlay-backdrop-showing\"\n ></div>\n <div\n class=\"cdk-global-overlay-wrapper\"\n dir=\"ltr\"\n style=\"justify-content: flex-start; align-items: center; pointer-events: auto\"\n seamOverlayScrollbar\n >\n <div\n class=\"seam-modal-container modal-dialog modal-dialog-centered {{\n modalConfig?.modalSize\n ? 'modal-' + modalConfig?.modalSize\n : 'modal-lg'\n }}\"\n tabindex=\"-1\"\n [class.modal-lg]=\"!modalConfig\"\n >\n <div class=\"modal-content\">\n <ng-container *ngIf=\"_outletData$ | async as outletData\">\n <ng-container\n *ngComponentOutlet=\"\n outletData.component;\n injector: outletData.injector\n \"\n ></ng-container>\n </ng-container>\n </div>\n </div>\n </div>\n </div>\n `,\n styles: [\n `\n .seam-modal-container[tabindex='-1']:focus {\n outline: 0 !important;\n }\n `,\n ],\n standalone: false,\n})\nexport class StoryModalContainerComponent<T, D = any> implements OnDestroy {\n private readonly _ngUnsubscribe = new Subject<void>()\n\n @Input() set component(c: ComponentType<T>) {\n this._component.next(c)\n }\n @Input() set data(d: D) {\n this._data.next(d)\n }\n\n @Input() modalConfig?: ModalConfig<D>\n\n _component = new ReplaySubject<ComponentType<T>>(1)\n _data = new ReplaySubject<D>(1)\n\n _outletData$: Observable<{\n component: ComponentType<T>\n injector: Injector\n } | null>\n\n constructor(private _injector: Injector) {\n this._outletData$ = combineLatest([\n this._component.asObservable(),\n this._data.asObservable().pipe(startWith(undefined)),\n ]).pipe(\n auditTime(0),\n map(([component, data]) => ({\n component,\n injector: this._createInjector(data),\n })),\n takeUntil(this._ngUnsubscribe),\n )\n }\n\n ngOnDestroy() {\n this._ngUnsubscribe.next(undefined)\n this._ngUnsubscribe.complete()\n }\n\n private _createInjector(data?: D): Injector {\n return Injector.create({\n providers: [\n { provide: ModalRef, useClass: FakeModalRef, deps: [] },\n { provide: MODAL_DATA, useValue: data },\n ],\n parent: this._injector,\n })\n }\n}\n","import { CommonModule } from '@angular/common'\nimport { NgModule } from '@angular/core'\nimport { RouterModule } from '@angular/router'\n\nimport { TheSeamOverlayScrollbarDirective } from '@theseam/ui-common/scrollbar'\n\nimport { StoryEmptyWithRouteComponent } from './story-empty-with-route.component'\nimport { StoryModalContainerComponent } from './story-modal-container.component'\n\n@NgModule({\n declarations: [StoryEmptyWithRouteComponent, StoryModalContainerComponent],\n imports: [CommonModule, RouterModule, TheSeamOverlayScrollbarDirective],\n exports: [StoryEmptyWithRouteComponent, StoryModalContainerComponent],\n})\nexport class StoryHelperComponentsModule {}\n","import { APP_BOOTSTRAP_LISTENER, ComponentRef } from '@angular/core'\n// import { STORY } from '@storybook/angular/dist/ts3.9/client/preview/angular/app.token'\n// import { StoryFnAngularReturnType } from '@storybook/angular/dist/ts3.9/client/preview/types'\nimport { Observable } from 'rxjs'\nimport { first } from 'rxjs/operators'\n\n/**\n * Can be used to access a stories component after the story has been bootstrapped.\n *\n * Example:\n * ```ts\n * @Component({\n * selector: 'story-example',\n * template: `Touched: {{ exControl.touched }}`\n * })\n * class StoryExampleComponent {\n * exControl = new FormControl('')\n * }\n *\n * export const TouchExample2 = () => ({\n * moduleMetadata: {\n * declarations: [ StoryExampleComponent ],\n * providers: [ onStoryBootstrappedExec((c: StoryExampleComponent) => c.exControl.markAsTouched()) ]\n * },\n * props: { },\n * component: StoryExampleComponent\n * })\n * ```\n */\n// export function onStoryBootstrappedExec<T = any>(callback: (component: T) => void) {\n// function bootstrapped(componentRef: ComponentRef<any>) {\n// const data = componentRef.instance.target.injector.get(STORY, null) as Observable<StoryFnAngularReturnType> | null\n// if (!data) {\n// console.warn(`STORY provider not found.`)\n// return\n// }\n// data?.pipe(first()).subscribe(story => {\n// if (!story.component) {\n// console.warn(`'onStoryBootstrappedExec' only supported on stories that provide 'component' property.`)\n// return\n// }\n\n// let c = null\n// for (let i = 0; i < componentRef.instance.target.length; i++) {\n// const tmp = componentRef.instance.target._embeddedViews[i].nodes?.find((f: any) => f?.instance instanceof story.component)\n// const comp = tmp?.instance\n// if (comp) {\n// c = comp\n// break\n// }\n// }\n\n// if (!c) {\n// console.warn(`Story component instance not found.`)\n// return\n// }\n\n// if (c) {\n// callback(c)\n// }\n// })\n// }\n\n// return {\n// provide: APP_BOOTSTRAP_LISTENER,\n// useValue: bootstrapped,\n// multi: true\n// }\n// }\n","import { APP_BOOTSTRAP_LISTENER, ComponentRef, ElementRef } from '@angular/core'\n\n// TODO: Consider supporting a target selection function, so that complex\n// selections that can't be expressed by a simple selector can be used.\n\n/**\n * Can be used to trigger an event on a target element when the story component has been bootstrapped.\n *\n * Example:\n * ```\n * export const TouchExample1 = () => ({\n * moduleMetadata: {\n * providers: [ onStoryBootstrappedTrigger('input', 'blur') ]\n * },\n * props: { control: new FormControl('') },\n * template: `\n * <input type=\"text\" [formControl]=\"control\">\n * Touched: {{ control.touched }}\n * `\n * })\n * ```\n */\nexport function onStoryBootstrappedTrigger(\n targetSelector: string,\n eventName: string,\n) {\n function bootstrapped(componentRef: ComponentRef<any>) {\n const elementRef = componentRef.injector.get(ElementRef, null)\n const target = elementRef?.nativeElement.querySelector(targetSelector)\n if (!target) {\n // eslint-disable-next-line no-console\n console.warn(\n `Unable to trigger event '${eventName}'. Target '${targetSelector}' not found.`,\n )\n }\n\n const e = document.createEvent('HTMLEvents')\n e.initEvent('blur', false, true)\n target.dispatchEvent(e)\n }\n\n return {\n provide: APP_BOOTSTRAP_LISTENER,\n useValue: bootstrapped,\n multi: true,\n }\n}\n","import { Injectable } from '@angular/core'\nimport { Observable, of } from 'rxjs'\n\nimport { TheSeamPreferencesAccessor } from '@theseam/ui-common/services'\n\nconst ACCESSOR_PREFIX = 'story-pref'\n\n@Injectable()\nexport class StoryPreferencesAccessorService\n implements TheSeamPreferencesAccessor\n{\n /**\n * Gets a preference.\n */\n public get(name: string): Observable<string> {\n // console.log('get', name)\n return of(localStorage.getItem(`${ACCESSOR_PREFIX}-${name}`) || '{}')\n }\n\n /**\n * Update a preference.\n */\n public update(name: string, value: string): Observable<string> {\n // console.log('update', name)\n localStorage.setItem(`${ACCESSOR_PREFIX}-${name}`, value)\n return this.get(name)\n }\n\n /**\n * Delete a preference.\n */\n public delete(name: string): Observable<boolean> {\n localStorage.removeItem(`${ACCESSOR_PREFIX}-${name}`)\n return of(true)\n }\n}\n","import { APP_INITIALIZER, Injector } from '@angular/core'\n\nimport { AngularRenderer, applicationConfig } from '@storybook/angular'\nimport { DecoratorFunction } from 'storybook/internal/csf'\n\nexport const INJECTOR_TO_ARGS_PROPERTY_NAME = '__getInjector'\n\n// TODO: Decide a better way to persist the injector reference than poluting\n// args with a value that isn't really meant to be an arg.\n\n/**\n * Storybook decorator that stores the Angular Injector in\n * args, for retrieval in play function.\n */\nexport const addInjectorGetterToArgs =\n (\n argName: string = INJECTOR_TO_ARGS_PROPERTY_NAME,\n ): DecoratorFunction<AngularRenderer> =>\n (story: any, context: any) => {\n // TODO: Test this more thoroughly.\n let injector: Injector | null = null\n context.args[argName] = () => injector\n return applicationConfig({\n providers: [\n {\n provide: APP_INITIALIZER,\n useFactory: (injectorService: Injector) => () => {\n injector = injectorService\n },\n deps: [Injector],\n multi: true,\n },\n ],\n })(story, context)\n }\n\nexport const getInjectorFromArgs = (\n args: any,\n argName: string = INJECTOR_TO_ARGS_PROPERTY_NAME,\n): Injector => {\n if (!args || typeof args[argName] !== 'function') {\n throw Error(`Injector getter function '${argName}' not found.`)\n }\n const injector = args[argName]()\n if (!injector) {\n throw Error(\n `Injector not found. Did you add 'addInjectorGetterToArgs' to your story dectorators?`,\n )\n }\n\n return injector\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":["i1"],"mappings":";;;;;;;;;;;;;;;AAAA;AAMO,MAAM,YAAY,GAAY;AACnC,IAAA,OAAO,EAAE,UAAU;AACnB,IAAA,OAAO,EAAE;AACP,QAAA,IAAI,EAAE,QAAQ;AACf,KAAA;AACD,IAAA,WAAW,EAAE,CAAA,YAAA,CAAc;;AAGtB,MAAM,uBAAuB,GAAY;AAC9C,IAAA,OAAO,EAAE,CAAC,GAAG,UAAU,EAAE,GAAG,iBAAiB,CAAC;AAC9C,IAAA,OAAO,EAAE;AACP,QAAA,IAAI,EAAE,QAAQ;AACf,KAAA;AACD,IAAA,WAAW,EAAE,CAAA,YAAA,CAAc;;AAGtB,MAAM,WAAW,GAAY;AAClC,IAAA,OAAO,EAAE,CAAC,SAAS,EAAE,IAAI,EAAE,IAAI,CAAC;AAChC,IAAA,OAAO,EAAE;AACP,QAAA,IAAI,EAAE,QAAQ;AACf,KAAA;AACD,IAAA,WAAW,EAAE,CAAA,KAAA,CAAO;;AAGf,MAAM,iBAAiB,GAAY;AACxC,IAAA,OAAO,EAAE,CAAC,QAAQ,EAAE,QAAQ,CAAC;AAC7B,IAAA,OAAO,EAAE;AACP,QAAA,IAAI,EAAE,QAAQ;AACf,KAAA;AACD,I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AAA;;4FAA/B,+BAA+B,EAAA,UAAA,EAAA,CAAA;kBAD3C;;;ACFM,MAAM,8BAA8B,GAAG;AAE9C;AACA;AAEA;;;AAGG;AACI,MAAM,uBAAuB,GAClC,CACE,OAAA,GAAkB,8BAA8B,KAElD,CAAC,KAAU,EAAE,OAAY,KAAI;;IAE3B,IAAI,QAAQ,GAAoB,IAAI;IACpC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,MAAM,QAAQ;AACtC,IAAA,OAAO,iBAAiB,CAAC;AACvB,QAAA,SAAS,EAAE;AACT,YAAA;AACE,gBAAA,OAAO,EAAE,eAAe;AACxB,gBAAA,UAAU,EAAE,CAAC,eAAyB,KAAK,MAAK;oBAC9C,QAAQ,GAAG,eAAe;gBAC5B,CAAC;gBACD,IAAI,EAAE,CAAC,QAAQ,CAAC;AAChB,gBAAA,KAAK,EAAE,IAAI;AACZ,aAAA;AACF,SAAA;AACF,KAAA,CAAC,CAAC,KAAK,EAAE,OAAO,CAAC;AACpB;AAEK,MAAM,mBAAmB,GAAG,CACjC,IAAS,EACT,OAAA,GAAkB,8BAA8B,KACpC;IACZ,IAAI,CAAC,IAAI,IAAI,OAAO,IAAI,CAAC,OAAO,CAAC,KAAK,UAAU,EAAE;AAChD,QAAA,MAAM,KAAK,CAAC,CAAA,0BAAA,EAA6B,OAAO,CAAA,YAAA,CAAc,CAAC;IACjE;AACA,IAAA,MAAM,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,EAAE;IAChC,IAAI,CAAC,QAAQ,EAAE;AACb,QAAA,MAAM,KAAK,CACT,CAAA,oFAAA,CAAsF,CACvF;IACH;AAEA,IAAA,OAAO,QAAQ;AACjB;;ACnDA;;AAEG;;;;"}
@@ -1,23 +1,25 @@
1
1
  import { ComponentHarness, HarnessPredicate } from '@angular/cdk/testing';
2
2
  import { coerceBooleanProperty } from '@angular/cdk/coercion';
3
+ import { ToastrService } from 'ngx-toastr';
3
4
  import { tick } from '@angular/core/testing';
4
5
  import { TestbedHarnessEnvironment } from '@angular/cdk/testing/testbed';
5
6
  import { StorybookHarnessEnvironment } from '@marklb/storybook-harness';
6
7
 
7
8
  class TheSeamNgSelectOptionHarness extends ComponentHarness {
8
9
  static hostSelector = '.ng-option';
9
- /** Creates a `HarnessPredicate` used to locate a particular `MyMenuHarness`. */
10
+ /** Creates a `HarnessPredicate` used to locate a particular `TheSeamNgSelectOptionHarness`. */
10
11
  static with(options) {
11
- return new HarnessPredicate(TheSeamNgSelectOptionHarness, options).addOption('option value', options.value, (harness, value) => HarnessPredicate.stringMatches(harness.getValue(), value));
12
+ return new HarnessPredicate(TheSeamNgSelectOptionHarness, options).addOption('option label', options.label, (harness, label) => HarnessPredicate.stringMatches(harness.getLabel(), label));
12
13
  }
13
14
  /**
14
- * NOTE: Only works with string values, curently.
15
- * @returns value of the select option
15
+ * Gets the rendered text of the option.
16
+ *
17
+ * Note: this returns the displayed label, not the bound value.
16
18
  */
17
- async getValue() {
19
+ async getLabel() {
18
20
  return (await this.host()).text();
19
21
  }
20
- /** Whether the ng-select is disabled. */
22
+ /** Whether the option is disabled. */
21
23
  async isDisabled() {
22
24
  const disabled = (await this.host()).getAttribute('disabled');
23
25
  return coerceBooleanProperty(await disabled);
@@ -161,7 +163,7 @@ class TheSeamNgSelectHarness extends ComponentHarness {
161
163
  }
162
164
  }
163
165
 
164
- class FakeToastrService {
166
+ class MockToastrService {
165
167
  toastrConfig;
166
168
  currentlyActive = 0;
167
169
  toasts = [];
@@ -190,6 +192,9 @@ class FakeToastrService {
190
192
  */
191
193
  findDuplicate(message, resetOnDuplicate, countDuplicates) { }
192
194
  }
195
+ function provideMockToastrService() {
196
+ return { provide: ToastrService, useClass: MockToastrService };
197
+ }
193
198
 
194
199
  // NOTE: This is an experimental attempt at removing some of the boilerplate. If
195
200
  // this ends up being worth it, then I will add it to `@storybook/testing-angular`.
@@ -314,5 +319,5 @@ function isComponentHarnessConstructor(value) {
314
319
  * Generated bundle index. Do not edit.
315
320
  */
316
321
 
317
- export { FakeToastrService, TheSeamNgSelectDropdownHarness, TheSeamNgSelectHarness, TheSeamNgSelectOptionHarness, TickHelper, currentTickTime, getHarness, renderStory };
322
+ export { MockToastrService, TheSeamNgSelectDropdownHarness, TheSeamNgSelectHarness, TheSeamNgSelectOptionHarness, TickHelper, currentTickTime, getHarness, provideMockToastrService, renderStory };
318
323
  //# sourceMappingURL=theseam-ui-common-testing.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"theseam-ui-common-testing.mjs","sources":["../../../projects/ui-common/testing/harnesses/ng-select-option.harness.ts","../../../projects/ui-common/testing/harnesses/ng-select-dropdown.harness.ts","../../../projects/ui-common/testing/harnesses/ng-select.harness.ts","../../../projects/ui-common/testing/fake-toastr.ts","../../../projects/ui-common/testing/render-story.ts","../../../projects/ui-common/testing/tick-helper.ts","../../../projects/ui-common/testing/current-tick-time.ts","../../../projects/ui-common/testing/get-harness.ts","../../../projects/ui-common/testing/theseam-ui-common-testing.ts"],"sourcesContent":["import { coerceBooleanProperty } from '@angular/cdk/coercion'\nimport {\n BaseHarnessFilters,\n ComponentHarness,\n HarnessPredicate,\n} from '@angular/cdk/testing'\n\nexport interface TheSeamNgSelectOptionHarnessFilters\n extends BaseHarnessFilters {\n /** Filters based on the value of the field. */\n value?: string | RegExp\n}\n\nexport class TheSeamNgSelectOptionHarness extends ComponentHarness {\n static hostSelector = '.ng-option'\n\n /** Creates a `HarnessPredicate` used to locate a particular `MyMenuHarness`. */\n static with(\n options: TheSeamNgSelectOptionHarnessFilters,\n ): HarnessPredicate<TheSeamNgSelectOptionHarness> {\n return new HarnessPredicate(\n TheSeamNgSelectOptionHarness,\n options,\n ).addOption('option value', options.value, (harness, value) =>\n HarnessPredicate.stringMatches(harness.getValue(), value),\n )\n }\n\n /**\n * NOTE: Only works with string values, curently.\n * @returns value of the select option\n */\n public async getValue(): Promise<any> {\n return (await this.host()).text()\n }\n\n /** Whether the ng-select is disabled. */\n async isDisabled(): Promise<boolean> {\n const disabled = (await this.host()).getAttribute('disabled')\n return coerceBooleanProperty(await disabled)\n }\n\n public async click(): Promise<void> {\n return (await this.host()).click()\n }\n}\n","import { coerceBooleanProperty } from '@angular/cdk/coercion'\nimport {\n BaseHarnessFilters,\n ComponentHarness,\n HarnessPredicate,\n} from '@angular/cdk/testing'\n\nimport { TheSeamFormFieldRequiredIndicatorHarness } from '@theseam/ui-common/form-field'\nimport {\n TheSeamNgSelectOptionHarness,\n TheSeamNgSelectOptionHarnessFilters,\n} from './ng-select-option.harness'\n\nexport interface TheSeamNgSelectDropdownHarnessFilters\n extends BaseHarnessFilters {\n /** Filters based on the name of the field. */\n id?: string | RegExp\n}\n\nexport class TheSeamNgSelectDropdownHarness extends ComponentHarness {\n static hostSelector = 'ng-dropdown-panel'\n\n // private readonly _ngSelect = this.locatorFor(TheSeamNgSelectDropdownHarness)\n // private readonly _requiredIndicator = this.locatorFor(TheSeamFormFieldRequiredIndicatorHarness)\n // private readonly _valueLabel = this.locatorForOptional('.ng-value-label')\n // private readonly _options = this.locatorForOptional(TheSeamNgSelectOptionHarness)\n\n /** Creates a `HarnessPredicate` used to locate a particular `MyMenuHarness`. */\n static with(\n options: TheSeamNgSelectDropdownHarnessFilters,\n ): HarnessPredicate<TheSeamNgSelectDropdownHarness> {\n return new HarnessPredicate(\n TheSeamNgSelectDropdownHarness,\n options,\n ).addOption('field id', options.id, (harness, id) =>\n HarnessPredicate.stringMatches(harness.getId(), id),\n )\n }\n\n public async getId(): Promise<string | null> {\n return (await this.host()).getAttribute('id')\n }\n\n /**\n * Gets a list of `TheSeamNgSelectOptionHarness` representing the items in the menu.\n * @param filters Optionally filters which menu items are included.\n */\n async getOptions(\n filters?: Omit<TheSeamNgSelectOptionHarnessFilters, 'ancestor'>,\n ): Promise<TheSeamNgSelectOptionHarness[]> {\n return this.locatorForAll(\n TheSeamNgSelectOptionHarness.with({\n ...(filters || {}),\n } satisfies TheSeamNgSelectOptionHarnessFilters),\n )()\n }\n\n /**\n * Clicks an option in the dropdown.\n * @param optionFilter A filter used to represent which option in the dropdown should be clicked. The\n * first matching dropdown option will be clicked.\n */\n async clickOption(\n optionFilter: Omit<TheSeamNgSelectOptionHarnessFilters, 'ancestor'>,\n ): Promise<void> {\n const options = await this.getOptions(optionFilter)\n if (!options.length) {\n throw Error(\n `Could not find option matching ${JSON.stringify(optionFilter)}`,\n )\n }\n\n return options[0].click()\n }\n}\n","import { coerceBooleanProperty } from '@angular/cdk/coercion'\nimport {\n BaseHarnessFilters,\n ComponentHarness,\n HarnessPredicate,\n} from '@angular/cdk/testing'\n\nimport { TheSeamFormFieldRequiredIndicatorHarness } from '@theseam/ui-common/form-field'\nimport {\n TheSeamNgSelectOptionHarness,\n TheSeamNgSelectOptionHarnessFilters,\n} from './ng-select-option.harness'\nimport {\n TheSeamNgSelectDropdownHarness,\n TheSeamNgSelectDropdownHarnessFilters,\n} from './ng-select-dropdown.harness'\n\n// eslint-disable-next-line @typescript-eslint/no-empty-object-type\nexport interface TheSeamNgSelectHarnessFilters extends BaseHarnessFilters {\n /** Filters based on the name of the field. */\n // name?: string | RegExp\n}\n\nexport class TheSeamNgSelectHarness extends ComponentHarness {\n private _documentRootLocator = this.documentRootLocatorFactory()\n\n static hostSelector = 'ng-select'\n\n private readonly _value = this.locatorForOptional('.ng-value')\n private readonly _valueLabel = this.locatorForOptional('.ng-value-label')\n\n /** Creates a `HarnessPredicate` used to locate a particular `MyMenuHarness`. */\n static with(\n options: TheSeamNgSelectHarnessFilters,\n ): HarnessPredicate<TheSeamNgSelectHarness> {\n return new HarnessPredicate(TheSeamNgSelectHarness, options)\n // .addOption('field name', options.name,\n // (harness, name) => HarnessPredicate.stringMatches(harness.getName(), name))\n }\n\n public async getId(): Promise<string | null> {\n return (await this.getInputElement()).getAttribute('id')\n }\n\n public async getAriaControls(): Promise<string | null> {\n return (await this.getInputElement()).getAttribute('aria-controls')\n }\n\n public async getName(): Promise<string | null> {\n return (await this.getInputElement()).getAttribute('name')\n }\n\n /**\n * NOTE: Only works with string values, curently.\n * @returns value of the select\n */\n public async getValue(): Promise<any> {\n const valueLabel = await this._valueLabel()\n if (valueLabel === null) {\n const value = await this._value()\n if (value === null) {\n return null\n }\n\n return value.text()\n }\n\n return valueLabel.text()\n }\n\n /**\n * Gets a list of `TheSeamNgSelectOptionHarness` representing the options in the dropdown.\n *\n * NOTE: Must open the dropdown first. eg. `await ngSelectHarness.click()`\n *\n * @param filters Optionally filters which menu items are included.\n */\n async getOptions(\n filters?: Omit<TheSeamNgSelectOptionHarnessFilters, 'ancestor'>,\n ): Promise<TheSeamNgSelectOptionHarness[]> {\n const dropdown = await this._getDropdown()\n if (dropdown === null) {\n return []\n }\n\n return dropdown.getOptions(filters)\n }\n\n /**\n * Clicks an option in the dropdown.\n * @param optionFilter A filter used to represent which option in the dropdown should be clicked. The\n * first matching dropdown option will be clicked.\n */\n async clickOption(\n optionFilter: Omit<TheSeamNgSelectOptionHarnessFilters, 'ancestor'>,\n ): Promise<void> {\n await this.click()\n const dropdown = await this._getDropdown()\n if (dropdown === null) {\n throw Error(`Could not find dropdown.`)\n }\n\n return dropdown.clickOption(optionFilter)\n }\n\n /** Whether the ng-select is disabled. */\n async isDisabled(): Promise<boolean> {\n const disabled = (await this.host()).getAttribute('disabled')\n return coerceBooleanProperty(await disabled)\n }\n\n /**\n * Returns the required state of the ng-select.\n *\n * @returns true if the ng-select is required, false if not\n */\n public async isRequired(): Promise<boolean> {\n const required = await (await this.host()).getAttribute('required')\n return required === undefined ? true : coerceBooleanProperty(required)\n }\n\n public async click(): Promise<void> {\n return (await this.getInputElement()).click()\n }\n\n /**\n * Returns the input element of the checkbox.\n *\n * @returns the input element of the checkbox\n */\n public async getInputElement() {\n return this.locatorFor('input')()\n }\n\n private async _getDropdown(): Promise<TheSeamNgSelectDropdownHarness | null> {\n const ariaControls = await this.getAriaControls()\n if (ariaControls) {\n return this._documentRootLocator.locatorForOptional(\n TheSeamNgSelectDropdownHarness.with({\n id: ariaControls,\n } satisfies TheSeamNgSelectDropdownHarnessFilters),\n )()\n }\n return null\n }\n}\n","import {\n ActiveToast,\n GlobalConfig,\n IndividualConfig,\n ToastContainerDirective,\n} from 'ngx-toastr'\n\nexport class FakeToastrService {\n toastrConfig!: GlobalConfig\n currentlyActive = 0\n toasts: ActiveToast<any>[] = []\n overlayContainer!: ToastContainerDirective\n previousToastMessage: string | undefined\n\n /** show toast */\n show(\n message?: string,\n title?: string,\n override: Partial<IndividualConfig> = {},\n type = '',\n ) {}\n\n /** show successful toast */\n success(\n message?: string,\n title?: string,\n override: Partial<IndividualConfig> = {},\n ) {}\n\n /** show error toast */\n error(\n message?: string,\n title?: string,\n override: Partial<IndividualConfig> = {},\n ) {}\n\n /** show info toast */\n info(\n message?: string,\n title?: string,\n override: Partial<IndividualConfig> = {},\n ) {}\n\n /** show warning toast */\n warning(\n message?: string,\n title?: string,\n override: Partial<IndividualConfig> = {},\n ) {}\n\n /**\n * Remove all or a single toast by id\n */\n clear(toastId?: number) {}\n\n /**\n * Remove and destroy a single toast by id\n */\n remove(toastId: number) {}\n\n /**\n * Determines if toast message is already shown\n */\n findDuplicate(\n message: string,\n resetOnDuplicate: boolean,\n countDuplicates: boolean,\n ) {}\n}\n","// import { createMountableStoryComponent } from '@storybook/testing-angular'\nimport { render, RenderResult } from '@testing-library/angular'\n\n// NOTE: This is an experimental attempt at removing some of the boilerplate. If\n// this ends up being worth it, then I will add it to `@storybook/testing-angular`.\nexport async function renderStory<ComponentType = any>(\n story: any,\n): Promise<RenderResult<ComponentType, ComponentType>> {\n // const { component, ngModule } = createMountableStoryComponent(\n // story({}, {} as any)\n // )\n // return await render(component, { imports: [ ngModule ] })\n return null as any\n}\n","import { tick } from '@angular/core/testing'\n\n/**\n * Helps advance tests to specific elapsed times.\n *\n * # When to use\n *\n * If a test needs to do something at 100 ticks, but expected values should\n * also be tested at multiple ticks before 100 ticks, then the previous tick\n * sum needs to be counted. If the elapsed can be easily counted by just\n * skimming the code you should just use `tick()`.\n *\n * The following example is simple enough that `tick()` is probably better, but\n * it shows how it is used.\n *\n * ## Example without\n *\n * ```ts\n * const thing = new Thing()\n * thing.dieAfterTicks(100)\n *\n * tick(25)\n * expect(thing.isAlive).toBe(true)\n *\n * tick(25)\n * expect(thing.isAlive).toBe(true)\n *\n * tick(25)\n * expect(thing.isAlive).toBe(true)\n *\n * tick(25)\n * expect(thing.isAlive).toBe(false)\n * ```\n *\n * ## Example with\n *\n * ```ts\n * const t = new TickHelper()\n * const thing = new Thing()\n * thing.dieAfterTicks(100)\n *\n * t.tickTo(25)\n * expect(thing.isAlive).toBe(true)\n *\n * t.tickTo(50)\n * expect(thing.isAlive).toBe(true)\n *\n * t.tickTo(75)\n * expect(thing.isAlive).toBe(true)\n *\n * t.tickTo(100)\n * expect(thing.isAlive).toBe(false)\n * ```\n */\nexport class TickHelper {\n private _startTime = Date.now()\n\n /**\n * Returns the number of ticks that have elapsed since this class was\n * initialized.\n */\n public get ticksElapsed() {\n return Date.now() - this._startTime\n }\n\n /**\n * Calls `tick()` for the remaining number of ticks to reach elapsed ticks.\n *\n * ```\n * const t = new TickHelper()\n * tick(3)\n * t.tickTo(10) // Equivalent to `tick(7)` in this case to reach 10 ticks.\n * ```\n */\n public tickTo(ticks: number) {\n tick(ticks - this.ticksElapsed)\n }\n}\n","/**\n * When using `fakeAsync` this can access the internal currentTickTime of the\n * fake zone's scheduler.\n *\n * NOTE: Do **NOT** rely on this in tests. It is accesses private properties\n * that could break or change at any time, which could cause it to not have the\n * same meaning and be inaccurate in a future version.\n *\n * NOTE: This is accessing private properties, so I don't recommend relying on\n * this in tests. I find it useful to sometimes set this on a global property\n * that I can observe in the debugger's watch variables.\n */\nexport function currentTickTime(documentWindow: any = window): number {\n return documentWindow.Zone.current._properties.FakeAsyncTestZoneSpec\n ._scheduler._currentTickTime\n}\n","import {\n ComponentHarness,\n ComponentHarnessConstructor,\n HarnessQuery,\n} from '@angular/cdk/testing'\nimport { TestbedHarnessEnvironment } from '@angular/cdk/testing/testbed'\nimport { ComponentFixture } from '@angular/core/testing'\n\nimport { StorybookHarnessEnvironment } from '@marklb/storybook-harness'\n\nexport interface GetHarnessOptions<TComponent = any> {\n canvasElement?: HTMLElement\n fixture?: ComponentFixture<TComponent>\n}\n\nexport async function getHarness<T extends ComponentHarness>(\n harnessType: HarnessQuery<T>,\n options: GetHarnessOptions,\n): Promise<T> {\n if (options.fixture !== undefined) {\n if (isComponentHarnessConstructor(harnessType)) {\n return TestbedHarnessEnvironment.harnessForFixture(\n options.fixture,\n harnessType,\n )\n }\n throw Error(\n `Unable to get harness. harnessType must be a ComponentHarness.`,\n )\n }\n\n if (options.canvasElement !== undefined) {\n return new StorybookHarnessEnvironment(options.canvasElement).getHarness(\n harnessType,\n )\n }\n\n throw Error(\n `Unable to get harness. fixture or canvasElement must be provided.`,\n )\n}\n\nfunction isComponentHarnessConstructor<T extends ComponentHarness>(\n value: HarnessQuery<T>,\n): value is ComponentHarnessConstructor<T> {\n return (\n typeof value === 'function' &&\n Object.prototype.hasOwnProperty.call(value, 'hostSelector')\n )\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;AAaM,MAAO,4BAA6B,SAAQ,gBAAgB,CAAA;AAChE,IAAA,OAAO,YAAY,GAAG,YAAY;;IAGlC,OAAO,IAAI,CACT,OAA4C,EAAA;AAE5C,QAAA,OAAO,IAAI,gBAAgB,CACzB,4BAA4B,EAC5B,OAAO,CACR,CAAC,SAAS,CAAC,cAAc,EAAE,OAAO,CAAC,KAAK,EAAE,CAAC,OAAO,EAAE,KAAK,KACxD,gBAAgB,CAAC,aAAa,CAAC,OAAO,CAAC,QAAQ,EAAE,EAAE,KAAK,CAAC,CAC1D;IACH;AAEA;;;AAGG;AACI,IAAA,MAAM,QAAQ,GAAA;QACnB,OAAO,CAAC,MAAM,IAAI,CAAC,IAAI,EAAE,EAAE,IAAI,EAAE;IACnC;;AAGA,IAAA,MAAM,UAAU,GAAA;AACd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AAA,MAAM,CAAC,KAAa,EAAA;AACzB,QAAA,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,YAAY,CAAC;IACjC;AACD;;AC7ED;;;;;;;;;;;AAWG;AACG,SAAU,eAAe,CAAC,cAAA,GAAsB,MAAM,EAAA;IAC1D,OAAO,cAAc,CAAC,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC;SAC5C,UAAU,CAAC,gBAAgB;AAChC;;ACAO,eAAe,UAAU,CAC9B,WAA4B,EAC5B,OAA0B,EAAA;AAE1B,IAAA,IAAI,OAAO,CAAC,OAAO,KAAK,SAAS,EAAE;AACjC,QAAA,IAAI,6BAA6B,CAAC,WAAW,CAAC,EAAE;YAC9C,OAAO,yBAAyB,CAAC,iBAAiB,CAChD,OAAO,CAAC,OAAO,EACf,WAAW,CACZ;QACH;AACA,QAAA,MAAM,KAAK,CACT,CAAA,8DAAA,CAAgE,CACjE;IACH;AAEA,IAAA,IAAI,OAAO,CAAC,aAAa,KAAK,SAAS,EAAE;AACvC,QAAA,OAAO,IAAI,2BAA2B,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC,UAAU,CACtE,WAAW,CACZ;IACH;AAEA,IAAA,MAAM,KAAK,CACT,CAAA,iEAAA,CAAmE,CACpE;AACH;AAEA,SAAS,6BAA6B,CACpC,KAAsB,EAAA;AAEtB,IAAA,QACE,OAAO,KAAK,KAAK,UAAU;AAC3B,QAAA,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,KAAK,EAAE,cAAc,CAAC;AAE/D;;ACjDA;;AAEG;;;;"}
1
+ {"version":3,"file":"theseam-ui-common-testing.mjs","sources":["../../../projects/ui-common/testing/harnesses/ng-select-option.harness.ts","../../../projects/ui-common/testing/harnesses/ng-select-dropdown.harness.ts","../../../projects/ui-common/testing/harnesses/ng-select.harness.ts","../../../projects/ui-common/testing/mock-toastr.ts","../../../projects/ui-common/testing/render-story.ts","../../../projects/ui-common/testing/tick-helper.ts","../../../projects/ui-common/testing/current-tick-time.ts","../../../projects/ui-common/testing/get-harness.ts","../../../projects/ui-common/testing/theseam-ui-common-testing.ts"],"sourcesContent":["import { coerceBooleanProperty } from '@angular/cdk/coercion'\nimport {\n BaseHarnessFilters,\n ComponentHarness,\n HarnessPredicate,\n} from '@angular/cdk/testing'\n\nexport interface TheSeamNgSelectOptionHarnessFilters\n extends BaseHarnessFilters {\n /** Filters based on the rendered text of the option. */\n label?: string | RegExp\n}\n\nexport class TheSeamNgSelectOptionHarness extends ComponentHarness {\n static hostSelector = '.ng-option'\n\n /** Creates a `HarnessPredicate` used to locate a particular `TheSeamNgSelectOptionHarness`. */\n static with(\n options: TheSeamNgSelectOptionHarnessFilters,\n ): HarnessPredicate<TheSeamNgSelectOptionHarness> {\n return new HarnessPredicate(\n TheSeamNgSelectOptionHarness,\n options,\n ).addOption('option label', options.label, (harness, label) =>\n HarnessPredicate.stringMatches(harness.getLabel(), label),\n )\n }\n\n /**\n * Gets the rendered text of the option.\n *\n * Note: this returns the displayed label, not the bound value.\n */\n public async getLabel(): Promise<string> {\n return (await this.host()).text()\n }\n\n /** Whether the option is disabled. */\n async isDisabled(): Promise<boolean> {\n const disabled = (await this.host()).getAttribute('disabled')\n return coerceBooleanProperty(await disabled)\n }\n\n public async click(): Promise<void> {\n return (await this.host()).click()\n }\n}\n","import { coerceBooleanProperty } from '@angular/cdk/coercion'\nimport {\n BaseHarnessFilters,\n ComponentHarness,\n HarnessPredicate,\n} from '@angular/cdk/testing'\n\nimport { TheSeamFormFieldRequiredIndicatorHarness } from '@theseam/ui-common/form-field'\nimport {\n TheSeamNgSelectOptionHarness,\n TheSeamNgSelectOptionHarnessFilters,\n} from './ng-select-option.harness'\n\nexport interface TheSeamNgSelectDropdownHarnessFilters\n extends BaseHarnessFilters {\n /** Filters based on the name of the field. */\n id?: string | RegExp\n}\n\nexport class TheSeamNgSelectDropdownHarness extends ComponentHarness {\n static hostSelector = 'ng-dropdown-panel'\n\n // private readonly _ngSelect = this.locatorFor(TheSeamNgSelectDropdownHarness)\n // private readonly _requiredIndicator = this.locatorFor(TheSeamFormFieldRequiredIndicatorHarness)\n // private readonly _valueLabel = this.locatorForOptional('.ng-value-label')\n // private readonly _options = this.locatorForOptional(TheSeamNgSelectOptionHarness)\n\n /** Creates a `HarnessPredicate` used to locate a particular `MyMenuHarness`. */\n static with(\n options: TheSeamNgSelectDropdownHarnessFilters,\n ): HarnessPredicate<TheSeamNgSelectDropdownHarness> {\n return new HarnessPredicate(\n TheSeamNgSelectDropdownHarness,\n options,\n ).addOption('field id', options.id, (harness, id) =>\n HarnessPredicate.stringMatches(harness.getId(), id),\n )\n }\n\n public async getId(): Promise<string | null> {\n return (await this.host()).getAttribute('id')\n }\n\n /**\n * Gets a list of `TheSeamNgSelectOptionHarness` representing the items in the menu.\n * @param filters Optionally filters which menu items are included.\n */\n async getOptions(\n filters?: Omit<TheSeamNgSelectOptionHarnessFilters, 'ancestor'>,\n ): Promise<TheSeamNgSelectOptionHarness[]> {\n return this.locatorForAll(\n TheSeamNgSelectOptionHarness.with({\n ...(filters || {}),\n } satisfies TheSeamNgSelectOptionHarnessFilters),\n )()\n }\n\n /**\n * Clicks an option in the dropdown.\n * @param optionFilter A filter used to represent which option in the dropdown should be clicked. The\n * first matching dropdown option will be clicked.\n */\n async clickOption(\n optionFilter: Omit<TheSeamNgSelectOptionHarnessFilters, 'ancestor'>,\n ): Promise<void> {\n const options = await this.getOptions(optionFilter)\n if (!options.length) {\n throw Error(\n `Could not find option matching ${JSON.stringify(optionFilter)}`,\n )\n }\n\n return options[0].click()\n }\n}\n","import { coerceBooleanProperty } from '@angular/cdk/coercion'\nimport {\n BaseHarnessFilters,\n ComponentHarness,\n HarnessPredicate,\n} from '@angular/cdk/testing'\n\nimport { TheSeamFormFieldRequiredIndicatorHarness } from '@theseam/ui-common/form-field'\nimport {\n TheSeamNgSelectOptionHarness,\n TheSeamNgSelectOptionHarnessFilters,\n} from './ng-select-option.harness'\nimport {\n TheSeamNgSelectDropdownHarness,\n TheSeamNgSelectDropdownHarnessFilters,\n} from './ng-select-dropdown.harness'\n\n// eslint-disable-next-line @typescript-eslint/no-empty-object-type\nexport interface TheSeamNgSelectHarnessFilters extends BaseHarnessFilters {\n /** Filters based on the name of the field. */\n // name?: string | RegExp\n}\n\nexport class TheSeamNgSelectHarness extends ComponentHarness {\n private _documentRootLocator = this.documentRootLocatorFactory()\n\n static hostSelector = 'ng-select'\n\n private readonly _value = this.locatorForOptional('.ng-value')\n private readonly _valueLabel = this.locatorForOptional('.ng-value-label')\n\n /** Creates a `HarnessPredicate` used to locate a particular `MyMenuHarness`. */\n static with(\n options: TheSeamNgSelectHarnessFilters,\n ): HarnessPredicate<TheSeamNgSelectHarness> {\n return new HarnessPredicate(TheSeamNgSelectHarness, options)\n // .addOption('field name', options.name,\n // (harness, name) => HarnessPredicate.stringMatches(harness.getName(), name))\n }\n\n public async getId(): Promise<string | null> {\n return (await this.getInputElement()).getAttribute('id')\n }\n\n public async getAriaControls(): Promise<string | null> {\n return (await this.getInputElement()).getAttribute('aria-controls')\n }\n\n public async getName(): Promise<string | null> {\n return (await this.getInputElement()).getAttribute('name')\n }\n\n /**\n * NOTE: Only works with string values, curently.\n * @returns value of the select\n */\n public async getValue(): Promise<any> {\n const valueLabel = await this._valueLabel()\n if (valueLabel === null) {\n const value = await this._value()\n if (value === null) {\n return null\n }\n\n return value.text()\n }\n\n return valueLabel.text()\n }\n\n /**\n * Gets a list of `TheSeamNgSelectOptionHarness` representing the options in the dropdown.\n *\n * NOTE: Must open the dropdown first. eg. `await ngSelectHarness.click()`\n *\n * @param filters Optionally filters which menu items are included.\n */\n async getOptions(\n filters?: Omit<TheSeamNgSelectOptionHarnessFilters, 'ancestor'>,\n ): Promise<TheSeamNgSelectOptionHarness[]> {\n const dropdown = await this._getDropdown()\n if (dropdown === null) {\n return []\n }\n\n return dropdown.getOptions(filters)\n }\n\n /**\n * Clicks an option in the dropdown.\n * @param optionFilter A filter used to represent which option in the dropdown should be clicked. The\n * first matching dropdown option will be clicked.\n */\n async clickOption(\n optionFilter: Omit<TheSeamNgSelectOptionHarnessFilters, 'ancestor'>,\n ): Promise<void> {\n await this.click()\n const dropdown = await this._getDropdown()\n if (dropdown === null) {\n throw Error(`Could not find dropdown.`)\n }\n\n return dropdown.clickOption(optionFilter)\n }\n\n /** Whether the ng-select is disabled. */\n async isDisabled(): Promise<boolean> {\n const disabled = (await this.host()).getAttribute('disabled')\n return coerceBooleanProperty(await disabled)\n }\n\n /**\n * Returns the required state of the ng-select.\n *\n * @returns true if the ng-select is required, false if not\n */\n public async isRequired(): Promise<boolean> {\n const required = await (await this.host()).getAttribute('required')\n return required === undefined ? true : coerceBooleanProperty(required)\n }\n\n public async click(): Promise<void> {\n return (await this.getInputElement()).click()\n }\n\n /**\n * Returns the input element of the checkbox.\n *\n * @returns the input element of the checkbox\n */\n public async getInputElement() {\n return this.locatorFor('input')()\n }\n\n private async _getDropdown(): Promise<TheSeamNgSelectDropdownHarness | null> {\n const ariaControls = await this.getAriaControls()\n if (ariaControls) {\n return this._documentRootLocator.locatorForOptional(\n TheSeamNgSelectDropdownHarness.with({\n id: ariaControls,\n } satisfies TheSeamNgSelectDropdownHarnessFilters),\n )()\n }\n return null\n }\n}\n","import { Provider } from '@angular/core'\nimport {\n ActiveToast,\n GlobalConfig,\n IndividualConfig,\n ToastContainerDirective,\n ToastrService,\n} from 'ngx-toastr'\n\nexport class MockToastrService {\n toastrConfig!: GlobalConfig\n currentlyActive = 0\n toasts: ActiveToast<any>[] = []\n overlayContainer!: ToastContainerDirective\n previousToastMessage: string | undefined\n\n /** show toast */\n show(\n message?: string,\n title?: string,\n override: Partial<IndividualConfig> = {},\n type = '',\n ) {}\n\n /** show successful toast */\n success(\n message?: string,\n title?: string,\n override: Partial<IndividualConfig> = {},\n ) {}\n\n /** show error toast */\n error(\n message?: string,\n title?: string,\n override: Partial<IndividualConfig> = {},\n ) {}\n\n /** show info toast */\n info(\n message?: string,\n title?: string,\n override: Partial<IndividualConfig> = {},\n ) {}\n\n /** show warning toast */\n warning(\n message?: string,\n title?: string,\n override: Partial<IndividualConfig> = {},\n ) {}\n\n /**\n * Remove all or a single toast by id\n */\n clear(toastId?: number) {}\n\n /**\n * Remove and destroy a single toast by id\n */\n remove(toastId: number) {}\n\n /**\n * Determines if toast message is already shown\n */\n findDuplicate(\n message: string,\n resetOnDuplicate: boolean,\n countDuplicates: boolean,\n ) {}\n}\n\nexport function provideMockToastrService(): Provider {\n return { provide: ToastrService, useClass: MockToastrService }\n}\n","// import { createMountableStoryComponent } from '@storybook/testing-angular'\nimport { render, RenderResult } from '@testing-library/angular'\n\n// NOTE: This is an experimental attempt at removing some of the boilerplate. If\n// this ends up being worth it, then I will add it to `@storybook/testing-angular`.\nexport async function renderStory<ComponentType = any>(\n story: any,\n): Promise<RenderResult<ComponentType, ComponentType>> {\n // const { component, ngModule } = createMountableStoryComponent(\n // story({}, {} as any)\n // )\n // return await render(component, { imports: [ ngModule ] })\n return null as any\n}\n","import { tick } from '@angular/core/testing'\n\n/**\n * Helps advance tests to specific elapsed times.\n *\n * # When to use\n *\n * If a test needs to do something at 100 ticks, but expected values should\n * also be tested at multiple ticks before 100 ticks, then the previous tick\n * sum needs to be counted. If the elapsed can be easily counted by just\n * skimming the code you should just use `tick()`.\n *\n * The following example is simple enough that `tick()` is probably better, but\n * it shows how it is used.\n *\n * ## Example without\n *\n * ```ts\n * const thing = new Thing()\n * thing.dieAfterTicks(100)\n *\n * tick(25)\n * expect(thing.isAlive).toBe(true)\n *\n * tick(25)\n * expect(thing.isAlive).toBe(true)\n *\n * tick(25)\n * expect(thing.isAlive).toBe(true)\n *\n * tick(25)\n * expect(thing.isAlive).toBe(false)\n * ```\n *\n * ## Example with\n *\n * ```ts\n * const t = new TickHelper()\n * const thing = new Thing()\n * thing.dieAfterTicks(100)\n *\n * t.tickTo(25)\n * expect(thing.isAlive).toBe(true)\n *\n * t.tickTo(50)\n * expect(thing.isAlive).toBe(true)\n *\n * t.tickTo(75)\n * expect(thing.isAlive).toBe(true)\n *\n * t.tickTo(100)\n * expect(thing.isAlive).toBe(false)\n * ```\n */\nexport class TickHelper {\n private _startTime = Date.now()\n\n /**\n * Returns the number of ticks that have elapsed since this class was\n * initialized.\n */\n public get ticksElapsed() {\n return Date.now() - this._startTime\n }\n\n /**\n * Calls `tick()` for the remaining number of ticks to reach elapsed ticks.\n *\n * ```\n * const t = new TickHelper()\n * tick(3)\n * t.tickTo(10) // Equivalent to `tick(7)` in this case to reach 10 ticks.\n * ```\n */\n public tickTo(ticks: number) {\n tick(ticks - this.ticksElapsed)\n }\n}\n","/**\n * When using `fakeAsync` this can access the internal currentTickTime of the\n * fake zone's scheduler.\n *\n * NOTE: Do **NOT** rely on this in tests. It is accesses private properties\n * that could break or change at any time, which could cause it to not have the\n * same meaning and be inaccurate in a future version.\n *\n * NOTE: This is accessing private properties, so I don't recommend relying on\n * this in tests. I find it useful to sometimes set this on a global property\n * that I can observe in the debugger's watch variables.\n */\nexport function currentTickTime(documentWindow: any = window): number {\n return documentWindow.Zone.current._properties.FakeAsyncTestZoneSpec\n ._scheduler._currentTickTime\n}\n","import {\n ComponentHarness,\n ComponentHarnessConstructor,\n HarnessQuery,\n} from '@angular/cdk/testing'\nimport { TestbedHarnessEnvironment } from '@angular/cdk/testing/testbed'\nimport { ComponentFixture } from '@angular/core/testing'\n\nimport { StorybookHarnessEnvironment } from '@marklb/storybook-harness'\n\nexport interface GetHarnessOptions<TComponent = any> {\n canvasElement?: HTMLElement\n fixture?: ComponentFixture<TComponent>\n}\n\nexport async function getHarness<T extends ComponentHarness>(\n harnessType: HarnessQuery<T>,\n options: GetHarnessOptions,\n): Promise<T> {\n if (options.fixture !== undefined) {\n if (isComponentHarnessConstructor(harnessType)) {\n return TestbedHarnessEnvironment.harnessForFixture(\n options.fixture,\n harnessType,\n )\n }\n throw Error(\n `Unable to get harness. harnessType must be a ComponentHarness.`,\n )\n }\n\n if (options.canvasElement !== undefined) {\n return new StorybookHarnessEnvironment(options.canvasElement).getHarness(\n harnessType,\n )\n }\n\n throw Error(\n `Unable to get harness. fixture or canvasElement must be provided.`,\n )\n}\n\nfunction isComponentHarnessConstructor<T extends ComponentHarness>(\n value: HarnessQuery<T>,\n): value is ComponentHarnessConstructor<T> {\n return (\n typeof value === 'function' &&\n Object.prototype.hasOwnProperty.call(value, 'hostSelector')\n )\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;AAaM,MAAO,4BAA6B,SAAQ,gBAAgB,CAAA;AAChE,IAAA,OAAO,YAAY,GAAG,YAAY;;IAGlC,OAAO,IAAI,CACT,OAA4C,EAAA;AAE5C,QAAA,OAAO,IAAI,gBAAgB,CACzB,4BAA4B,EAC5B,OAAO,CACR,CAAC,SAAS,CAAC,cAAc,EAAE,OAAO,CAAC,KAAK,EAAE,CAAC,OAAO,EAAE,KAAK,KACxD,gBAAgB,CAAC,aAAa,CAAC,OAAO,CAAC,QAAQ,EAAE,EAAE,KAAK,CAAC,CAC1D;IACH;AAEA;;;;AAIG;AACI,IAAA,MAAM,QAAQ,GAAA;QACnB,OAAO,CAAC,MAAM,IAAI,CAAC,IAAI,EAAE,EAAE,IAAI,EAAE;IACnC;;AAGA,IAAA,MAAM,UAAU,GAAA;AACd,QAAA,MAAM,QAAQ,GAAG,CAAC,MAAM,IAAI,CAAC,IAAI,EAAE,EAAE,YAAY,CAAC,UAAU,CAAC;AAC7D,QAAA,OAAO,qBAAqB,CAAC,MAAM,QAAQ,CAAC;IAC9C;AAEO,IAAA,MAAM,KAAK,GAAA;QAChB,OAAO,CAAC,MAAM,IAAI,CAAC,IAAI,EAAE,EAAE,KAAK,EAAE;IACpC;;;AC1BI,MAAO,8BAA+B,SAAQ,gBAAgB,CAAA;AAClE,IAAA,OAAO,YAAY,GAAG,mBAAmB;;;;;;IAQzC,OAAO,IAAI,CACT,OAA8C,EAAA;AAE9C,QAAA,OAAO,IAAI,gBAAgB,CACzB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AAE1B,IAAA,IAAI,OAAO,CAAC,OAAO,KAAK,SAAS,EAAE;AACjC,QAAA,IAAI,6BAA6B,CAAC,WAAW,CAAC,EAAE;YAC9C,OAAO,yBAAyB,CAAC,iBAAiB,CAChD,OAAO,CAAC,OAAO,EACf,WAAW,CACZ;QACH;AACA,QAAA,MAAM,KAAK,CACT,CAAA,8DAAA,CAAgE,CACjE;IACH;AAEA,IAAA,IAAI,OAAO,CAAC,aAAa,KAAK,SAAS,EAAE;AACvC,QAAA,OAAO,IAAI,2BAA2B,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC,UAAU,CACtE,WAAW,CACZ;IACH;AAEA,IAAA,MAAM,KAAK,CACT,CAAA,iEAAA,CAAmE,CACpE;AACH;AAEA,SAAS,6BAA6B,CACpC,KAAsB,EAAA;AAEtB,IAAA,QACE,OAAO,KAAK,KAAK,UAAU;AAC3B,QAAA,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,KAAK,EAAE,cAAc,CAAC;AAE/D;;ACjDA;;AAEG;;;;"}
@@ -124,7 +124,7 @@ declare class GQLVariable {
124
124
  constructor(name: string, type: string);
125
125
  }
126
126
 
127
- type GqlDatatableAccessor = Pick<DatatableComponent, 'page' | 'sort' | 'sorts' | 'filterStates' | 'resize' | 'pageInfo' | 'externalSorting'> & {
127
+ type GqlDatatableAccessor = Pick<DatatableComponent, 'page' | 'sort' | 'sorts' | 'filterStates' | 'pageInfo' | 'externalSorting'> & {
128
128
  ngxDatatable: {
129
129
  offset: number;
130
130
  pageSize: number;
@@ -1,12 +1,40 @@
1
+ import { Observable } from 'rxjs';
1
2
  import * as i0 from '@angular/core';
2
- import { EnvironmentProviders } from '@angular/core';
3
+ import { Provider, EnvironmentProviders } from '@angular/core';
4
+ import { BaseHarnessFilters, ContentContainerComponentHarness, ComponentHarnessConstructor, HarnessPredicate } from '@angular/cdk/testing';
3
5
  import { NgxLoadingConfig, INgxLoadingConfig } from 'ngx-loading';
4
6
  import * as i2 from '@angular/cdk/overlay';
5
7
  import * as i3 from '@angular/cdk/portal';
6
- import { Observable } from 'rxjs';
8
+
9
+ declare class MockTheSeamLoadingOverlayService {
10
+ private _enabled;
11
+ get enabled(): boolean;
12
+ toggle(enabled?: boolean): void;
13
+ enable(): void;
14
+ disable(): void;
15
+ while(source: Observable<any>): Observable<any>;
16
+ }
17
+ declare function provideMockLoadingService(): Provider;
7
18
 
8
19
  type TheSeamLoadingTheme = 'default' | 'primary';
9
20
 
21
+ /** A set of criteria that can be used to filter a list of `TheSeamLoadingComponentHarness` instances. */
22
+ interface TheSeamLoadingComponentHarnessFilters extends BaseHarnessFilters {
23
+ }
24
+ declare class TheSeamLoadingComponentHarness extends ContentContainerComponentHarness<string> {
25
+ /** The selector for the host element of a `TheSeamLoadingComponent` instance. */
26
+ static hostSelector: string;
27
+ private readonly _backdropElement;
28
+ /**
29
+ * Gets a `HarnessPredicate` that can be used to search for a menu item with specific attributes.
30
+ * @param options Options for filtering which menu item instances are considered a match.
31
+ * @return a `HarnessPredicate` configured with the given options.
32
+ */
33
+ static with<T extends TheSeamLoadingComponentHarness>(this: ComponentHarnessConstructor<T>, options?: TheSeamLoadingComponentHarnessFilters): HarnessPredicate<T>;
34
+ /** Gets the theme. */
35
+ getTheme(): Promise<TheSeamLoadingTheme>;
36
+ }
37
+
10
38
  declare class TheSeamLoadingComponent {
11
39
  set theme(value: TheSeamLoadingTheme);
12
40
  _theme: NgxLoadingConfig;
@@ -38,5 +66,5 @@ declare const primaryThemeConfig: NgxLoadingConfig;
38
66
 
39
67
  declare function provideTheSeamLoading(loadingConfig?: INgxLoadingConfig): EnvironmentProviders;
40
68
 
41
- export { TheSeamLoadingComponent, TheSeamLoadingModule, TheSeamLoadingOverlayService, defaultThemeConfig, primaryThemeConfig, provideTheSeamLoading };
42
- export type { TheSeamLoadingTheme };
69
+ export { MockTheSeamLoadingOverlayService, TheSeamLoadingComponent, TheSeamLoadingComponentHarness, TheSeamLoadingModule, TheSeamLoadingOverlayService, defaultThemeConfig, primaryThemeConfig, provideMockLoadingService, provideTheSeamLoading };
70
+ export type { TheSeamLoadingComponentHarnessFilters, TheSeamLoadingTheme };
package/menu/index.d.ts CHANGED
@@ -155,6 +155,12 @@ declare class TheSeamMenuItemHarness extends ContentContainerComponentHarness<st
155
155
  click(): Promise<void>;
156
156
  /** Hovers the menu item. */
157
157
  hover(): Promise<void>;
158
+ /** Whether this item is rendered as a link (`<a>`) rather than a `<button>`. */
159
+ isLink(): Promise<boolean>;
160
+ /** Gets the `href` attribute, or `null` if not a link. */
161
+ getHref(): Promise<string | null>;
162
+ /** Gets the `target` attribute (e.g. `_blank`), or `null` if not set. */
163
+ getTarget(): Promise<string | null>;
158
164
  /** Whether this item has a submenu. */
159
165
  hasSubmenu(): Promise<boolean>;
160
166
  /** Gets the submenu associated with this menu item, or null if none. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@theseam/ui-common",
3
- "version": "1.0.2-beta.17",
3
+ "version": "1.0.2-beta.23",
4
4
  "peerDependencies": {
5
5
  "@angular/cdk": "^20.2.3",
6
6
  "@angular/common": "^20.3.0",
@@ -7,7 +7,6 @@ import { ComponentType } from '@theseam/ui-common/models';
7
7
  import * as i3 from '@angular/common';
8
8
  import * as i4 from '@angular/router';
9
9
  import * as i5 from '@theseam/ui-common/scrollbar';
10
- import { GlobalConfig, ActiveToast, ToastContainerDirective, IndividualConfig } from 'ngx-toastr';
11
10
  import { TheSeamPreferencesAccessor } from '@theseam/ui-common/services';
12
11
  import { AngularRenderer } from '@storybook/angular';
13
12
  import { DecoratorFunction } from 'storybook/internal/csf';
@@ -110,38 +109,6 @@ declare class StoryInitialRouteService {
110
109
 
111
110
  declare function storyInitialRouteFactory(_storyInitialRouteService: StoryInitialRouteService): () => void;
112
111
 
113
- declare class StoryToastrService {
114
- toastrConfig?: GlobalConfig;
115
- currentlyActive: number;
116
- toasts: ActiveToast<any>[];
117
- overlayContainer?: ToastContainerDirective;
118
- previousToastMessage: string | undefined;
119
- /** show toast */
120
- show(message?: string, title?: string, override?: Partial<IndividualConfig>, type?: string): void;
121
- /** show successful toast */
122
- success(message?: string, title?: string, override?: Partial<IndividualConfig>): void;
123
- /** show error toast */
124
- error(message?: string, title?: string, override?: Partial<IndividualConfig>): void;
125
- /** show info toast */
126
- info(message?: string, title?: string, override?: Partial<IndividualConfig>): void;
127
- /** show warning toast */
128
- warning(message?: string, title?: string, override?: Partial<IndividualConfig>): void;
129
- /**
130
- * Remove all or a single toast by id
131
- */
132
- clear(toastId?: number): void;
133
- /**
134
- * Remove and destroy a single toast by id
135
- */
136
- remove(toastId: number): void;
137
- /**
138
- * Determines if toast message is already shown
139
- */
140
- findDuplicate(message: string, resetOnDuplicate: boolean, countDuplicates: boolean): void;
141
- static ɵfac: i0.ɵɵFactoryDeclaration<StoryToastrService, never>;
142
- static ɵprov: i0.ɵɵInjectableDeclaration<StoryToastrService>;
143
- }
144
-
145
112
  /**
146
113
  * Can be used to trigger an event on a target element when the story component has been bootstrapped.
147
114
  *
@@ -190,5 +157,5 @@ declare const INJECTOR_TO_ARGS_PROPERTY_NAME = "__getInjector";
190
157
  declare const addInjectorGetterToArgs: (argName?: string) => DecoratorFunction<AngularRenderer>;
191
158
  declare const getInjectorFromArgs: (args: any, argName?: string) => Injector;
192
159
 
193
- export { INJECTOR_TO_ARGS_PROPERTY_NAME, STORY_INITIAL_ROUTE_URL, StoryEmptyComponent, StoryEmptyWithRouteComponent, StoryHelperComponentsModule, StoryInitialRouteModule, StoryInitialRouteService, StoryModalContainerComponent, StoryPreferencesAccessorService, StoryToastrService, addInjectorGetterToArgs, argsToTpl, buttonTypeArgType, getInjectorFromArgs, onStoryBootstrappedTrigger, routeButton, routesArgType, sizeArgType, storyInitialRouteFactory, themeArgType, themeWithOutlineArgType };
160
+ export { INJECTOR_TO_ARGS_PROPERTY_NAME, STORY_INITIAL_ROUTE_URL, StoryEmptyComponent, StoryEmptyWithRouteComponent, StoryHelperComponentsModule, StoryInitialRouteModule, StoryInitialRouteService, StoryModalContainerComponent, StoryPreferencesAccessorService, addInjectorGetterToArgs, argsToTpl, buttonTypeArgType, getInjectorFromArgs, onStoryBootstrappedTrigger, routeButton, routesArgType, sizeArgType, storyInitialRouteFactory, themeArgType, themeWithOutlineArgType };
194
161
  export type { ArgsTplOptions, ArgsTplParts };
@@ -1,23 +1,25 @@
1
1
  import * as _angular_cdk_testing from '@angular/cdk/testing';
2
2
  import { BaseHarnessFilters, ComponentHarness, HarnessPredicate, HarnessQuery } from '@angular/cdk/testing';
3
+ import { Provider } from '@angular/core';
3
4
  import { GlobalConfig, ActiveToast, ToastContainerDirective, IndividualConfig } from 'ngx-toastr';
4
5
  import { RenderResult } from '@testing-library/angular';
5
6
  import { ComponentFixture } from '@angular/core/testing';
6
7
 
7
8
  interface TheSeamNgSelectOptionHarnessFilters extends BaseHarnessFilters {
8
- /** Filters based on the value of the field. */
9
- value?: string | RegExp;
9
+ /** Filters based on the rendered text of the option. */
10
+ label?: string | RegExp;
10
11
  }
11
12
  declare class TheSeamNgSelectOptionHarness extends ComponentHarness {
12
13
  static hostSelector: string;
13
- /** Creates a `HarnessPredicate` used to locate a particular `MyMenuHarness`. */
14
+ /** Creates a `HarnessPredicate` used to locate a particular `TheSeamNgSelectOptionHarness`. */
14
15
  static with(options: TheSeamNgSelectOptionHarnessFilters): HarnessPredicate<TheSeamNgSelectOptionHarness>;
15
16
  /**
16
- * NOTE: Only works with string values, curently.
17
- * @returns value of the select option
17
+ * Gets the rendered text of the option.
18
+ *
19
+ * Note: this returns the displayed label, not the bound value.
18
20
  */
19
- getValue(): Promise<any>;
20
- /** Whether the ng-select is disabled. */
21
+ getLabel(): Promise<string>;
22
+ /** Whether the option is disabled. */
21
23
  isDisabled(): Promise<boolean>;
22
24
  click(): Promise<void>;
23
25
  }
@@ -93,7 +95,7 @@ declare class TheSeamNgSelectHarness extends ComponentHarness {
93
95
  private _getDropdown;
94
96
  }
95
97
 
96
- declare class FakeToastrService {
98
+ declare class MockToastrService {
97
99
  toastrConfig: GlobalConfig;
98
100
  currentlyActive: number;
99
101
  toasts: ActiveToast<any>[];
@@ -122,6 +124,7 @@ declare class FakeToastrService {
122
124
  */
123
125
  findDuplicate(message: string, resetOnDuplicate: boolean, countDuplicates: boolean): void;
124
126
  }
127
+ declare function provideMockToastrService(): Provider;
125
128
 
126
129
  declare function renderStory<ComponentType = any>(story: any): Promise<RenderResult<ComponentType, ComponentType>>;
127
130
 
@@ -216,5 +219,5 @@ interface GetHarnessOptions<TComponent = any> {
216
219
  }
217
220
  declare function getHarness<T extends ComponentHarness>(harnessType: HarnessQuery<T>, options: GetHarnessOptions): Promise<T>;
218
221
 
219
- export { FakeToastrService, TheSeamNgSelectDropdownHarness, TheSeamNgSelectHarness, TheSeamNgSelectOptionHarness, TickHelper, currentTickTime, getHarness, renderStory };
222
+ export { MockToastrService, TheSeamNgSelectDropdownHarness, TheSeamNgSelectHarness, TheSeamNgSelectOptionHarness, TickHelper, currentTickTime, getHarness, provideMockToastrService, renderStory };
220
223
  export type { GetHarnessOptions, TheSeamNgSelectDropdownHarnessFilters, TheSeamNgSelectHarnessFilters, TheSeamNgSelectOptionHarnessFilters };