Skip to content

Commit

Permalink
test(*): cleaning up some warnings from tests (#13400)
Browse files Browse the repository at this point in the history
  • Loading branch information
kdinev authored Aug 30, 2023
1 parent b061766 commit 40f3df7
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -468,8 +468,3 @@ export interface IButtonGroupEventArgs extends IBaseEventArgs {
button: IgxButtonDirective;
index: number;
}

/**
* @hidden
*/

Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class Button {

describe('IgxButtonGroup', () => {
configureTestSuite();
beforeAll(waitForAsync(() => {
beforeAll(waitForAsync(() => {
TestBed.configureTestingModule({
imports: [
NoopAnimationsModule,
Expand Down Expand Up @@ -189,8 +189,8 @@ describe('IgxButtonGroup', () => {
UIInteractions.simulateClickEvent(buttongroup.buttons[0].nativeElement);
UIInteractions.simulateClickEvent(buttongroup.buttons[1].nativeElement);
expect(buttongroup.selectedButtons.length).toBe(0);
UIInteractions.simulateClickEvent(buttongroup.buttons[0].nativeElement);
UIInteractions.simulateClickEvent(buttongroup.buttons[3].nativeElement);
buttongroup.buttons[0].nativeElement.click();
buttongroup.buttons[3].nativeElement.click();
// Button 3 is disabled, and it should not be selected with mouse click
expect(buttongroup.selectedButtons.length).toBe(1);
});
Expand Down Expand Up @@ -350,7 +350,7 @@ class InitButtonGroupComponent implements OnInit {

@Component({
template: `
<igx-buttongroup multiSelection="true" itemContentCssClass="customContentStyle"
<igx-buttongroup [multiSelection]="true" itemContentCssClass="customContentStyle"
[values]="cities" [alignment]="alignment">
</igx-buttongroup>
`,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -347,9 +347,3 @@ export class IgxButtonDirective extends DisplayDensityBase {
export interface IButtonEventArgs extends IBaseEventArgs {
button: IgxButtonDirective;
}

/**
*
* @hidden
*/

Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ describe('Navigation Drawer', () => {
// jasmine.DEFAULT_TIMEOUT_INTERVAL = 10000;
TestBed.configureTestingModule({
imports: [
TestComponentPin,
TestComponentMini,
TestComponentPinComponent,
TestComponentMiniComponent,
TestComponent,
TestComponentDIComponent
]
Expand Down Expand Up @@ -215,7 +215,7 @@ describe('Navigation Drawer', () => {
<ng-template igxDrawer></ng-template>
<ng-template *ngIf="miniView" igxDrawerMini></ng-template>
</igx-nav-drawer>`;
TestBed.overrideComponent(TestComponentMini, {
TestBed.overrideComponent(TestComponentMiniComponent, {
set: {
template
}
Expand All @@ -225,7 +225,7 @@ describe('Navigation Drawer', () => {

// compile after overrides, not in before each: https://github.com/angular/angular/issues/10712
TestBed.compileComponents().then(() => {
fixture = TestBed.createComponent(TestComponentMini);
fixture = TestBed.createComponent(TestComponentMiniComponent);
fixture.detectChanges();
asideElem = fixture.debugElement.query(By.css('.igx-nav-drawer__aside'));

Expand All @@ -245,15 +245,15 @@ describe('Navigation Drawer', () => {
it('should set pin, gestures options', waitForAsync(() => {
const template = `<igx-nav-drawer [pin]="pin" pinThreshold="false" [enableGestures]="enableGestures">
</igx-nav-drawer>`;
TestBed.overrideComponent(TestComponentPin, {
TestBed.overrideComponent(TestComponentPinComponent, {
set: {
template
}
});

// compile after overrides, not in before each: https://github.com/angular/angular/issues/10712
TestBed.compileComponents().then(() => {
const fixture = TestBed.createComponent(TestComponentPin);
const fixture = TestBed.createComponent(TestComponentPinComponent);
fixture.detectChanges();

expect(fixture.componentInstance.navDrawer.pin).toBeTruthy();
Expand All @@ -278,11 +278,11 @@ describe('Navigation Drawer', () => {
</igx-nav-drawer>
</div>`;

TestBed.overrideComponent(TestComponentPin, { set: { template } });
TestBed.overrideComponent(TestComponentPinComponent, { set: { template } });
TestBed.compileComponents()
.then(() => {
document.body.style.overflow = 'hidden';
const fixture = TestBed.createComponent(TestComponentPin);
const fixture = TestBed.createComponent(TestComponentPinComponent);
fixture.detectChanges();
const windowHeight = window.innerHeight;
const container = fixture.debugElement.query(By.css('div')).nativeElement;
Expand All @@ -309,10 +309,10 @@ describe('Navigation Drawer', () => {

it('should set flex-basis and order when pinned', waitForAsync(() => {
const template = `<igx-nav-drawer [pin]="pin" pinThreshold="false"></igx-nav-drawer>`;
TestBed.overrideComponent(TestComponentPin, { set: { template } });
TestBed.overrideComponent(TestComponentPinComponent, { set: { template } });
TestBed.compileComponents()
.then(() => {
const fixture = TestBed.createComponent(TestComponentPin);
const fixture = TestBed.createComponent(TestComponentPinComponent);
const drawer = fixture.componentInstance.navDrawer;
drawer.isOpen = true;
fixture.detectChanges();
Expand Down Expand Up @@ -485,15 +485,15 @@ describe('Navigation Drawer', () => {

it('should update pin based on window width (pinThreshold)', async () => {
const template = `'<igx-nav-drawer [(pin)]="pin" [pinThreshold]="pinThreshold"></igx-nav-drawer>'`;
TestBed.overrideComponent(TestComponentPin, {
TestBed.overrideComponent(TestComponentPinComponent, {
set: {
template
}
});

// compile after overrides, not in before each: https://github.com/angular/angular/issues/10712
await TestBed.compileComponents();
const fixture: ComponentFixture<TestComponentPin> = TestBed.createComponent(TestComponentPin);
const fixture: ComponentFixture<TestComponentPinComponent> = TestBed.createComponent(TestComponentPinComponent);

// watch for initial pin with 2-way bind expression changed errors
expect(() => fixture.detectChanges()).not.toThrow();
Expand Down Expand Up @@ -611,7 +611,7 @@ class TestComponent {

@Component({
providers: [IgxNavigationService],
selector: 'igx-test-cmp',
selector: 'igx-test-cmp-di',
template: '<igx-nav-drawer></igx-nav-drawer>',
standalone: true,
imports: [IgxNavigationDrawerComponent, IgxNavDrawerTemplateDirective, IgxNavDrawerMiniTemplateDirective, NgIf]
Expand All @@ -622,12 +622,26 @@ class TestComponentDIComponent {
public drawerWidth: string | number;
}

class TestComponentPin extends TestComponentDIComponent {
@Component({
selector: 'igx-test-cmp-pin',
providers: [IgxNavigationService],
template: '<igx-nav-drawer></igx-nav-drawer>',
standalone: true,
imports: [IgxNavigationDrawerComponent, IgxNavDrawerTemplateDirective, IgxNavDrawerMiniTemplateDirective, NgIf]
})
class TestComponentPinComponent extends TestComponentDIComponent {
public pin = true;
public enableGestures = '';
public pinThreshold = 1024;
}

class TestComponentMini extends TestComponentDIComponent {
@Component({
selector: 'igx-test-cmp-mini',
providers: [IgxNavigationService],
template: '<igx-nav-drawer></igx-nav-drawer>',
standalone: true,
imports: [IgxNavigationDrawerComponent, IgxNavDrawerTemplateDirective, IgxNavDrawerMiniTemplateDirective, NgIf]
})
class TestComponentMiniComponent extends TestComponentDIComponent {
public miniView = true;
}
Original file line number Diff line number Diff line change
Expand Up @@ -484,7 +484,7 @@ export class IgxOverlayService implements OnDestroy {
public reposition(id: string) {
const overlayInfo = this.getOverlayById(id);
if (!overlayInfo || !overlayInfo.settings) {
console.error('Wrong id provided in overlay.reposition method. Id: ' + id);
console.warn('Wrong id provided in overlay.reposition method. Id: ', id);
return;
}
if (!overlayInfo.visible) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,27 +8,31 @@ export class RoutingView1Component {
}

@Component({
selector: 'igx-routing-view-2',
template: `This is a content from view component # 2`,
standalone: true
})
export class RoutingView2Component {
}

@Component({
selector: 'igx-routing-view-3',
template: `This is a content from view component # 3`,
standalone: true
})
export class RoutingView3Component {
}

@Component({
selector: 'igx-routing-view-4',
template: `This is a content from view component # 4`,
standalone: true
})
export class RoutingView4Component {
}

@Component({
selector: 'igx-routing-view-5',
template: `This is a content from view component # 5`,
standalone: true
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -533,6 +533,7 @@ export class TabsWithPrefixSuffixTestComponent extends TabsTestComponent {
}

@Component({
selector: 'igx-tabs-contacts',
template: `
<div #wrapperDiv>
<igx-tabs>
Expand Down

0 comments on commit 40f3df7

Please sign in to comment.