docs: update Stackblitz example for lazy-loading (#33070)

PR Close #33070
This commit is contained in:
Amadou Sall 2019-10-09 23:48:05 +02:00 committed by Miško Hevery
parent 100ba0bd06
commit 1ae77da609
18 changed files with 65 additions and 65 deletions

View File

@ -18,26 +18,26 @@ describe('providers App', () => {
expect(page.getTitleText()).toEqual('Lazy loading feature modules'); expect(page.getTitleText()).toEqual('Lazy loading feature modules');
}); });
describe('Customers list', function() { describe('Customers', function() {
beforeEach(function() { beforeEach(function() {
customersButton.click(); customersButton.click();
}); });
it('should show customers list when the button is clicked', function() { it('should show customers when the button is clicked', function() {
let customersMessage = element(by.css('app-customer-list > p')); let customersMessage = element(by.css('app-customers > p'));
expect(customersMessage.getText()).toBe('customer-list works!'); expect(customersMessage.getText()).toBe('customers works!');
}); });
}); });
describe('Orders list', function() { describe('Orders', function() {
beforeEach(function() { beforeEach(function() {
ordersButton.click(); ordersButton.click();
}); });
it('should show orders list when the button is clicked', function() { it('should show orders when the button is clicked', function() {
let ordersMessage = element(by.css('app-order-list > p')); let ordersMessage = element(by.css('app-orders > p'));
expect(ordersMessage.getText()).toBe('order-list works!'); expect(ordersMessage.getText()).toBe('orders works!');
}); });
}); });

View File

@ -21,16 +21,16 @@ describe('AppComponent', () => {
expect(app).toBeTruthy(); expect(app).toBeTruthy();
})); }));
it(`should have as title 'app works!'`, async(() => { it(`should have as title 'customer-app'`, async(() => {
const fixture = TestBed.createComponent(AppComponent); const fixture = TestBed.createComponent(AppComponent);
const app = fixture.debugElement.componentInstance; const app = fixture.debugElement.componentInstance;
expect(app.title).toEqual('app works!'); expect(app.title).toEqual('customer-app');
})); }));
it('should render title in a h1 tag', async(() => { it('should render title in a h1 tag', async(() => {
const fixture = TestBed.createComponent(AppComponent); const fixture = TestBed.createComponent(AppComponent);
fixture.detectChanges(); fixture.detectChanges();
const compiled = fixture.debugElement.nativeElement; const compiled = fixture.debugElement.nativeElement;
expect(compiled.querySelector('h1').textContent).toContain('app works!'); expect(compiled.querySelector('h1').textContent).toContain('customer-app');
})); }));
}); });

View File

@ -1,15 +0,0 @@
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-customer-list',
templateUrl: './customer-list.component.html',
styleUrls: ['./customer-list.component.css']
})
export class CustomerListComponent implements OnInit {
constructor() { }
ngOnInit() {
}
}

View File

@ -3,13 +3,13 @@
import { NgModule } from '@angular/core'; import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router'; import { Routes, RouterModule } from '@angular/router';
import { CustomerListComponent } from './customer-list/customer-list.component'; import { CustomersComponent } from './customers.component';
const routes: Routes = [ const routes: Routes = [
{ {
path: '', path: '',
component: CustomerListComponent component: CustomersComponent
} }
]; ];

View File

@ -0,0 +1,3 @@
<p>
customers works!
</p>

View File

