-
Notifications
You must be signed in to change notification settings - Fork 161
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(demos): fix comments and formatting
- Loading branch information
Showing
29 changed files
with
1,434 additions
and
514 deletions.
There are no files selected for viewing
45 changes: 41 additions & 4 deletions
45
projects/igniteui-angular/src/lib/directives/size/ig-size.directive.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,8 +1,45 @@ | ||
import { Component } from '@angular/core'; | ||
import { IgSizeDirective } from './ig-size.directive'; | ||
import { TestBed, ComponentFixture } from '@angular/core/testing'; | ||
|
||
describe('IgSizeDirective', () => { | ||
it('should create an instance', () => { | ||
const directive = new IgSizeDirective(); | ||
expect(directive).toBeTruthy(); | ||
@Component({ | ||
template: `<div [igSize]="size">Test Element</div>`, | ||
imports: [IgSizeDirective], | ||
}) | ||
class TestComponent { | ||
size: 'small' | 'medium' | 'large'; | ||
Check failure on line 10 in projects/igniteui-angular/src/lib/directives/size/ig-size.directive.spec.ts GitHub Actions / run-tests (18.x)
|
||
} | ||
|
||
fdescribe('IgSizeDirective', () => { | ||
let fixture: ComponentFixture<TestComponent>; | ||
let testComponent: TestComponent; | ||
let divElement: HTMLElement; | ||
|
||
beforeEach(() => { | ||
TestBed.configureTestingModule({ | ||
imports: [TestComponent], | ||
}); | ||
|
||
fixture = TestBed.createComponent(TestComponent); | ||
testComponent = fixture.componentInstance; | ||
divElement = fixture.nativeElement.querySelector('div'); | ||
fixture.detectChanges(); | ||
}); | ||
|
||
it('should apply the correct --ig-size inline style for each size', () => { | ||
const sizeMap = { | ||
small: 'var(--ig-size-small)', | ||
medium: 'var(--ig-size-medium)', | ||
large: 'var(--ig-size-large)', | ||
}; | ||
|
||
// Loop through each size and verify the inline style | ||
for (const size in sizeMap) { | ||
testComponent.size = size as 'small' | 'medium' | 'large'; | ||
fixture.detectChanges(); | ||
|
||
// Check if the --ig-size style is applied correctly | ||
expect(divElement.style.getPropertyValue('--ig-size')).toBe(sizeMap[size]); | ||
} | ||
}); | ||
}); |
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
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
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
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
Oops, something went wrong.