Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ describe('HomePage', () => {
let fixture: ComponentFixture<HomePage>;

beforeEach(async () => {
await TestBed
.configureTestingModule()
.compileComponents();

fixture = TestBed.createComponent(HomePage);
Comment on lines 7 to 14
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI, this code is duplicated in the docs and will need to be updated there.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Opened a PR to address this: ionic-team/ionic-docs#2985

component = fixture.componentInstance;
fixture.detectChanges();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { provideRouter } from '@angular/router';
import { IonicModule } from '@ionic/angular';
import { MessageComponent } from '../message/message.component';

import { HomePage } from './home.page';

Expand All @@ -11,7 +9,7 @@ describe('HomePage', () => {

beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [HomePage, IonicModule, MessageComponent],
imports: [HomePage],
providers: [provideRouter([])],
}).compileComponents();

Expand Down
Original file line number Diff line number Diff line change
@@ -1,27 +1,23 @@
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { TestBed } from '@angular/core/testing';
import { provideRouter } from '@angular/router';

import { RouterTestingModule } from '@angular/router/testing';
import { IonicModule } from '@ionic/angular';

import { AppComponent } from './app.component';

describe('AppComponent', () => {
beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [AppComponent, IonicModule],
imports: [AppComponent],
providers: [provideRouter([])],
}).compileComponents();
});

it('should create the app', async () => {
it('should create the app', () => {
const fixture = TestBed.createComponent(AppComponent);
const app = fixture.componentInstance;
expect(app).toBeTruthy();
});

it('should have menu labels', async () => {
it('should have menu labels', () => {
const fixture = TestBed.createComponent(AppComponent);
fixture.detectChanges();
const app = fixture.nativeElement;
Expand All @@ -31,7 +27,7 @@ describe('AppComponent', () => {
expect(menuItems[1].textContent).toContain('Outbox');
});

it('should have urls', async () => {
it('should have urls', () => {
const fixture = TestBed.createComponent(AppComponent);
fixture.detectChanges();
const app = fixture.nativeElement;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { IonicModule } from '@ionic/angular';

import { ExploreContainerComponent } from './explore-container.component';

Expand All @@ -8,9 +7,7 @@ describe('ExploreContainerComponent', () => {
let fixture: ComponentFixture<ExploreContainerComponent>;

beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [IonicModule]
}).compileComponents();
await TestBed.configureTestingModule().compileComponents();

fixture = TestBed.createComponent(ExploreContainerComponent);
component = fixture.componentInstance;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { IonicModule } from '@ionic/angular';
import { ExploreContainerComponent } from '../explore-container/explore-container.component';

import { Tab1Page } from './tab1.page';

Expand All @@ -10,7 +8,7 @@ describe('Tab1Page', () => {

beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [Tab1Page, IonicModule, ExploreContainerComponent],
imports: [Tab1Page],
}).compileComponents();

fixture = TestBed.createComponent(Tab1Page);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { IonicModule } from '@ionic/angular';

import { ExploreContainerComponent } from '../explore-container/explore-container.component';

import { Tab2Page } from './tab2.page';

Expand All @@ -11,7 +8,7 @@ describe('Tab2Page', () => {

beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [Tab2Page, IonicModule, ExploreContainerComponent],
imports: [Tab2Page],
}).compileComponents();

fixture = TestBed.createComponent(Tab2Page);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { IonicModule } from '@ionic/angular';
import { ExploreContainerComponent } from '../explore-container/explore-container.component';

import { Tab3Page } from './tab3.page';

Expand All @@ -10,7 +8,7 @@ describe('Tab3Page', () => {

beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [Tab3Page, IonicModule, ExploreContainerComponent],
imports: [Tab3Page],
}).compileComponents();

fixture = TestBed.createComponent(Tab3Page);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { provideRouter } from '@angular/router';
import { IonicModule } from '@ionic/angular';

import { TabsPage } from './tabs.page';

Expand All @@ -10,7 +9,7 @@ describe('TabsPage', () => {

beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [TabsPage, IonicModule],
imports: [TabsPage],
providers: [provideRouter([])],
}).compileComponents();
});
Expand Down
6 changes: 3 additions & 3 deletions angular/official/sidemenu/src/app/app.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ describe('AppComponent', () => {
}).compileComponents();
});

it('should create the app', async () => {
it('should create the app', () => {
const fixture = TestBed.createComponent(AppComponent);
const app = fixture.componentInstance;
expect(app).toBeTruthy();
});

it('should have menu labels', async () => {
it('should have menu labels', () => {
const fixture = TestBed.createComponent(AppComponent);
fixture.detectChanges();
const app = fixture.nativeElement;
Expand All @@ -33,7 +33,7 @@ describe('AppComponent', () => {
expect(menuItems[1].textContent).toContain('Outbox');
});

it('should have urls', async () => {
it('should have urls', () => {
const fixture = TestBed.createComponent(AppComponent);
fixture.detectChanges();
const app = fixture.nativeElement;
Expand Down