@eui/cli 18.0.0-next.12 → 18.0.0-next.14

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
- 18.0.0-next.12
1
+ 18.0.0-next.14
package/bin/eui-cli.js CHANGED
@@ -1,9 +1,9 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- const tools = require('@eui/tools/scripts/utils/tools');
4
3
  const chalk = require('chalk');
5
4
  const figlet = require('figlet');
6
5
  const path = require('path');
6
+ const fs = require('fs');
7
7
  const generators = require('../lib/generators');
8
8
  const config = require('../lib/config');
9
9
 
@@ -31,8 +31,8 @@ if (args.targetPath) {
31
31
  targetPath = path.join(targetPath, 'packages');
32
32
  }
33
33
 
34
- if (!tools.isDirExists(targetPath)) {
35
- tools.mkdir(targetPath);
34
+ if (fs.readdirSync(targetPath).length < 1) {
35
+ fs.mkdirSync(targetPath);
36
36
  }
37
37
 
38
38
  // otherwise taking the default config targetPath defined
package/lib/install.js CHANGED
@@ -5,7 +5,6 @@ const tools = require('@eui/tools/scripts/utils/tools');
5
5
  const utils = require('./utils');
6
6
  const chalk = require('chalk');
7
7
 
8
-
9
8
  module.exports.start = (options) => {
10
9
 
11
10
  if (!options.config.npmInstall) {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eui-angular-app",
3
- "version": "18.0.0-next.12",
3
+ "version": "18.0.0-next.14",
4
4
  "license": "EUPL-1.1",
5
5
  "scripts": {
6
6
  "ng": "ng",
@@ -20,6 +20,6 @@
20
20
  },
21
21
  "private": true,
22
22
  "dependencies": {
23
- "@eui/deps-base": "18.0.0-next.12"
23
+ "@eui/deps-base": "18.0.0-next.14"
24
24
  }
25
25
  }
@@ -1,7 +1,7 @@
1
1
  import { NgModule } from '@angular/core';
2
2
  import { RouterModule, Routes } from '@angular/router';
3
3
 
4
- const routes: Routes = [
4
+ export const routes: Routes = [
5
5
  { path: '', redirectTo: 'screen/home', pathMatch: 'full' },
6
6
  { path: 'index.jsp', redirectTo: 'screen/home' },
7
7
  { path: 'screen/home', loadChildren: () => import('./features/home/home.module').then(m => m.Module) },
@@ -0,0 +1,64 @@
1
+ import {TestBed} from '@angular/core/testing';
2
+ import {HttpClientTestingModule, HttpTestingController} from '@angular/common/http/testing';
3
+ import {CONFIG_TOKEN, EuiAppConfig, I18nService, UserService} from '@eui/core';
4
+ import {of} from 'rxjs';
5
+ import {AppStarterService} from './app-starter.service';
6
+ import SpyObj = jasmine.SpyObj;
7
+
8
+ describe('AppStarterService', () => {
9
+ let service: AppStarterService;
10
+ let httpMock: HttpTestingController;
11
+ let userServiceMock: SpyObj<UserService>;
12
+ let i18nServiceMock: SpyObj<I18nService>;
13
+ let configMock: EuiAppConfig;
14
+
15
+ beforeEach(() => {
16
+ userServiceMock = jasmine.createSpyObj('UserService', ['init']);
17
+ i18nServiceMock = jasmine.createSpyObj('I18nService', ['init']);
18
+ configMock = {global: {}, modules: {core: {base: 'localhost:3000', userDetails: 'dummy'}}};
19
+
20
+ TestBed.configureTestingModule({
21
+ imports: [HttpClientTestingModule],
22
+ providers: [
23
+ AppStarterService,
24
+ {provide: UserService, useValue: userServiceMock},
25
+ {provide: I18nService, useValue: i18nServiceMock},
26
+ {provide: CONFIG_TOKEN, useValue: configMock},
27
+ ],
28
+ });
29
+
30
+ service = TestBed.inject(AppStarterService);
31
+ httpMock = TestBed.inject(HttpTestingController);
32
+ });
33
+
34
+ it('should be created', () => {
35
+ expect(service).toBeTruthy();
36
+ });
37
+
38
+ it('should call start method', () => {
39
+ userServiceMock.init.and.returnValue(of(null));
40
+ i18nServiceMock.init.and.returnValue(of(null));
41
+ service.start().subscribe(() => {
42
+ expect(userServiceMock.init).toHaveBeenCalled();
43
+ expect(i18nServiceMock.init).toHaveBeenCalled();
44
+ });
45
+ });
46
+
47
+ it('should call initUserService method', () => {
48
+ userServiceMock.init.and.returnValue(of(null));
49
+ service.initUserService().subscribe(() => {
50
+ expect(userServiceMock.init).toHaveBeenCalled();
51
+ });
52
+ });
53
+
54
+ it('should fetch user details', () => {
55
+ const dummyUserDetails = {userId: 'anonymous'};
56
+ service['fetchUserDetails']().subscribe(userDetails => {
57
+ expect(userDetails).toEqual(dummyUserDetails);
58
+ });
59
+
60
+ const req = httpMock.expectOne(`${configMock.modules.core.base}${configMock.modules.core.userDetails}`);
61
+ expect(req.request.method).toBe('GET');
62
+ req.flush(dummyUserDetails);
63
+ });
64
+ });
@@ -0,0 +1,78 @@
1
+ import {ComponentFixture, TestBed} from '@angular/core/testing';
2
+ import {RouterModule} from '@angular/router';
3
+ import {DebugElement, Predicate} from '@angular/core';
4
+ import {By} from '@angular/platform-browser';
5
+ import {AppComponent} from './app.component';
6
+ import {EuiAppModule} from '@eui/components/layout';
7
+ import {HttpClientTestingModule} from '@angular/common/http/testing';
8
+ import {CoreModule} from "./core/core.module";
9
+ import {routes} from "./app-routing.module";
10
+
11
+ describe('AppComponent', () => {
12
+ let component: AppComponent;
13
+ let fixture: ComponentFixture<AppComponent>;
14
+
15
+ beforeEach(async () => {
16
+ await TestBed.configureTestingModule({
17
+ imports: [
18
+ RouterModule.forRoot(routes),
19
+ CoreModule,
20
+ EuiAppModule,
21
+ HttpClientTestingModule,
22
+ ],
23
+ declarations: [AppComponent],
24
+ }).compileComponents();
25
+
26
+ fixture = TestBed.createComponent(AppComponent);
27
+ component = fixture.componentInstance;
28
+ });
29
+
30
+ it('should create the app', () => {
31
+ expect(component).toBeTruthy();
32
+ });
33
+
34
+ it('should have correct sidebarItems', () => {
35
+ expect(component.sidebarItems).toEqual([
36
+ {label: 'Home', url: 'screen/home'},
37
+ {
38
+ label: 'Module 1', url: 'screen/module1', children: [
39
+ {label: 'page 1', url: 'screen/module1/page1'},
40
+ {label: 'page 2', url: 'screen/module1/page2'},
41
+ ]
42
+ },
43
+ {label: 'Module 2', url: 'screen/module2'},
44
+ ]);
45
+ });
46
+
47
+ it('should have correct notificationItems', () => {
48
+ expect(component.notificationItems).toEqual([
49
+ {label: 'Title label 1', subLabel: 'Subtitle label'},
50
+ {label: 'Title label 2', subLabel: 'Subtitle label'},
51
+ {label: 'Title label 3', subLabel: 'Subtitle label'},
52
+ {label: 'Title label 4', subLabel: 'Subtitle label'},
53
+ ]);
54
+ });
55
+
56
+ it('should render correct number of eui-app-sidebar-menu items', () => {
57
+ fixture.detectChanges();
58
+ const compiled = fixture.debugElement;
59
+ expect(compiled.queryAll(By.css('eui-menu-item')).length).toEqual(component.sidebarItems.length);
60
+ });
61
+
62
+ it('should render correct number of eui-notifications on icon badge', () => {
63
+ fixture.detectChanges();
64
+ const compiled = fixture.debugElement;
65
+ const predicate = By.css('eui-notifications > eui-icon-svg-button > button > eui-icon-svg > eui-badge');
66
+ expect(compiled.queryAll(predicate)[0].nativeNode.innerText).toEqual(component.notificationItems.length.toString());
67
+ });
68
+
69
+ it('should render correct number of eui-notifications on list', () => {
70
+ fixture.detectChanges();
71
+ const compiled = fixture.debugElement;
72
+ const notificationButton: Predicate<DebugElement> = By.css('eui-notifications > eui-icon-svg-button > button');
73
+ compiled.query(notificationButton).nativeElement.click();
74
+ fixture.detectChanges();
75
+ expect(compiled.queryAll(By.css('eui-notification-item')).length)
76
+ .toEqual(component.notificationItems.length);
77
+ });
78
+ });
@@ -0,0 +1,31 @@
1
+ import {TestBed} from '@angular/core/testing';
2
+ import {AppModule} from './app.module';
3
+ import {AppStarterService} from './app-starter.service';
4
+ import {of} from 'rxjs';
5
+
6
+ describe('AppModule', () => {
7
+ let appStarterService: AppStarterService;
8
+
9
+ beforeAll(() => {
10
+ TestBed.resetTestingModule()
11
+ });
12
+
13
+ beforeEach(async () => {
14
+ const appStarterServiceMock = {
15
+ start: jasmine.createSpy('start').and.returnValue(of(null)),
16
+ };
17
+ await TestBed.configureTestingModule({
18
+ imports: [AppModule],
19
+ providers: [
20
+ {provide: AppStarterService, useValue: appStarterServiceMock},
21
+ ],
22
+ }).compileComponents();
23
+
24
+ appStarterService = TestBed.inject(AppStarterService);
25
+ });
26
+
27
+ it('should call start method of AppStarterService', () => {
28
+ expect(appStarterService.start).toHaveBeenCalled();
29
+ });
30
+
31
+ });
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eui-angular-app",
3
- "version": "18.0.0-next.12",
3
+ "version": "18.0.0-next.14",
4
4
  "license": "EUPL-1.1",
5
5
  "scripts": {
6
6
  "ng": "ng",
@@ -20,7 +20,7 @@
20
20
  },
21
21
  "private": true,
22
22
  "dependencies": {
23
- "@eui/deps-base": "16.2.16",
23
+ "@eui/deps-base": "16.2.17-snapshot-1712283114368",
24
24
  "@eui/mobile-core": "16.9.0-snapshot-1712144349584",
25
25
  "@eui/mobile-styles": "16.9.0-snapshot-1712144349584"
26
26
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eui-angular-app",
3
- "version": "18.0.0-next.12",
3
+ "version": "18.0.0-next.14",
4
4
  "license": "EUPL-1.1",
5
5
  "description": "eUI JEE Symfony app scripts",
6
6
  "scripts": {
@@ -18,6 +18,6 @@
18
18
  },
19
19
  "private": true,
20
20
  "dependencies": {
21
- "@eui/deps-base": "18.0.0-next.12"
21
+ "@eui/deps-base": "18.0.0-next.14"
22
22
  }
23
23
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eui/cli",
3
- "version": "18.0.0-next.12",
3
+ "version": "18.0.0-next.14",
4
4
  "tag": "next",
5
5
  "license": "EUPL-1.1",
6
6
  "description": "eUI CLI app generator",