diff --git a/npm/ng-packs/packages/theme-shared/src/lib/components/http-error-wrapper/http-error-wrapper.component.ts b/npm/ng-packs/packages/theme-shared/src/lib/components/http-error-wrapper/http-error-wrapper.component.ts index 527f7efb7e..572d860506 100644 --- a/npm/ng-packs/packages/theme-shared/src/lib/components/http-error-wrapper/http-error-wrapper.component.ts +++ b/npm/ng-packs/packages/theme-shared/src/lib/components/http-error-wrapper/http-error-wrapper.component.ts @@ -39,9 +39,9 @@ export class HttpErrorWrapperComponent implements OnInit, AfterViewInit, OnDestr status: ErrorScreenErrorCodes = 0; - title: LocalizationParam = 'Oops!'; + title: LocalizationParam = '_::Oops!'; - details: LocalizationParam = 'Sorry, an error has occured.'; + details: LocalizationParam = '_::Sorry, an error has occured.'; customComponent: Type | undefined = undefined; diff --git a/npm/ng-packs/packages/theme-shared/src/lib/tests/breadcrumb.component.spec.ts b/npm/ng-packs/packages/theme-shared/src/lib/tests/breadcrumb.component.spec.ts index 11fcd6397f..0b7ac3bc5d 100644 --- a/npm/ng-packs/packages/theme-shared/src/lib/tests/breadcrumb.component.spec.ts +++ b/npm/ng-packs/packages/theme-shared/src/lib/tests/breadcrumb.component.spec.ts @@ -14,8 +14,8 @@ import { OTHERS_GROUP } from '@abp/ng.core'; import { SORT_COMPARE_FUNC } from '@abp/ng.core'; const mockRoutes: ABP.Route[] = [ - { name: 'Identity', path: '/identity' }, - { name: 'Users', path: '/identity/users', parentName: 'Identity' }, + { name: '_::Identity', path: '/identity' }, + { name: '_::Users', path: '/identity/users', parentName: '_::Identity' }, ]; // Simple compare function that doesn't use inject() diff --git a/npm/ng-packs/packages/theme-shared/src/lib/tests/confirmation.service.spec.ts b/npm/ng-packs/packages/theme-shared/src/lib/tests/confirmation.service.spec.ts index 43b6ef11a9..029becaa96 100644 --- a/npm/ng-packs/packages/theme-shared/src/lib/tests/confirmation.service.spec.ts +++ b/npm/ng-packs/packages/theme-shared/src/lib/tests/confirmation.service.spec.ts @@ -34,7 +34,7 @@ describe('ConfirmationService', () => { }); test('should display a confirmation popup', fakeAsync(() => { - service.show('MESSAGE', 'TITLE'); + service.show('_::MESSAGE', '_::TITLE'); tick(); @@ -44,12 +44,12 @@ describe('ConfirmationService', () => { test('should display HTML string in title, message, and buttons', fakeAsync(() => { service.show( - 'MESSAGE', - 'TITLE', + '_::MESSAGE', + '_::TITLE', 'neutral', { - cancelText: 'CANCEL', - yesText: 'YES', + cancelText: '_::CANCEL', + yesText: '_::YES', }, ); @@ -62,7 +62,7 @@ describe('ConfirmationService', () => { })); test('should display custom FA icon', fakeAsync(() => { - service.show('MESSAGE', 'TITLE', undefined, { + service.show('_::MESSAGE', '_::TITLE', undefined, { icon: 'fa fa-info', }); @@ -74,7 +74,7 @@ describe('ConfirmationService', () => { const className = 'custom-icon'; const selector = '.' + className; - service.show('MESSAGE', 'TITLE', undefined, { + service.show('_::MESSAGE', '_::TITLE', undefined, { iconTemplate: `I am icon`, }); @@ -91,7 +91,7 @@ describe('ConfirmationService', () => { ${'warn'} | ${'.warning'} | ${'.fa-exclamation-triangle'} ${'error'} | ${'.error'} | ${'.fa-times-circle'} `('should display $type confirmation popup', async ({ type, selector, icon }) => { - service[type]('MESSAGE', 'TITLE'); + service[type]('_::MESSAGE', '_::TITLE'); await timer(0).toPromise(); @@ -115,7 +115,7 @@ describe('ConfirmationService', () => { // }); test('should close when click cancel button', done => { - service.info('', '', { yesText: 'Sure', cancelText: 'Exit' }).subscribe(status => { + service.info('_::', '_::', { yesText: '_::Sure', cancelText: '_::Exit' }).subscribe(status => { expect(status).toBe(Confirmation.Status.reject); done(); }); @@ -137,7 +137,7 @@ describe('ConfirmationService', () => { ({ dismissible, count }) => { const spy = jest.spyOn(service as any, 'listenToEscape'); - service.info('', '', { dismissible }); + service.info('_::', '_::', { dismissible }); expect(spy).toHaveBeenCalledTimes(count); }, diff --git a/npm/ng-packs/packages/theme-shared/src/lib/tests/error.component.spec.ts b/npm/ng-packs/packages/theme-shared/src/lib/tests/error.component.spec.ts index eef153e8d8..93b8d32f0f 100644 --- a/npm/ng-packs/packages/theme-shared/src/lib/tests/error.component.spec.ts +++ b/npm/ng-packs/packages/theme-shared/src/lib/tests/error.component.spec.ts @@ -22,10 +22,12 @@ describe('ErrorComponent', () => { imports: [HttpClientModule, LocalizationPipe], }); - beforeEach(() => { - spectator = createHost(''); - spectator.component.destroy$ = new Subject(); - }); + beforeEach(() => { + spectator = createHost( + '', + ); + spectator.component.destroy$ = new Subject(); + }); describe('#destroy', () => { it('should be call when pressed the esc key', done => { diff --git a/npm/ng-packs/packages/theme-shared/src/lib/tests/modal.component.spec.ts b/npm/ng-packs/packages/theme-shared/src/lib/tests/modal.component.spec.ts index 499fd2fea1..6c1fc32eca 100644 --- a/npm/ng-packs/packages/theme-shared/src/lib/tests/modal.component.spec.ts +++ b/npm/ng-packs/packages/theme-shared/src/lib/tests/modal.component.spec.ts @@ -1,6 +1,6 @@ import { ConfirmationService } from '@abp/ng.theme.shared'; import { CoreTestingModule } from '@abp/ng.core/testing'; -import { Component, Input } from '@angular/core'; +import { Component, EventEmitter, Input } from '@angular/core'; import { createComponentFactory, Spectator } from '@ngneat/spectator/jest'; import { Confirmation } from '@abp/ng.theme.shared'; import { Subject, timer } from 'rxjs'; @@ -11,7 +11,6 @@ import { ModalComponent } from '../components/modal/modal.component'; Header @@ -25,8 +24,7 @@ import { ModalComponent } from '../components/modal/modal.component'; class TestHostComponent { @Input() visible = false; @Input() busy = false; - @Input() ngDirty = false; - visibleChange = new Subject(); + visibleChange = new EventEmitter(); } const mockConfirmation$ = new Subject(); @@ -69,13 +67,7 @@ describe('ModalComponent', () => { expect(spectator.component.busy).toBe(true); }); - it('should handle ngDirty input', () => { - spectator.setInput('ngDirty', true); - spectator.detectChanges(); - expect(spectator.component.ngDirty).toBe(true); - }); - - it('should have visibleChange subject', () => { + it('should have visibleChange emitter', () => { expect(spectator.component.visibleChange).toBeDefined(); }); }); diff --git a/npm/ng-packs/packages/theme-shared/src/test-setup.ts b/npm/ng-packs/packages/theme-shared/src/test-setup.ts index c3b9b7dbef..3cb67bb820 100644 --- a/npm/ng-packs/packages/theme-shared/src/test-setup.ts +++ b/npm/ng-packs/packages/theme-shared/src/test-setup.ts @@ -1,4 +1,5 @@ -import 'jest-preset-angular/setup-jest'; +import { setupZoneTestEnv } from 'jest-preset-angular/setup-env/zone'; +setupZoneTestEnv(); import { getTestBed } from '@angular/core/testing'; import {