@ -1,20 +1,20 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { CustomerListComponent } from './customer-list.component'; import { CustomersComponent } from './customers.component';
describe('CustomerListComponent', () => { describe('CustomerListComponent', () => {
let component: CustomerListComponent; let component: CustomersComponent;
let fixture: ComponentFixture<CustomerListComponent>; let fixture: ComponentFixture<CustomersComponent>;
beforeEach(async(() => { beforeEach(async(() => {
TestBed.configureTestingModule({ TestBed.configureTestingModule({
declarations: [ CustomerListComponent ] declarations: [ CustomersComponent ]
}) })
.compileComponents(); .compileComponents();
})); }));
beforeEach(() => { beforeEach(() => {
fixture = TestBed.createComponent(CustomerListComponent); fixture = TestBed.createComponent(CustomersComponent);
component = fixture.componentInstance; component = fixture.componentInstance;
fixture.detectChanges(); fixture.detectChanges();
}); });

View File

@ -0,0 +1,15 @@
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-customers',
templateUrl: './customers.component.html',
styleUrls: ['./customers.component.css']
})
export class CustomersComponent implements OnInit {
constructor() { }
ngOnInit() {
}
}

View File

@ -3,14 +3,14 @@
import { NgModule } from '@angular/core'; import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common'; import { CommonModule } from '@angular/common';
import { CustomersRoutingModule } from './customers-routing.module'; import { CustomersRoutingModule } from './customers-routing.module';
import { CustomerListComponent } from './customer-list/customer-list.component'; import { CustomersComponent } from './customers.component';
@NgModule({ @NgModule({
imports: [ imports: [
CommonModule, CommonModule,
CustomersRoutingModule CustomersRoutingModule
], ],
declarations: [CustomerListComponent] declarations: [CustomersComponent]
}) })
export class CustomersModule { } export class CustomersModule { }
// #enddocregion customers-module // #enddocregion customers-module

View File

@ -1,15 +0,0 @@
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-order-list',
templateUrl: './order-list.component.html',
styleUrls: ['./order-list.component.css']
})
export class OrderListComponent implements OnInit {
constructor() { }
ngOnInit() {
}
}

View File

@ -4,12 +4,12 @@ import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router'; import { Routes, RouterModule } from '@angular/router';
// #docregion orders-routing-module-detail // #docregion orders-routing-module-detail
import { OrderListComponent } from './order-list/order-list.component'; import { OrdersComponent } from './orders.component';
const routes: Routes = [ const routes: Routes = [
{ {
path: '', path: '',
component: OrderListComponent component: OrdersComponent
} }
]; ];
// #enddocregion orders-routing-module-detail // #enddocregion orders-routing-module-detail

View File

@ -0,0 +1,3 @@
<p>
orders works!
</p>

View File

@ -1,20 +1,20 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { OrderListComponent } from './order-list.component'; import { OrdersComponent } from './orders.component';
describe('OrderListComponent', () => { describe('OrderListComponent', () => {
let component: OrderListComponent; let component: OrdersComponent;
let fixture: ComponentFixture<OrderListComponent>; let fixture: ComponentFixture<OrdersComponent>;
beforeEach(async(() => { beforeEach(async(() => {
TestBed.configureTestingModule({ TestBed.configureTestingModule({
declarations: [ OrderListComponent ] declarations: [ OrdersComponent ]
}) })
.compileComponents(); .compileComponents();
})); }));
beforeEach(() => { beforeEach(() => {
fixture = TestBed.createComponent(OrderListComponent); fixture = TestBed.createComponent(OrdersComponent);
component = fixture.componentInstance; component = fixture.componentInstance;
fixture.detectChanges(); fixture.detectChanges();
}); });

View File

@ -0,0 +1,15 @@
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-orders',
templateUrl: './orders.component.html',
styleUrls: ['./orders.component.css']
})
export class OrdersComponent implements OnInit {
constructor() { }
ngOnInit() {
}
}

View File

@ -2,13 +2,13 @@ import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common'; import { CommonModule } from '@angular/common';
import { OrdersRoutingModule } from './orders-routing.module'; import { OrdersRoutingModule } from './orders-routing.module';
import { OrderListComponent } from './order-list/order-list.component'; import { OrdersComponent } from './orders.component';
@NgModule({ @NgModule({
imports: [ imports: [
CommonModule, CommonModule,
OrdersRoutingModule OrdersRoutingModule
], ],
declarations: [OrderListComponent] declarations: [OrdersComponent]
}) })
export class OrdersModule { } export class OrdersModule { }