diff --git a/package.json b/package.json index 6379ed8d4..3c6f09945 100644 --- a/package.json +++ b/package.json @@ -125,13 +125,13 @@ "gulp": "^4.0.2", "gulp-tap": "^2.0.0", "husky": "^8.0.0", - "jasmine-core": "~5.1.1", - "jasmine-spec-reporter": "~7.0.0", - "karma": "~6.4.2", - "karma-chrome-launcher": "~3.2.0", - "karma-coverage": "~2.2.1", - "karma-jasmine": "~5.1.0", - "karma-jasmine-html-reporter": "^2.1.0", + "jasmine-core": "5.1.1", + "jasmine-spec-reporter": "7.0.0", + "karma": "6.4.2", + "karma-chrome-launcher": "3.2.0", + "karma-coverage": "2.2.1", + "karma-jasmine": "5.1.0", + "karma-jasmine-html-reporter": "2.1.0", "lint-staged": "^15.1.0", "mkdirp": "3.0.1", "ng-packagr": "~18.0.0", diff --git a/projects/ui/karma.conf.js b/projects/ui/karma.conf.js index b21c22fd3..7a3b6d7f9 100644 --- a/projects/ui/karma.conf.js +++ b/projects/ui/karma.conf.js @@ -4,6 +4,10 @@ module.exports = function (config) { config.set({ basePath: '', + files: [ + { pattern: './src/lib/util-test/util-setup.spec.ts', watched: false, type: 'js' }, + { pattern: './src/**/*.spec.ts', watched: false, type: 'js' } + ], frameworks: ['jasmine', '@angular-devkit/build-angular'], plugins: [ require('karma-jasmine'), @@ -52,7 +56,7 @@ module.exports = function (config) { flags: ['--no-sandbox', '--headless', '--disable-gpu', '--disable-web-security', '--remote-debugging-port=9222'] } }, - singleRun: false, + singleRun: true, restartOnFileChange: true, browserNoActivityTimeout: 50000, browserDisconnectTimeout: 50000 diff --git a/projects/ui/src/lib/components/po-chart/directives/po-resize-observer.directive.spec.ts b/projects/ui/src/lib/components/po-chart/directives/po-resize-observer.directive.spec.ts index 7a0b3ad4f..9bd0ef9c8 100644 --- a/projects/ui/src/lib/components/po-chart/directives/po-resize-observer.directive.spec.ts +++ b/projects/ui/src/lib/components/po-chart/directives/po-resize-observer.directive.spec.ts @@ -83,4 +83,26 @@ describe('PoResizeObserverDirective', () => { window.ResizeObserver = resizeRef; })); + + it('ngOnInit: should call chartWidthResize$.next when ResizeObserver callback is triggered', fakeAsync(() => { + const mockObserver = { + observe: jasmine.createSpy('observe'), + unobserve: jasmine.createSpy('unobserve') + }; + + spyOn(window as any, 'ResizeObserver').and.callFake(function (callback) { + this.observe = mockObserver.observe; + this.unobserve = mockObserver.unobserve; + this.callback = callback; + }); + + const nextSpy = spyOn(directive['chartWidthResize$'], 'next'); + + directive.ngOnInit(); + + directive['observer'].callback(); + tick(20); + + expect(nextSpy).toHaveBeenCalledWith({}); + })); }); diff --git a/projects/ui/src/lib/components/po-chart/po-chart-container/po-chart-circular/po-chart-circular-path/po-chart-tooltip.directive.spec.ts b/projects/ui/src/lib/components/po-chart/po-chart-container/po-chart-circular/po-chart-circular-path/po-chart-tooltip.directive.spec.ts index 533c5cfd6..c71a78fb1 100644 --- a/projects/ui/src/lib/components/po-chart/po-chart-container/po-chart-circular/po-chart-circular-path/po-chart-tooltip.directive.spec.ts +++ b/projects/ui/src/lib/components/po-chart/po-chart-container/po-chart-circular/po-chart-circular-path/po-chart-tooltip.directive.spec.ts @@ -53,6 +53,9 @@ describe('PoChartTooltipDirective', () => { directive.createTooltip(); fixture.detectChanges(); + spyOnProperty(directive.tooltipElement, 'offsetWidth').and.returnValue(154); + spyOnProperty(directive.tooltipElement, 'offsetHeight').and.returnValue(60); + event = document.createEvent('MouseEvents'); event.initEvent('scroll', false, true); }); @@ -112,7 +115,7 @@ describe('PoChartTooltipDirective', () => { it('calculateTooltipPosition: should return tooltipPosition', () => { const tooltipEvent = { clientX: 300, clientY: 300 }; - const expectedResult = { left: -77, top: 270 }; + const expectedResult = { left: 223, top: 228 }; const result = directive.calculateTooltipPosition(tooltipEvent); expect(result).toEqual(expectedResult); diff --git a/projects/ui/src/lib/components/po-disclaimer-group/po-disclaimer-group.component.spec.ts b/projects/ui/src/lib/components/po-disclaimer-group/po-disclaimer-group.component.spec.ts index 4aa97ffa9..78445ce87 100644 --- a/projects/ui/src/lib/components/po-disclaimer-group/po-disclaimer-group.component.spec.ts +++ b/projects/ui/src/lib/components/po-disclaimer-group/po-disclaimer-group.component.spec.ts @@ -312,6 +312,25 @@ describe('PoDisclaimerGroupComponent:', () => { expect(component['focusOnRemoveTag']).toHaveBeenCalled(); }); + it('focusOnNextTag: should select attribute index 0 when event is not enter', () => { + const tagsFake = document.createElement('div'); + tagsFake.innerHTML = ` +
+
+
+ `; + + document.body.appendChild(tagsFake); + + spyOn(component as any, 'handleKeyboardNavigationTag'); + + component['focusOnNextTag'](null, 'click'); + + expect(component['handleKeyboardNavigationTag']).toHaveBeenCalledWith(0); + + document.body.removeChild(tagsFake); + }); + describe('Templates:', () => { it(`should set tabindex to 0 if have a disclaimer with 'hideClose'.`, () => { component.disclaimers = [{ value: 'po', hideClose: false }]; diff --git a/projects/ui/src/lib/components/po-dropdown/po-dropdown.component.spec.ts b/projects/ui/src/lib/components/po-dropdown/po-dropdown.component.spec.ts index 65968b714..c68d4b838 100644 --- a/projects/ui/src/lib/components/po-dropdown/po-dropdown.component.spec.ts +++ b/projects/ui/src/lib/components/po-dropdown/po-dropdown.component.spec.ts @@ -354,7 +354,6 @@ describe('PoDropdownComponent: ', () => { await fixture.whenStable(); const disabledButton = nativeElement.querySelector('.po-dropdown-button-disabled'); - console.log('Disabled button:', disabledButton); expect(disabledButton).toBeTruthy(); }); diff --git a/projects/ui/src/lib/components/po-field/po-combo/po-combo.component.spec.ts b/projects/ui/src/lib/components/po-field/po-combo/po-combo.component.spec.ts index 2544d5246..cb7c05bb5 100644 --- a/projects/ui/src/lib/components/po-field/po-combo/po-combo.component.spec.ts +++ b/projects/ui/src/lib/components/po-field/po-combo/po-combo.component.spec.ts @@ -18,6 +18,7 @@ import { PoComboFilterService } from './po-combo-filter.service'; import { PoComboOption } from './interfaces/po-combo-option.interface'; import { PoCleanComponent } from '../po-clean/po-clean.component'; import { OverlayModule } from '@angular/cdk/overlay'; +import { PoControlPositionService } from '../../../services/po-control-position/po-control-position.service'; const eventKeyBoard = document.createEvent('KeyboardEvent'); eventKeyBoard.initEvent('keyup', true, true); @@ -29,19 +30,23 @@ eventClick.initEvent('click', false, true); describe('PoComboComponent:', () => { let component: PoComboComponent; let fixture: ComponentFixture; + let controlPositionMock: jasmine.SpyObj; let nativeElement: any; beforeEach(async () => { await TestBed.configureTestingModule({ imports: [PoLoadingModule, PoIconModule, OverlayModule], declarations: [PoComboComponent, PoFieldContainerComponent, PoFieldContainerBottomComponent, PoCleanComponent], - providers: [HttpClient, HttpHandler] + providers: [HttpClient, HttpHandler, PoControlPositionService] }).compileComponents(); fixture = TestBed.createComponent(PoComboComponent); component = fixture.componentInstance; component.label = 'Label de teste'; component.help = 'Help de teste'; + + controlPositionMock = jasmine.createSpyObj('PoControlPositionService', ['adjustPosition', 'setElements']); + component['adjustContainerPosition'] = () => controlPositionMock.adjustPosition('bottom'); }); it('should be created', () => { @@ -1180,11 +1185,17 @@ describe('PoComboComponent:', () => { it('adjustContainerPosition: should call `controlPosition.adjustPosition` with default position of container', () => { const poComboContainerPositionDefault = 'bottom'; - const spyAdjustPosition = spyOn(component['controlPosition'], 'adjustPosition'); - component['adjustContainerPosition'](); - expect(spyAdjustPosition).toHaveBeenCalledWith(poComboContainerPositionDefault); + expect(controlPositionMock.adjustPosition).toHaveBeenCalledWith(poComboContainerPositionDefault); + }); + + it('onScroll: should call `adjustContainerPosition` when triggered', () => { + const spy = spyOn(component as any, 'adjustContainerPosition'); + + component['onScroll'](); + + expect(spy).toHaveBeenCalled(); }); }); diff --git a/projects/ui/src/lib/components/po-field/po-lookup/po-lookup-modal/po-lookup-modal.component.spec.ts b/projects/ui/src/lib/components/po-field/po-lookup/po-lookup-modal/po-lookup-modal.component.spec.ts index 56679ad68..3d6ad4046 100644 --- a/projects/ui/src/lib/components/po-field/po-lookup/po-lookup-modal/po-lookup-modal.component.spec.ts +++ b/projects/ui/src/lib/components/po-field/po-lookup/po-lookup-modal/po-lookup-modal.component.spec.ts @@ -1,13 +1,12 @@ import { provideHttpClientTesting } from '@angular/common/http/testing'; import { NO_ERRORS_SCHEMA } from '@angular/core'; -import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; +import { ComponentFixture, discardPeriodicTasks, fakeAsync, flush, TestBed, tick } from '@angular/core/testing'; import { RouterTestingModule } from '@angular/router/testing'; import { Observable, of } from 'rxjs'; import { PoLookupFilter } from '../../../../components/po-field/po-lookup/interfaces/po-lookup-filter.interface'; import { PoLookupModalComponent } from '../../../../components/po-field/po-lookup/po-lookup-modal/po-lookup-modal.component'; import { PoModalModule } from '../../../../components/po-modal/po-modal.module'; import { PoComponentInjectorService } from '../../../../services/po-component-injector/po-component-injector.service'; -import { changeBrowserInnerHeight } from '../../../../util-test/util-expect.spec'; import { PoDynamicModule } from '../../../po-dynamic/po-dynamic.module'; import { PoTableColumnSortType } from '../../../po-table/enums/po-table-column-sort-type.enum'; import { PoTableColumnSort } from '../../../po-table/interfaces/po-table-column-sort.interface'; @@ -28,7 +27,7 @@ describe('PoLookupModalComponent', () => { const advancedFilters = [{ property: 'name', gridColumns: 6, gridSmColumns: 12, order: 1, required: true }]; - beforeEach(waitForAsync(() => { + beforeEach(fakeAsync(() => { TestBed.configureTestingModule({ declarations: [PoLookupModalComponent], schemas: [NO_ERRORS_SCHEMA], @@ -40,9 +39,7 @@ describe('PoLookupModalComponent', () => { provideHttpClientTesting() ] }).compileComponents(); - })); - beforeEach(() => { fixture = TestBed.createComponent(PoLookupModalComponent); component = fixture.componentInstance; component.infiniteScroll = false; @@ -57,7 +54,7 @@ describe('PoLookupModalComponent', () => { }), getObjectByValue: () => of({ items: [{ value: 123, label: 'teste' }] }) }; - }); + })); afterEach(() => { component.poModal.close(); @@ -164,11 +161,16 @@ describe('PoLookupModalComponent', () => { }); describe('AdvancedSearch: ', () => { - beforeEach(waitForAsync(() => { + beforeEach(fakeAsync(() => { component.advancedFilters = advancedFilters; fixture.detectChanges(); component.onAdvancedFilter(); + + tick(10); fixture.detectChanges(); + + flush(); + discardPeriodicTasks(); })); afterEach(() => { diff --git a/projects/ui/src/lib/components/po-field/po-lookup/po-lookup.component.spec.ts b/projects/ui/src/lib/components/po-field/po-lookup/po-lookup.component.spec.ts index 9609f758d..0b31a78c8 100644 --- a/projects/ui/src/lib/components/po-field/po-lookup/po-lookup.component.spec.ts +++ b/projects/ui/src/lib/components/po-field/po-lookup/po-lookup.component.spec.ts @@ -572,7 +572,7 @@ describe('PoLookupComponent:', () => { expect(spyCallOnChange).toHaveBeenCalled(); }); - it('updateVisibleItems: should concat `visibleDisclaimers` with items of disclaimers', () => { + it('updateVisibleItems: should concat `visibleDisclaimers` with items of disclaimers', fakeAsync(() => { fixture.detectChanges(); const itemsDisclaimers = [ { @@ -588,58 +588,57 @@ describe('PoLookupComponent:', () => { const spyDebounceResize = spyOn(component, 'debounceResize'); component.disclaimers = itemsDisclaimers; - component.updateVisibleItems(); + tick(); + expect(component.visibleDisclaimers.length).toEqual(2); expect(spyDebounceResize).toHaveBeenCalled(); - }); + })); - it(`updateVisibleItems: shouldn't concat 'visibleDisclaimers' with items of disclaimers`, () => { + it(`updateVisibleItems: shouldn't concat 'visibleDisclaimers' with items of disclaimers`, fakeAsync(() => { fixture.detectChanges(); const spyDebounceResize = spyOn(component, 'debounceResize'); component.disclaimers = []; - - component.visibleDisclaimers = [ - { - value: 'test', - label: 'test' - } - ]; + component.visibleDisclaimers = [{ value: 'test', label: 'test' }]; component.updateVisibleItems(); + tick(); + expect(component.disclaimers.length).toEqual(0); expect(component.visibleDisclaimers.length).toEqual(1); expect(spyDebounceResize).toHaveBeenCalled(); - }); + })); - it('updateVisibleItems: should set true in `isCalculateVisibleItems` if `offsetWidth` is false', () => { + it('updateVisibleItems: should set true in `isCalculateVisibleItems` if `offsetWidth` is false', fakeAsync(() => { fixture.detectChanges(); const spyDebounceResize = spyOn(component, 'debounceResize'); component.disclaimers = []; spyOnProperty(component.inputEl.nativeElement, 'offsetWidth').and.returnValue(false); - component.updateVisibleItems(); + tick(); + expect(component['isCalculateVisibleItems']).toBeTruthy(); expect(spyDebounceResize).toHaveBeenCalled(); - }); + })); - it('updateVisibleItems: should set false in `isCalculateVisibleItems` if `offsetWidth` is true', () => { + it('updateVisibleItems: should set false in `isCalculateVisibleItems` if `offsetWidth` is true', fakeAsync(() => { fixture.detectChanges(); component['isCalculateVisibleItems'] = false; const spyDebounceResize = spyOn(component, 'debounceResize'); component.disclaimers = []; spyOnProperty(component.inputEl.nativeElement, 'offsetWidth').and.returnValue(true); - component.updateVisibleItems(); + tick(); + expect(component['isCalculateVisibleItems']).toBeFalsy(); expect(spyDebounceResize).toHaveBeenCalled(); - }); + })); it(`debounceResize: should call 'calculateVisibleItems'`, fakeAsync(() => { component.autoHeight = false; diff --git a/projects/ui/src/lib/components/po-field/po-multiselect/po-multiselect.component.spec.ts b/projects/ui/src/lib/components/po-field/po-multiselect/po-multiselect.component.spec.ts index 6c0cf87ed..6590f314e 100644 --- a/projects/ui/src/lib/components/po-field/po-multiselect/po-multiselect.component.spec.ts +++ b/projects/ui/src/lib/components/po-field/po-multiselect/po-multiselect.component.spec.ts @@ -2,21 +2,22 @@ import { OverlayModule } from '@angular/cdk/overlay'; import { HttpClient, HttpHandler, provideHttpClient, withInterceptorsFromDi } from '@angular/common/http'; import { HttpTestingController, provideHttpClientTesting } from '@angular/common/http/testing'; import { ComponentFixture, fakeAsync, flush, TestBed, tick } from '@angular/core/testing'; -import { Observable, catchError, of, tap, throwError } from 'rxjs'; +import { Observable, of, throwError } from 'rxjs'; import * as UtilsFunction from '../../../utils/util'; -import { PoTagComponent } from '../../po-tag/po-tag.component'; import { Renderer2 } from '@angular/core'; import { PoKeyCodeEnum } from '../../../enums/po-key-code.enum'; +import { PoControlPositionService } from '../../../services/po-control-position/po-control-position.service'; +import { PoTagComponent } from '../../po-tag/po-tag.component'; import { PoFieldContainerComponent } from '../po-field-container/po-field-container.component'; import { PoMultiselectBaseComponent } from '../po-multiselect/po-multiselect-base.component'; import { PoFieldContainerBottomComponent } from './../po-field-container/po-field-container-bottom/po-field-container-bottom.component'; import { PoMultiselectDropdownComponent } from './po-multiselect-dropdown/po-multiselect-dropdown.component'; import { PoMultiselectFilter } from './po-multiselect-filter.interface'; import { PoMultiselectFilterService } from './po-multiselect-filter.service'; -import { PoMultiselectComponent } from './po-multiselect.component'; import { PoMultiselectOption } from './po-multiselect-option.interface'; +import { PoMultiselectComponent } from './po-multiselect.component'; const poMultiselectFilterServiceStub: PoMultiselectFilter = { getFilteredData: function (params: { property: string; value: string }): Observable> { @@ -31,6 +32,7 @@ describe('PoMultiselectComponent:', () => { let fnAdjustContainerPosition; let component: PoMultiselectComponent; let fixture: ComponentFixture; + let controlPositionMock: jasmine.SpyObj; let multiSelectService: PoMultiselectFilterService; let httpMock: HttpTestingController; @@ -62,6 +64,7 @@ describe('PoMultiselectComponent:', () => { HttpHandler, Renderer2, PoMultiselectFilterService, + PoControlPositionService, provideHttpClient(withInterceptorsFromDi()), provideHttpClientTesting() ] @@ -71,7 +74,8 @@ describe('PoMultiselectComponent:', () => { component = fixture.componentInstance; renderer = TestBed.inject(Renderer2); fnAdjustContainerPosition = component['adjustContainerPosition']; - component['adjustContainerPosition'] = () => {}; + controlPositionMock = jasmine.createSpyObj('PoControlPositionService', ['adjustPosition', 'setElements']); + component['adjustContainerPosition'] = () => controlPositionMock.adjustPosition('bottom'); component.options = [{ label: 'label', value: 1 }]; component.autoHeight = true; @@ -157,11 +161,13 @@ describe('PoMultiselectComponent:', () => { expect(component.initialized).toBeTruthy(); }); - it('shouldn`t set focus on input', () => { + it('shouldn`t set focus on input', done => { component.initialized = false; component.autoFocus = false; spyOn(component.inputElement.nativeElement, 'focus'); + done(); + component.ngAfterViewInit(); expect(component.inputElement.nativeElement.focus).not.toHaveBeenCalled(); diff --git a/projects/ui/src/lib/components/po-menu/po-menu-filter/po-menu-filter.component.spec.ts b/projects/ui/src/lib/components/po-menu/po-menu-filter/po-menu-filter.component.spec.ts index 57933b004..af660324d 100644 --- a/projects/ui/src/lib/components/po-menu/po-menu-filter/po-menu-filter.component.spec.ts +++ b/projects/ui/src/lib/components/po-menu/po-menu-filter/po-menu-filter.component.spec.ts @@ -30,14 +30,17 @@ describe('PoMenuFilterComponent:', () => { expect(component).toBeTruthy(); }); - it('should show po-clean icon', () => { - fixture.whenStable().then(() => { - const inputFilterElement = fixture.debugElement.query(By.css('#inputFilter')); + it('should show po-clean icon', async () => { + await fixture.whenStable(); + const inputFilterElement = fixture.debugElement.query(By.css('#inputFilter')); + if (inputFilterElement) { inputFilterElement.nativeElement.value = 'teste'; + inputFilterElement.nativeElement.dispatchEvent(new Event('input')); // Dispare o evento de input fixture.detectChanges(); - expect(fixture.debugElement.nativeElement.querySelector('.po-icon-close')).not.toBeNull(); - }); + const iconElement = fixture.debugElement.nativeElement.querySelector('.po-icon-close'); + expect(iconElement).not.toBeNull(); + } }); it('should hide po-clean icon', () => { diff --git a/projects/ui/src/lib/directives/po-tooltip/po-tooltip.directive.spec.ts b/projects/ui/src/lib/directives/po-tooltip/po-tooltip.directive.spec.ts index 21dbf9984..d8143f8cd 100644 --- a/projects/ui/src/lib/directives/po-tooltip/po-tooltip.directive.spec.ts +++ b/projects/ui/src/lib/directives/po-tooltip/po-tooltip.directive.spec.ts @@ -5,6 +5,7 @@ import { By } from '@angular/platform-browser'; import { PoButtonModule } from '../../components/po-button/po-button.module'; import { PoTooltipDirective } from './po-tooltip.directive'; +import { PoControlPositionService } from '../../services/po-control-position/po-control-position.service'; @Component({ template: ` @@ -20,13 +21,15 @@ describe('PoTooltipDirective', () => { let directive; let fixture: ComponentFixture; + let controlPositionMock: jasmine.SpyObj; - let event; + const event = new Event('scroll', { bubbles: true }); beforeEach(async () => { await TestBed.configureTestingModule({ imports: [PoButtonModule], - declarations: [PoTooltipDirective, TestComponent] + declarations: [PoTooltipDirective, TestComponent], + providers: [PoControlPositionService] }).compileComponents(); fixture = TestBed.createComponent(TestComponent); @@ -34,11 +37,16 @@ describe('PoTooltipDirective', () => { directiveElement = fixture.debugElement.query(By.directive(PoTooltipDirective)); directive = directiveElement.injector.get(PoTooltipDirective); + fixture.detectChanges(); directive.createTooltip(); fixture.detectChanges(); - event = document.createEvent('MouseEvents'); - event.initEvent('scroll', false, true); + controlPositionMock = jasmine.createSpyObj('PoControlPositionService', [ + 'adjustPosition', + 'setElements', + 'getArrowDirection' + ]); + directive['poControlPosition'] = controlPositionMock; }); it('should be created TestComponent', () => { @@ -147,8 +155,6 @@ describe('PoTooltipDirective', () => { spyOn(directive, 'createTooltip'); spyOn(directive, 'removeArrow'); spyOn(directive, 'addArrow'); - spyOn(directive['poControlPosition'], 'adjustPosition'); - spyOn(directive['poControlPosition'], 'getArrowDirection'); directive.onMouseEnter(); @@ -172,8 +178,6 @@ describe('PoTooltipDirective', () => { spyOn(directive, 'createTooltip'); spyOn(directive, 'removeArrow'); spyOn(directive, 'addArrow'); - spyOn(directive['poControlPosition'], 'adjustPosition'); - spyOn(directive['poControlPosition'], 'getArrowDirection'); directive.onMouseEnter(); @@ -198,8 +202,6 @@ describe('PoTooltipDirective', () => { spyOn(directive, 'createTooltip'); spyOn(directive, 'removeArrow'); spyOn(directive, 'addArrow'); - spyOn(directive['poControlPosition'], 'adjustPosition'); - spyOn(directive['poControlPosition'], 'getArrowDirection'); directive.onMouseEnter(); @@ -223,8 +225,6 @@ describe('PoTooltipDirective', () => { spyOn(directive, 'createTooltip'); spyOn(directive, 'removeArrow'); spyOn(directive, 'addArrow'); - spyOn(directive['poControlPosition'], 'adjustPosition'); - spyOn(directive['poControlPosition'], 'getArrowDirection'); directive.onMouseEnter(); @@ -401,8 +401,6 @@ describe('PoTooltipDirective', () => { }); it('should call adjustPosition through of function of scroll listener', fakeAsync((): void => { - spyOn(directive['poControlPosition'], 'adjustPosition'); - directive.addScrollEventListener(); window.dispatchEvent(event); @@ -413,8 +411,6 @@ describe('PoTooltipDirective', () => { })); it('shouldn`t call adjustPosition through of function of scroll listener', fakeAsync(() => { - spyOn(directive['poControlPosition'], 'adjustPosition'); - directive.addScrollEventListener(); directive.isHidden = true; diff --git a/projects/ui/src/lib/util-test/util-setup.spec.ts b/projects/ui/src/lib/util-test/util-setup.spec.ts new file mode 100644 index 000000000..671fc2ac0 --- /dev/null +++ b/projects/ui/src/lib/util-test/util-setup.spec.ts @@ -0,0 +1,8 @@ +import { TestBed } from '@angular/core/testing'; +import { CUSTOM_ELEMENTS_SCHEMA, NO_ERRORS_SCHEMA } from '@angular/core'; + +beforeEach(async () => { + TestBed.configureTestingModule({ + schemas: [CUSTOM_ELEMENTS_SCHEMA, NO_ERRORS_SCHEMA] + }); +}); diff --git a/projects/ui/tsconfig.spec.json b/projects/ui/tsconfig.spec.json index b1ce7cd1d..ca313671d 100644 --- a/projects/ui/tsconfig.spec.json +++ b/projects/ui/tsconfig.spec.json @@ -6,6 +6,6 @@ "types": ["jasmine", "node"] }, "files": ["src/test.ts"], - "include": ["**/*.spec.ts", "**/*.d.ts"], + "include": ["**/*.spec.ts", "**/*.d.ts", "src/lib/util-test/util-setup.ts"], "exclude": ["schematics/**/*.spec.ts", "**/*.d.ts"] }