From 9a988db9495f9e7a33316f97d3bcd7562d9f99a4 Mon Sep 17 00:00:00 2001 From: "( Nechiforel David-Samuel ) NsdHSO" Date: Sat, 28 Oct 2023 12:17:03 +0300 Subject: [PATCH 1/6] =?UTF-8?q?chore:=F0=9F=8C=BB=20add=20bool=20component?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 1 + .../lib/components/bool/bool.component.html | 14 +++ .../lib/components/bool/bool.component.scss | 0 .../components/bool/bool.component.spec.ts | 40 +++++++ .../src/lib/components/bool/bool.component.ts | 13 +++ migrations.json | 100 ++++++++++++++++++ 6 files changed, 168 insertions(+) create mode 100644 ftx-sivan-shared/src/lib/components/bool/bool.component.html create mode 100644 ftx-sivan-shared/src/lib/components/bool/bool.component.scss create mode 100644 ftx-sivan-shared/src/lib/components/bool/bool.component.spec.ts create mode 100644 ftx-sivan-shared/src/lib/components/bool/bool.component.ts create mode 100644 migrations.json diff --git a/.gitignore b/.gitignore index b9cf951..6aa4831 100644 --- a/.gitignore +++ b/.gitignore @@ -18,6 +18,7 @@ node_modules *.sublime-workspace .yarn .pnp.cjs +.nx # IDE - VSCode .vscode/* diff --git a/ftx-sivan-shared/src/lib/components/bool/bool.component.html b/ftx-sivan-shared/src/lib/components/bool/bool.component.html new file mode 100644 index 0000000..535ad1d --- /dev/null +++ b/ftx-sivan-shared/src/lib/components/bool/bool.component.html @@ -0,0 +1,14 @@ +
+ + +
diff --git a/ftx-sivan-shared/src/lib/components/bool/bool.component.scss b/ftx-sivan-shared/src/lib/components/bool/bool.component.scss new file mode 100644 index 0000000..e69de29 diff --git a/ftx-sivan-shared/src/lib/components/bool/bool.component.spec.ts b/ftx-sivan-shared/src/lib/components/bool/bool.component.spec.ts new file mode 100644 index 0000000..cc0e39b --- /dev/null +++ b/ftx-sivan-shared/src/lib/components/bool/bool.component.spec.ts @@ -0,0 +1,40 @@ +import { ComponentFixture, fakeAsync, TestBed } from '@angular/core/testing'; +import { BoolComponent } from './bool.component'; +import { FormControl } from '@angular/forms'; + +describe('BoolComponent', () => { + let component: BoolComponent; + let fixture: ComponentFixture; + + beforeEach(async () => { + await TestBed.configureTestingModule({ + imports: [BoolComponent], + }).compileComponents(); + + fixture = TestBed.createComponent(BoolComponent); + component = fixture.componentInstance; + component.control = new FormControl(true); + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); + + describe('should render', () => { + it('check template', fakeAsync(() => { + const divElement = fixture.nativeElement.querySelector( + '[data-test="sivan-bool"]' + ) as HTMLDivElement; + fixture.detectChanges(); + expect(divElement.children.length).toBe(2); + })); + it('check template', fakeAsync(() => { + const divElement = fixture.nativeElement.querySelector( + '[data-test="sivan-bool-control"]' + ) as HTMLInputElement; + fixture.detectChanges(); + expect(divElement.value).toBe('on'); + })); + }); +}); diff --git a/ftx-sivan-shared/src/lib/components/bool/bool.component.ts b/ftx-sivan-shared/src/lib/components/bool/bool.component.ts new file mode 100644 index 0000000..315dd3b --- /dev/null +++ b/ftx-sivan-shared/src/lib/components/bool/bool.component.ts @@ -0,0 +1,13 @@ +import { Component } from '@angular/core'; +import { CommonModule } from '@angular/common'; +import { BaseComponent } from '../base/base.component'; +import { FormsModule, ReactiveFormsModule } from '@angular/forms'; +type PositionItems = 'left' | 'right' | 'up' | 'down'; +@Component({ + selector: 'sivan-bool', + standalone: true, + imports: [CommonModule, FormsModule, ReactiveFormsModule], + templateUrl: './bool.component.html', + styleUrls: ['./bool.component.scss'], +}) +export class BoolComponent extends BaseComponent {} diff --git a/migrations.json b/migrations.json new file mode 100644 index 0000000..dc490fa --- /dev/null +++ b/migrations.json @@ -0,0 +1,100 @@ +{ + "migrations": [ + { + "cli": "nx", + "version": "16.6.0-beta.6", + "description": "Prefix outputs with {workspaceRoot}/{projectRoot} if needed", + "implementation": "./src/migrations/update-15-0-0/prefix-outputs", + "package": "nx", + "name": "16.6.0-prefix-outputs" + }, + { + "cli": "nx", + "version": "16.8.0-beta.3", + "description": "Escape $ in env variables", + "implementation": "./src/migrations/update-16-8-0/escape-dollar-sign-env-variables", + "package": "nx", + "name": "16.8.0-escape-dollar-sign-env" + }, + { + "cli": "nx", + "version": "17.0.0-beta.1", + "description": "Updates the default cache directory to .nx/cache", + "implementation": "./src/migrations/update-17-0-0/move-cache-directory", + "package": "nx", + "name": "17.0.0-move-cache-directory" + }, + { + "cli": "nx", + "version": "17.0.0-beta.3", + "description": "Use minimal config for tasksRunnerOptions", + "implementation": "./src/migrations/update-17-0-0/use-minimal-config-for-tasks-runner-options", + "package": "nx", + "name": "17.0.0-use-minimal-config-for-tasks-runner-options" + }, + { + "version": "17.0.0-rc.1", + "description": "Migration for v17.0.0-rc.1", + "implementation": "./src/migrations/update-17-0-0/rm-default-collection-npm-scope", + "package": "nx", + "name": "rm-default-collection-npm-scope" + }, + { + "cli": "nx", + "version": "16.8.0-beta.4", + "description": "Update to Cypress v13. Most noteable change is video recording is off by default. This migration will only update if the workspace is already on Cypress v12. https://docs.cypress.io/guides/references/migration-guide#Migrating-to-Cypress-130", + "implementation": "./src/migrations/update-16-8-0/cypress-13", + "package": "@nx/cypress", + "name": "update-16-8-0-cypress-13" + }, + { + "cli": "nx", + "version": "16.6.0-beta.0", + "description": "Explicitly set 'updateBuildableProjectDepsInPackageJson' to 'true' in targets that rely on that value as the default.", + "factory": "./src/migrations/update-16-6-0/explicitly-set-projects-to-update-buildable-deps", + "package": "@nx/js", + "name": "explicitly-set-projects-to-update-buildable-deps" + }, + { + "cli": "nx", + "version": "16.8.2-beta.0", + "description": "Remove invalid options (strict, noInterop) for ES6 type modules.", + "factory": "./src/migrations/update-16-8-2/update-swcrc", + "package": "@nx/js", + "name": "16-8-2-update-swcrc" + }, + { + "cli": "nx", + "version": "16.6.0-beta.0", + "description": "Explicitly set 'updateBuildableProjectDepsInPackageJson' to 'true' in targets that rely on that value as the default.", + "factory": "./src/migrations/update-16-6-0/explicitly-set-projects-to-update-buildable-deps", + "package": "@nx/angular", + "name": "explicitly-set-projects-to-update-buildable-deps" + }, + { + "cli": "nx", + "version": "16.7.0-beta.6", + "requires": { + "@angular/core": ">=16.2.0" + }, + "description": "Update the @angular/cli package version to ~16.2.0.", + "factory": "./src/migrations/update-16-7-0/update-angular-cli", + "package": "@nx/angular", + "name": "update-angular-cli-version-16-2-0" + }, + { + "version": "16.8.0", + "description": "update-16-8-0-add-ignored-files", + "implementation": "./src/migrations/update-16-8-0-add-ignored-files/update-16-8-0-add-ignored-files", + "package": "@nx/linter", + "name": "update-16-8-0-add-ignored-files" + }, + { + "version": "17.0.0-beta.7", + "description": "update-17-0-0-rename-to-eslint", + "implementation": "./src/migrations/update-17-0-0-rename-to-eslint/update-17-0-0-rename-to-eslint", + "package": "@nx/linter", + "name": "update-17-0-0-rename-to-eslint" + } + ] +} From 7604d918c472ded7655e1fe097de6b991577368b Mon Sep 17 00:00:00 2001 From: "( Nechiforel David-Samuel ) NsdHSO" Date: Sat, 28 Oct 2023 12:37:46 +0300 Subject: [PATCH 2/6] =?UTF-8?q?chore:=F0=9F=8C=BB=20add=20test=20for=20boo?= =?UTF-8?q?lean?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/lib/components/bool/README.md | 3 +++ .../lib/components/bool/bool.component.html | 7 +++--- .../components/bool/bool.component.spec.ts | 24 +++++++++++++++++++ .../sharedInput/shared-input.component.html | 7 ++++++ .../sharedInput/shared-input.component.ts | 3 ++- .../infoUser/info-user.component.ts | 2 +- 6 files changed, 41 insertions(+), 5 deletions(-) create mode 100644 ftx-sivan-shared/src/lib/components/bool/README.md diff --git a/ftx-sivan-shared/src/lib/components/bool/README.md b/ftx-sivan-shared/src/lib/components/bool/README.md new file mode 100644 index 0000000..a458713 --- /dev/null +++ b/ftx-sivan-shared/src/lib/components/bool/README.md @@ -0,0 +1,3 @@ +# Boolean Component + +Postion for the labe diff --git a/ftx-sivan-shared/src/lib/components/bool/bool.component.html b/ftx-sivan-shared/src/lib/components/bool/bool.component.html index 535ad1d..5a77f0b 100644 --- a/ftx-sivan-shared/src/lib/components/bool/bool.component.html +++ b/ftx-sivan-shared/src/lib/components/bool/bool.component.html @@ -1,4 +1,4 @@ -
+
{{ hintTop }}
diff --git a/ftx-sivan-shared/src/lib/components/bool/bool.component.spec.ts b/ftx-sivan-shared/src/lib/components/bool/bool.component.spec.ts index cc0e39b..b654208 100644 --- a/ftx-sivan-shared/src/lib/components/bool/bool.component.spec.ts +++ b/ftx-sivan-shared/src/lib/components/bool/bool.component.spec.ts @@ -36,5 +36,29 @@ describe('BoolComponent', () => { fixture.detectChanges(); expect(divElement.value).toBe('on'); })); + + it('check the control value', fakeAsync(() => { + const divElement = fixture.nativeElement.querySelector( + '[data-test="sivan-bool-control"]' + ) as HTMLInputElement; + fixture.detectChanges(); + expect(divElement.checked).toBe(true); + })); + it('check false ', fakeAsync(() => { + component.control.setValue(false); + const divElement = fixture.nativeElement.querySelector( + '[data-test="sivan-bool-control"]' + ) as HTMLInputElement; + fixture.detectChanges(); + expect(divElement.checked).toBe(false); + })); + it('check the hint ', fakeAsync(() => { + component.hintTop = 'Test'; + const divElement = fixture.nativeElement.querySelector( + '[data-test="sivan-bool-hint"]' + ) as HTMLLabelElement; + fixture.detectChanges(); + expect(divElement.innerHTML).toBe('Test'); + })); }); }); diff --git a/ftx-sivan-shared/src/lib/components/sharedInput/shared-input.component.html b/ftx-sivan-shared/src/lib/components/sharedInput/shared-input.component.html index 040f94e..4d5286e 100644 --- a/ftx-sivan-shared/src/lib/components/sharedInput/shared-input.component.html +++ b/ftx-sivan-shared/src/lib/components/sharedInput/shared-input.component.html @@ -7,6 +7,13 @@ [valuesToggled]="valuesToggled" /> + + + Date: Sat, 28 Oct 2023 23:46:44 +0300 Subject: [PATCH 3/6] =?UTF-8?q?chore:=F0=9F=8C=BB=20position=20right?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/lib/components/bool/bool.component.html | 2 +- .../lib/components/bool/bool.component.spec.ts | 17 ++++++++++------- .../src/lib/components/bool/bool.component.ts | 7 +++++-- 3 files changed, 16 insertions(+), 10 deletions(-) diff --git a/ftx-sivan-shared/src/lib/components/bool/bool.component.html b/ftx-sivan-shared/src/lib/components/bool/bool.component.html index 5a77f0b..7f37af7 100644 --- a/ftx-sivan-shared/src/lib/components/bool/bool.component.html +++ b/ftx-sivan-shared/src/lib/components/bool/bool.component.html @@ -1,4 +1,4 @@ -
+
{ fixture.detectChanges(); expect(divElement.children.length).toBe(2); })); - it('check template', fakeAsync(() => { - const divElement = fixture.nativeElement.querySelector( - '[data-test="sivan-bool-control"]' - ) as HTMLInputElement; - fixture.detectChanges(); - expect(divElement.value).toBe('on'); - })); it('check the control value', fakeAsync(() => { const divElement = fixture.nativeElement.querySelector( @@ -61,4 +54,14 @@ describe('BoolComponent', () => { expect(divElement.innerHTML).toBe('Test'); })); }); + + describe('should check class', () => { + it('should right', () => { + const divElement = fixture.nativeElement.querySelector( + '[data-test="sivan-bool"]' + ) as HTMLLabelElement; + fixture.detectChanges(); + expect(divElement.classList).toContain('position-right'); + }); + }); }); diff --git a/ftx-sivan-shared/src/lib/components/bool/bool.component.ts b/ftx-sivan-shared/src/lib/components/bool/bool.component.ts index 315dd3b..04a040e 100644 --- a/ftx-sivan-shared/src/lib/components/bool/bool.component.ts +++ b/ftx-sivan-shared/src/lib/components/bool/bool.component.ts @@ -1,4 +1,4 @@ -import { Component } from '@angular/core'; +import { Component, Input } from '@angular/core'; import { CommonModule } from '@angular/common'; import { BaseComponent } from '../base/base.component'; import { FormsModule, ReactiveFormsModule } from '@angular/forms'; @@ -10,4 +10,7 @@ type PositionItems = 'left' | 'right' | 'up' | 'down'; templateUrl: './bool.component.html', styleUrls: ['./bool.component.scss'], }) -export class BoolComponent extends BaseComponent {} +export class BoolComponent extends BaseComponent { + @Input() + positionLabel: PositionItems = 'right'; +} From faafbb03d767321be03cf7138623c4a1644a6bbf Mon Sep 17 00:00:00 2001 From: "( Nechiforel David-Samuel ) NsdHSO" Date: Sat, 28 Oct 2023 23:56:25 +0300 Subject: [PATCH 4/6] =?UTF-8?q?chore:=F0=9F=8C=BB=20add=20check=20for=20ev?= =?UTF-8?q?ery=20position?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../lib/components/bool/bool.component.html | 2 +- .../lib/components/bool/bool.component.scss | 31 +++++++++++++++++++ .../components/bool/bool.component.spec.ts | 26 +++++++++++++++- 3 files changed, 57 insertions(+), 2 deletions(-) diff --git a/ftx-sivan-shared/src/lib/components/bool/bool.component.html b/ftx-sivan-shared/src/lib/components/bool/bool.component.html index 7f37af7..412080a 100644 --- a/ftx-sivan-shared/src/lib/components/bool/bool.component.html +++ b/ftx-sivan-shared/src/lib/components/bool/bool.component.html @@ -1,4 +1,4 @@ -
+
{ '[data-test="sivan-bool"]' ) as HTMLLabelElement; fixture.detectChanges(); - expect(divElement.classList).toContain('position-right'); + expect(divElement.classList).toContain('bool-position-right'); + }); + it('should left', () => { + component.positionLabel = 'left'; + const divElement = fixture.nativeElement.querySelector( + '[data-test="sivan-bool"]' + ) as HTMLLabelElement; + fixture.detectChanges(); + expect(divElement.classList).toContain('bool-position-left'); + }); + it('should top', () => { + component.positionLabel = 'up'; + const divElement = fixture.nativeElement.querySelector( + '[data-test="sivan-bool"]' + ) as HTMLLabelElement; + fixture.detectChanges(); + expect(divElement.classList).toContain('bool-position-up'); + }); + it('should bottom', () => { + component.positionLabel = 'down'; + const divElement = fixture.nativeElement.querySelector( + '[data-test="sivan-bool"]' + ) as HTMLLabelElement; + fixture.detectChanges(); + expect(divElement.classList).toContain('bool-position-down'); }); }); }); From 0dd262328d89ec4039b8d90bf3bbd1688fecf740 Mon Sep 17 00:00:00 2001 From: "( Nechiforel David-Samuel ) NsdHSO" Date: Mon, 30 Oct 2023 12:09:46 +0200 Subject: [PATCH 5/6] =?UTF-8?q?chore:=F0=9F=8C=BB=20add=20bool=20component?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../lib/components/bool/bool.component.html | 7 ++- .../lib/components/bool/bool.component.scss | 58 +++++++++++++------ .../components/bool/bool.component.spec.ts | 16 +++++ .../src/lib/components/bool/bool.component.ts | 26 ++++++++- 4 files changed, 86 insertions(+), 21 deletions(-) diff --git a/ftx-sivan-shared/src/lib/components/bool/bool.component.html b/ftx-sivan-shared/src/lib/components/bool/bool.component.html index 412080a..e070883 100644 --- a/ftx-sivan-shared/src/lib/components/bool/bool.component.html +++ b/ftx-sivan-shared/src/lib/components/bool/bool.component.html @@ -1,10 +1,13 @@ -
+