Skip to content
Snippets Groups Projects
Commit f71554a7 authored by OZGCloud's avatar OZGCloud
Browse files

OZG-4310 remove shared - unused

parent 7d9b2f7b
Branches
Tags
No related merge requests found
Showing
with 0 additions and 384 deletions
<button
(click)="clickEmitter.emit($event)"
[disabled]="disabled"
class="w-full bg-white px-3 py-2 text-sm font-semibold shadow-sm hover:bg-gray-50 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ozgblue-500 active:bg-ozgblue-200"
>
{{ label }}
</button>
import { dispatchEventFromFixture, getElementFromFixture } from '@alfa-client/test-utils';
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { MoreItemButtonComponent } from './more-item-button.component';
describe('MoreItemButtonComponent', () => {
let component: MoreItemButtonComponent;
let fixture: ComponentFixture<MoreItemButtonComponent>;
const buttonSelector: string = 'button';
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [MoreItemButtonComponent],
}).compileComponents();
fixture = TestBed.createComponent(MoreItemButtonComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
it('should show label', () => {
const text: string = 'test-text';
component.label = text;
fixture.detectChanges();
const buttonElement: HTMLButtonElement = getElementFromFixture(fixture, buttonSelector);
expect(buttonElement.textContent.trim()).toEqual(text);
});
it.each([false, true])('should use disabled "%s"', (disabled) => {
component.disabled = disabled;
fixture.detectChanges();
const buttonElement: HTMLButtonElement = getElementFromFixture(fixture, buttonSelector);
expect(buttonElement.disabled).toBe(disabled);
});
it('should emit clickEmitter', () => {
component.clickEmitter.emit = jest.fn();
dispatchEventFromFixture(fixture, buttonSelector, 'click');
expect(component.clickEmitter.emit).toHaveBeenCalled();
});
});
import { Component, EventEmitter, Input, Output } from '@angular/core';
@Component({
selector: 'admin-more-item-button',
templateUrl: './more-item-button.component.html',
styles: [],
})
export class MoreItemButtonComponent {
@Output()
clickEmitter: EventEmitter<MouseEvent> = new EventEmitter<MouseEvent>();
@Input()
disabled: boolean;
@Input()
label: string;
}
<div class="group relative inline-block text-[0px]">
<button class="active:bg-ozgblue-`00 rounded-full bg-gray-50 text-base hover:bg-ozgblue-200">
<svg
xmlns="http://www.w3.org/2000/svg"
fill="none"
viewBox="0 0 24 24"
stroke-width="1.5"
stroke="currentColor"
class="h-6 w-6 stroke-ozgblue-700"
>
<path
stroke-linecap="round"
stroke-linejoin="round"
d="M12 6.75a.75.75 0 1 1 0-1.5.75.75 0 0 1 0 1.5ZM12 12.75a.75.75 0 1 1 0-1.5.75.75 0 0 1 0 1.5ZM12 18.75a.75.75 0 1 1 0-1.5.75.75 0 0 1 0 1.5Z"
/>
</svg>
</button>
<div
class="absolute z-20 hidden flex-col items-stretch text-base drop-shadow-lg group-focus-within:flex"
>
<ng-content select="[more-menu-item]" />
</div>
</div>
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { MoreMenuComponent } from './more-menu.component';
describe('MoreMenuComponent', () => {
let component: MoreMenuComponent;
let fixture: ComponentFixture<MoreMenuComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [MoreMenuComponent],
}).compileComponents();
fixture = TestBed.createComponent(MoreMenuComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
import { Component } from '@angular/core';
@Component({
selector: 'admin-more-menu',
templateUrl: './more-menu.component.html',
styles: [],
})
export class MoreMenuComponent {}
<a
[routerLink]="link"
routerLinkActive="active-link"
data-test-id="anchor"
class="mb-1 flex items-center gap-4 rounded-full p-3 font-semibold hover:bg-ozgblue-200 active:bg-ozgblue-200/75"
>
<img [src]="imageSrc" [alt]="name" class="w-6" [attr.data-test-id]="'image-' + name" />
<span [attr.data-test-id]="'navigation-label-' + name | convertForDataTest">{{ name }}</span>
</a>
.active-link:not(:hover):not(:active) {
@apply bg-ozgblue-100;
}
import { ConvertForDataTestPipe } from '@alfa-client/tech-shared';
import { getElementFromFixture } from '@alfa-client/test-utils';
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { ReactiveFormsModule } from '@angular/forms';
import { RouterTestingModule } from '@angular/router/testing';
import { getDataTestIdOf } from 'libs/tech-shared/test/data-test';
import { NavigationItemComponent } from './navigation-item.component';
describe('NavigationItemComponent', () => {
let component: NavigationItemComponent;
let fixture: ComponentFixture<NavigationItemComponent>;
const anchorLink = getDataTestIdOf('anchor');
const navigationLabelName = 'test';
const image = getDataTestIdOf('image-' + navigationLabelName);
const label = getDataTestIdOf('navigation-label-' + navigationLabelName);
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [NavigationItemComponent, ConvertForDataTestPipe],
imports: [ReactiveFormsModule, RouterTestingModule],
}).compileComponents();
});
beforeEach(() => {
fixture = TestBed.createComponent(NavigationItemComponent);
component = fixture.componentInstance;
component.name = 'test';
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
it('should use imageSrc input', () => {
const imageSrc = 'imagesrc';
component.imageSrc = imageSrc;
fixture.detectChanges();
const imageElement: HTMLImageElement = getElementFromFixture(fixture, image);
expect(imageElement.getAttribute('src')).toBe(imageSrc);
});
it('should use router link', () => {
const link = '/testroute';
component.link = link;
fixture.detectChanges();
const anchorElement: HTMLAnchorElement = getElementFromFixture(fixture, anchorLink);
expect(anchorElement.getAttribute('ng-reflect-router-link')).toBe(link);
});
describe('image name', () => {
it('should be used for alt', () => {
const imageElement = getElementFromFixture(fixture, image);
expect(imageElement.alt).toBe(navigationLabelName);
});
it('should be used for navigation-label', () => {
const labelElement = getElementFromFixture(fixture, label);
expect(labelElement.textContent).toBe(navigationLabelName);
});
});
});
import { Component, Input } from '@angular/core';
@Component({
selector: 'admin-navigation-item',
templateUrl: './navigation-item.component.html',
styleUrls: ['./navigation-item.component.scss'],
})
export class NavigationItemComponent {
@Input()
link: string;
@Input()
imageSrc: string;
@Input()
name = 'Navigations-Link';
}
<button
(click)="clickEmitter.emit($event)"
[disabled]="submitInProgress"
type="button"
class="me-2 inline-flex items-center rounded-lg bg-ozgblue-700 px-5 py-2.5 text-center text-sm font-medium text-white hover:bg-ozgblue-800 focus:ring-4 focus:ring-ozgblue-300 active:bg-ozgblue-600/90 disabled:bg-ozgblue-600/50 dark:bg-ozgblue-600 dark:hover:bg-ozgblue-700 dark:focus:ring-ozgblue-800"
>
<svg
*ngIf="submitInProgress"
aria-hidden="true"
role="status"
class="me-3 inline h-4 w-4 animate-spin text-white"
viewBox="0 0 100 101"
fill="none"
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z"
fill="#E5E7EB"
/>
<path
d="M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z"
fill="currentColor"
/>
</svg>
{{ label }}
</button>
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { PrimaryButtonComponent } from './primary-button.component';
describe('PrimaryButtonComponent', () => {
let component: PrimaryButtonComponent;
let fixture: ComponentFixture<PrimaryButtonComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [PrimaryButtonComponent],
}).compileComponents();
fixture = TestBed.createComponent(PrimaryButtonComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
import { Component, EventEmitter, Input, Output } from '@angular/core';
@Component({
selector: 'admin-primary-button',
templateUrl: './primary-button.component.html',
})
export class PrimaryButtonComponent {
@Output()
clickEmitter: EventEmitter<MouseEvent> = new EventEmitter<MouseEvent>();
@Input()
submitInProgress: boolean;
@Input()
label: string;
}
<button
(click)="clickEmitter.emit($event)"
[disabled]="disabled"
class="rounded border border-ozgblue-500 bg-transparent px-4 py-2 font-semibold text-ozgblue-700 hover:border-transparent hover:bg-ozgblue-500 hover:text-white active:bg-ozgblue-500/70"
>
{{ label }}
</button>
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { SecondaryButtonComponent } from './secondary-button.component';
describe('SecondaryButtonComponent', () => {
let component: SecondaryButtonComponent;
let fixture: ComponentFixture<SecondaryButtonComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [SecondaryButtonComponent],
}).compileComponents();
fixture = TestBed.createComponent(SecondaryButtonComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
import { Component, EventEmitter, Input, Output } from '@angular/core';
@Component({
selector: 'admin-secondary-button',
templateUrl: './secondary-button.component.html',
})
export class SecondaryButtonComponent {
@Output()
clickEmitter: EventEmitter<MouseEvent> = new EventEmitter<MouseEvent>();
@Input()
disabled: boolean;
@Input()
label: string;
}
<div
class="text-surface inline-block h-8 w-8 animate-spin rounded-full border-4 border-solid border-ozgblue-500 border-e-transparent align-[-0.125em] motion-reduce:animate-[spin_1.5s_linear_infinite] dark:text-white"
role="status"
></div>
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { SpinnerComponent } from './spinner.component';
describe('SpinnerComponent', () => {
let component: SpinnerComponent;
let fixture: ComponentFixture<SpinnerComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [SpinnerComponent],
}).compileComponents();
fixture = TestBed.createComponent(SpinnerComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
import { Component } from '@angular/core';
@Component({
selector: 'admin-spinner',
templateUrl: './spinner.component.html',
styles: [],
})
export class SpinnerComponent {}
<div class="flex flex-col">
<label class="grid grid-cols-2 items-center">
<span
[attr.data-test-id]="'text-field-span-' + label | convertForDataTest"
[ngClass]="control?.invalid ? ['text-red-500', 'font-bold'] : []"
>{{ label }}</span
>
<input
class="m-[2px] p-[2px] outline outline-2 outline-gray-100 focus:outline-0 focus:outline-gray-500"
[attr.data-test-id]="'text-field-input-' + label | convertForDataTest"
type="text"
[formControl]="fieldControl"
/>
</label>
<div
*ngIf="invalidParams.length > 0"
[attr.data-test-id]="'text-field-errors-' + label | convertForDataTest"
>
<span class="mb-3 italic text-red-500" *ngFor="let invalidParam of invalidParams">{{
getErrorMessage(invalidParam)
}}</span>
</div>
</div>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment