-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: smeligrana <[email protected]>
- Loading branch information
1 parent
d27a725
commit 0e4cabb
Showing
1 changed file
with
63 additions
and
8 deletions.
There are no files selected for viewing
71 changes: 63 additions & 8 deletions
71
projects/design-angular-kit/src/lib/components/core/spinner/spinner.component.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,77 @@ | ||
import { ComponentFixture, TestBed } from '@angular/core/testing'; | ||
|
||
import { ItSpinnerComponent } from './spinner.component'; | ||
import { tb_base } from '../../../../test'; | ||
import { Component, Input } from '@angular/core'; | ||
import { BooleanInput } from '../../../utils/boolean-input'; | ||
import { By } from '@angular/platform-browser'; | ||
import { TranslateModule,} from '@ngx-translate/core'; | ||
|
||
describe('ItSpinnerComponent', () => { | ||
let component: ItSpinnerComponent; | ||
let fixture: ComponentFixture<ItSpinnerComponent>; | ||
@Component( | ||
{ | ||
selector: 'it-unit-test', | ||
template: ` | ||
<it-spinner [active]="active" [small]="small"></it-spinner> | ||
` | ||
} | ||
) | ||
class UnitTestComponent { | ||
@Input() set active(value: BooleanInput | undefined) {this._active = value;} | ||
get active(): BooleanInput | undefined {return this._active;} | ||
private _active: BooleanInput | undefined = undefined; | ||
|
||
@Input() set small(value: BooleanInput | undefined) {this._small = value;} | ||
get small(): BooleanInput | undefined {return this._small;} | ||
private _small: BooleanInput | undefined = undefined; | ||
|
||
} | ||
|
||
let component: UnitTestComponent; | ||
let fixture: ComponentFixture<UnitTestComponent>; | ||
|
||
describe('ItSpinnerComponent', () => { | ||
|
||
beforeEach(async () => { | ||
await TestBed.configureTestingModule(tb_base) | ||
.compileComponents(); | ||
TestBed.configureTestingModule({ | ||
declarations: [UnitTestComponent], | ||
imports: [ItSpinnerComponent, TranslateModule.forRoot(),], | ||
}).compileComponents(); | ||
|
||
fixture = TestBed.createComponent(ItSpinnerComponent); | ||
fixture = TestBed.createComponent(UnitTestComponent); | ||
component = fixture.componentInstance; | ||
fixture.detectChanges(); | ||
}); | ||
|
||
it('should create', () => { | ||
it('should create', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
|
||
it('Dovrebbe avere spinner active', () => { | ||
component.active='true'; | ||
fixture.detectChanges(); | ||
const spanElement = fixture.debugElement.query(By.css('div.progress-spinner.progress-spinner-active')); | ||
expect(spanElement).toBeTruthy(); | ||
}); | ||
|
||
it('Dovrebbe avere spinner non active', () => { | ||
component.active='false'; | ||
fixture.detectChanges(); | ||
const spanElement = fixture.debugElement.query(By.css('div.progress-spinner')); | ||
expect(spanElement).toBeTruthy(); | ||
}); | ||
|
||
it('Dovrebbe avere spinner small non active', () => { | ||
component.active='false'; | ||
component.small='true'; | ||
fixture.detectChanges(); | ||
const spanElement = fixture.debugElement.query(By.css('div.progress-spinner.size-sm')); | ||
expect(spanElement).toBeTruthy(); | ||
}); | ||
|
||
it('Dovrebbe avere spinner small active', () => { | ||
component.active='true'; | ||
component.small='true'; | ||
fixture.detectChanges(); | ||
const spanElement = fixture.debugElement.query(By.css('div.progress-spinner.progress-spinner-active.size-sm')); | ||
expect(spanElement).toBeTruthy(); | ||
}); | ||
}); |
0e4cabb
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
design-angular-kit – ./
design-angular-kit-dip-trasformazione-digitale.vercel.app
design-angular-kit.vercel.app
design-angular-kit-git-main-dip-trasformazione-digitale.vercel.app