Commit 074b254a by Sweet Zhang

新问卷

parent eccb2529
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { AgeComponent } from './age.component';
describe('AgeComponent', () => {
let component: AgeComponent;
let fixture: ComponentFixture<AgeComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ AgeComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(AgeComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-age',
templateUrl: './age.component.html',
styleUrls: ['./age.component.css']
})
export class AgeComponent implements OnInit {
constructor() { }
ngOnInit() {
}
}
import {NgModule} from '@angular/core';
import {Routes, RouterModule} from '@angular/router';
import {TransitComponent} from './transit/transit.component';
import {FamilyComponent} from './family/family.component';
import {AgeComponent} from './age/age.component';
import {JobComponent} from './job/job.component';
import {IncomeComponent} from './income/income.component';
import {LoanComponent} from './loan/loan.component';
import {SocialSecurityComponent} from './social-security/social-security.component';
import {HealthComponent} from './health/health.component';
import {ChildrenHealthComponent} from './children-health/children-health.component';
import {DiseaseComponent} from './disease/disease.component';
import {SmokingComponent} from './smoking/smoking.component';
import {LiveComponent} from './live/live.component';
const routes: Routes = [
{
path: '',
redirectTo: '/index',
pathMatch: 'full'
}, {
path: 'index',
component: TransitComponent
}, {
path: 'family',
component: FamilyComponent
}, {
path: 'age',
component: AgeComponent
}, {
path: 'job',
component: JobComponent,
data: [{type: 1}]
}, {
path: 'spouse_job',
component: JobComponent,
data: [{type: 2}]
}
, {
path: 'income',
component: IncomeComponent
}, {
path: 'loan',
component: LoanComponent
}, {
path: 'social',
component: SocialSecurityComponent
}, {
path: 'health',
component: HealthComponent
}, {
path: 'health',
component: HealthComponent,
data: [{type: 1}]
}, {
path: 'spouse_health',
component: HealthComponent,
data: [{type: 2}]
}, {
path: 'children_health',
component: ChildrenHealthComponent,
}, {
path: 'disease',
component: DiseaseComponent
}, {
path: 'smoke',
component: SmokingComponent
}, {
path: 'live',
component: LiveComponent
}, {
path: '*',
component: 'TransitComponent'
}
];
@NgModule({
imports: [RouterModule.forRoot(routes)],
exports: [RouterModule]
})
export class AppRoutingModule {
}
<router-outlet></router-outlet>
import { TestBed, async } from '@angular/core/testing';
import { RouterTestingModule } from '@angular/router/testing';
import { AppComponent } from './app.component';
describe('AppComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
imports: [
RouterTestingModule
],
declarations: [
AppComponent
],
}).compileComponents();
}));
it('should create the app', () => {
const fixture = TestBed.createComponent(AppComponent);
const app = fixture.debugElement.componentInstance;
expect(app).toBeTruthy();
});
it(`should have as title 'questionnaire'`, () => {
const fixture = TestBed.createComponent(AppComponent);
const app = fixture.debugElement.componentInstance;
expect(app.title).toEqual('questionnaire');
});
it('should render title in a h1 tag', () => {
const fixture = TestBed.createComponent(AppComponent);
fixture.detectChanges();
const compiled = fixture.debugElement.nativeElement;
expect(compiled.querySelector('h1').textContent).toContain('Welcome to questionnaire!');
});
});
import { Component } from '@angular/core';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent {
}
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
import { FamilyComponent } from './family/family.component';
import { AgeComponent } from './age/age.component';
import { JobComponent } from './job/job.component';
import { IncomeComponent } from './income/income.component';
import { LoanComponent } from './loan/loan.component';
import { SocialSecurityComponent } from './social-security/social-security.component';
import { HealthComponent } from './health/health.component';
import { ChildrenHealthComponent } from './children-health/children-health.component';
import { DiseaseComponent } from './disease/disease.component';
import { SmokingComponent } from './smoking/smoking.component';
import { LiveComponent } from './live/live.component';
import { TransitComponent } from './transit/transit.component';
@NgModule({
declarations: [
AppComponent,
FamilyComponent,
AgeComponent,
JobComponent,
IncomeComponent,
LoanComponent,
SocialSecurityComponent,
HealthComponent,
ChildrenHealthComponent,
DiseaseComponent,
SmokingComponent,
LiveComponent,
TransitComponent
],
imports: [
BrowserModule,
AppRoutingModule
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule { }
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { ChildrenHealthComponent } from './children-health.component';
describe('ChildrenHealthComponent', () => {
let component: ChildrenHealthComponent;
let fixture: ComponentFixture<ChildrenHealthComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ ChildrenHealthComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(ChildrenHealthComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-children-health',
templateUrl: './children-health.component.html',
styleUrls: ['./children-health.component.css']
})
export class ChildrenHealthComponent implements OnInit {
constructor() { }
ngOnInit() {
}
}
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { DiseaseComponent } from './disease.component';
describe('DiseaseComponent', () => {
let component: DiseaseComponent;
let fixture: ComponentFixture<DiseaseComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ DiseaseComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(DiseaseComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-disease',
templateUrl: './disease.component.html',
styleUrls: ['./disease.component.css']
})
export class DiseaseComponent implements OnInit {
constructor() { }
ngOnInit() {
}
}
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { FamilyComponent } from './family.component';
describe('FamilyComponent', () => {
let component: FamilyComponent;
let fixture: ComponentFixture<FamilyComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ FamilyComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(FamilyComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-family',
templateUrl: './family.component.html',
styleUrls: ['./family.component.css']
})
export class FamilyComponent implements OnInit {
constructor() { }
ngOnInit() {
}
}
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { HealthComponent } from './health.component';
describe('HealthComponent', () => {
let component: HealthComponent;
let fixture: ComponentFixture<HealthComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ HealthComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(HealthComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-health',
templateUrl: './health.component.html',
styleUrls: ['./health.component.css']
})
export class HealthComponent implements OnInit {
constructor() { }
ngOnInit() {
}
}
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { IncomeComponent } from './income.component';
describe('IncomeComponent', () => {
let component: IncomeComponent;
let fixture: ComponentFixture<IncomeComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ IncomeComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(IncomeComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-income',
templateUrl: './income.component.html',
styleUrls: ['./income.component.css']
})
export class IncomeComponent implements OnInit {
constructor() { }
ngOnInit() {
}
}
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { JobComponent } from './job.component';
describe('JobComponent', () => {
let component: JobComponent;
let fixture: ComponentFixture<JobComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ JobComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(JobComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-job',
templateUrl: './job.component.html',
styleUrls: ['./job.component.css']
})
export class JobComponent implements OnInit {
constructor() { }
ngOnInit() {
}
}
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { LiveComponent } from './live.component';
describe('LiveComponent', () => {
let component: LiveComponent;
let fixture: ComponentFixture<LiveComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ LiveComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(LiveComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-live',
templateUrl: './live.component.html',
styleUrls: ['./live.component.css']
})
export class LiveComponent implements OnInit {
constructor() { }
ngOnInit() {
}
}
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { LoanComponent } from './loan.component';
describe('LoanComponent', () => {
let component: LoanComponent;
let fixture: ComponentFixture<LoanComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ LoanComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(LoanComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-loan',
templateUrl: './loan.component.html',
styleUrls: ['./loan.component.css']
})
export class LoanComponent implements OnInit {
constructor() { }
ngOnInit() {
}
}
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { SmokingComponent } from './smoking.component';
describe('SmokingComponent', () => {
let component: SmokingComponent;
let fixture: ComponentFixture<SmokingComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ SmokingComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(SmokingComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-smoking',
templateUrl: './smoking.component.html',
styleUrls: ['./smoking.component.css']
})
export class SmokingComponent implements OnInit {
constructor() { }
ngOnInit() {
}
}
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { SocialSecurityComponent } from './social-security.component';
describe('SocialSecurityComponent', () => {
let component: SocialSecurityComponent;
let fixture: ComponentFixture<SocialSecurityComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ SocialSecurityComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(SocialSecurityComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-social-security',
templateUrl: './social-security.component.html',
styleUrls: ['./social-security.component.css']
})
export class SocialSecurityComponent implements OnInit {
constructor() { }
ngOnInit() {
}
}
<div class="limbo">
<div class="title">
<img src="assets/images/bg_1.png" />
</div>
<div class="tips">
<span style="color:red;">*</span>
<span>本测试大约需要1分钟</span>
</div>
<!-- <div class="footer" routerLink="/question1">
<div>获取家庭分析报告</div>
</div> -->
</div>
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { TransitComponent } from './transit.component';
describe('TransitComponent', () => {
let component: TransitComponent;
let fixture: ComponentFixture<TransitComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ TransitComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(TransitComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-transit',
templateUrl: './transit.component.html',
styleUrls: ['./transit.component.css']
})
export class TransitComponent implements OnInit {
constructor() { }
ngOnInit() {
}
}
# This file is currently used by autoprefixer to adjust CSS to support the below specified browsers
# For additional information regarding the format and rule options, please see:
# https://github.com/browserslist/browserslist#queries
#
# For IE 9-11 support, please remove 'not' from the last line of the file and adjust as needed
> 0.5%
last 2 versions
Firefox ESR
not dead
not IE 9-11
\ No newline at end of file
export const environment = {
production: true
};
// This file can be replaced during build by using the `fileReplacements` array.
// `ng build --prod` replaces `environment.ts` with `environment.prod.ts`.
// The list of file replacements can be found in `angular.json`.
export const environment = {
production: false
};
/*
* For easier debugging in development mode, you can import the following file
* to ignore zone related error stack frames such as `zone.run`, `zoneDelegate.invokeTask`.
*
* This import should be commented out in production mode because it will have a negative impact
* on performance if an error is thrown.
*/
// import 'zone.js/dist/zone-error'; // Included with Angular CLI.
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Questionnaire</title>
<base href="/">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" type="image/x-icon" href="favicon.ico">
</head>
<body>
<app-root></app-root>
</body>
</html>
// Karma configuration file, see link for more information
// https://karma-runner.github.io/1.0/config/configuration-file.html
module.exports = function (config) {
config.set({
basePath: '',
frameworks: ['jasmine', '@angular-devkit/build-angular'],
plugins: [
require('karma-jasmine'),
require('karma-chrome-launcher'),
require('karma-jasmine-html-reporter'),
require('karma-coverage-istanbul-reporter'),
require('@angular-devkit/build-angular/plugins/karma')
],
client: {
clearContext: false // leave Jasmine Spec Runner output visible in browser
},
coverageIstanbulReporter: {
dir: require('path').join(__dirname, '../coverage/questionnaire'),
reports: ['html', 'lcovonly', 'text-summary'],
fixWebpackSourcePaths: true
},
reporters: ['progress', 'kjhtml'],
port: 9876,
colors: true,
logLevel: config.LOG_INFO,
autoWatch: true,
browsers: ['Chrome'],
singleRun: false,
restartOnFileChange: true
});
};
import { enableProdMode } from '@angular/core';
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { AppModule } from './app/app.module';
import { environment } from './environments/environment';
if (environment.production) {
enableProdMode();
}
platformBrowserDynamic().bootstrapModule(AppModule)
.catch(err => console.error(err));
/**
* This file includes polyfills needed by Angular and is loaded before the app.
* You can add your own extra polyfills to this file.
*
* This file is divided into 2 sections:
* 1. Browser polyfills. These are applied before loading ZoneJS and are sorted by browsers.
* 2. Application imports. Files imported after ZoneJS that should be loaded before your main
* file.
*
* The current setup is for so-called "evergreen" browsers; the last versions of browsers that
* automatically update themselves. This includes Safari >= 10, Chrome >= 55 (including Opera),
* Edge >= 13 on the desktop, and iOS 10 and Chrome on mobile.
*
* Learn more in https://angular.io/guide/browser-support
*/
/***************************************************************************************************
* BROWSER POLYFILLS
*/
/** IE10 and IE11 requires the following for NgClass support on SVG elements */
// import 'classlist.js'; // Run `npm install --save classlist.js`.
/**
* Web Animations `@angular/platform-browser/animations`
* Only required if AnimationBuilder is used within the application and using IE/Edge or Safari.
* Standard animation support in Angular DOES NOT require any polyfills (as of Angular 6.0).
*/
// import 'web-animations-js'; // Run `npm install --save web-animations-js`.
/**
* By default, zone.js will patch all possible macroTask and DomEvents
* user can disable parts of macroTask/DomEvents patch by setting following flags
* because those flags need to be set before `zone.js` being loaded, and webpack
* will put import in the top of bundle, so user need to create a separate file
* in this directory (for example: zone-flags.ts), and put the following flags
* into that file, and then add the following code before importing zone.js.
* import './zone-flags.ts';
*
* The flags allowed in zone-flags.ts are listed here.
*
* The following flags will work for all browsers.
*
* (window as any).__Zone_disable_requestAnimationFrame = true; // disable patch requestAnimationFrame
* (window as any).__Zone_disable_on_property = true; // disable patch onProperty such as onclick
* (window as any).__zone_symbol__BLACK_LISTED_EVENTS = ['scroll', 'mousemove']; // disable patch specified eventNames
*
* in IE/Edge developer tools, the addEventListener will also be wrapped by zone.js
* with the following flag, it will bypass `zone.js` patch for IE/Edge
*
* (window as any).__Zone_enable_cross_context_check = true;
*
*/
/***************************************************************************************************
* Zone JS is required by default for Angular itself.
*/
import 'zone.js/dist/zone'; // Included with Angular CLI.
/***************************************************************************************************
* APPLICATION IMPORTS
*/
/* You can add global styles to this file, and also import other style files */
// This file is required by karma.conf.js and loads recursively all the .spec and framework files
import 'zone.js/dist/zone-testing';
import { getTestBed } from '@angular/core/testing';
import {
BrowserDynamicTestingModule,
platformBrowserDynamicTesting
} from '@angular/platform-browser-dynamic/testing';
declare const require: any;
// First, initialize the Angular testing environment.
getTestBed().initTestEnvironment(
BrowserDynamicTestingModule,
platformBrowserDynamicTesting()
);
// Then we find all the tests.
const context = require.context('./', true, /\.spec\.ts$/);
// And load the modules.
context.keys().map(context);
{
"extends": "../tsconfig.json",
"compilerOptions": {
"outDir": "../out-tsc/app",
"types": []
},
"exclude": [
"test.ts",
"**/*.spec.ts"
]
}
{
"extends": "../tsconfig.json",
"compilerOptions": {
"outDir": "../out-tsc/spec",
"types": [
"jasmine",
"node"
]
},
"files": [
"test.ts",
"polyfills.ts"
],
"include": [
"**/*.spec.ts",
"**/*.d.ts"
]
}
{
"extends": "../tslint.json",
"rules": {
"directive-selector": [
true,
"attribute",
"app",
"camelCase"
],
"component-selector": [
true,
"element",
"app",
"kebab-case"
]
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment