This file contains hidden or 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
| beforeEach(() => { | |
| jasmine.addMatchers({ | |
| toBeAHero: (util, customEqualityMatchers) => { | |
| return { | |
| compare: (actual, expected) => { | |
| return { | |
| // heroes are objects that have id, name and strength properties | |
| pass: actual && actual.id && actual.name && actual.strength | |
| }; | |
| } |
This file contains hidden or 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
| const path = require('path'); | |
| const webpack = require('webpack'); | |
| const helpers = require('./helpers'); | |
| const HtmlWebpackPlugin = require('html-webpack-plugin'); | |
| const ENV = process.env.NODE_ENV = process.env.ENV = 'development'; | |
| module.exports = { | |
| devtool: 'cheap-module-eval-source-map', |
This file contains hidden or 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
| /******/ (function(modules) { // webpackBootstrap | |
| /******/ // install a JSONP callback for chunk loading | |
| /******/ var parentJsonpFunction = window["webpackJsonp"]; | |
| /******/ window["webpackJsonp"] = function webpackJsonpCallback(chunkIds, moreModules, executeModules) { | |
| /******/ // add "moreModules" to the modules object, | |
| /******/ // then flag all "chunkIds" as loaded and fire callback | |
| /******/ var moduleId, chunkId, i = 0, resolves = [], result; | |
| /******/ for(;i < chunkIds.length; i++) { | |
| /******/ chunkId = chunkIds[i]; | |
| /******/ if(installedChunks[chunkId]) |
This file contains hidden or 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
| // /*global jasmine, __karma__, window*/ | |
| Error.stackTraceLimit = 0; // "No stacktrace"" is usually best for app testing. | |
| // Uncomment to get full stacktrace output. Sometimes helpful, usually not. | |
| // Error.stackTraceLimit = Infinity; // | |
| jasmine.DEFAULT_TIMEOUT_INTERVAL = 1000; | |
| var builtPath = '/base/public/app/'; | |
This file contains hidden or 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
| // /*global jasmine, __karma__, window*/ | |
| Error.stackTraceLimit = 0; // "No stacktrace"" is usually best for app testing. | |
| // Uncomment to get full stacktrace output. Sometimes helpful, usually not. | |
| // Error.stackTraceLimit = Infinity; // | |
| jasmine.DEFAULT_TIMEOUT_INTERVAL = 1000; | |
| // builtPaths: root paths for output ("built") files | |
| // get from karma.config.js, then prefix with '/src/' (default is 'app/') |
This file contains hidden or 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
| here's the folder structure: | |
| root | |
| karma.conf.js | |
| karma-test-shim.js | |
| public | |
| systemjs.config.js | |
| systemjs-angular-loader.js | |
| main.ts |
This file contains hidden or 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
| import { NgModule, forwardRef } from '@angular/core'; | |
| import { BrowserModule } from '@angular/platform-browser'; | |
| import { FormsModule, NgModel } from '@angular/forms'; | |
| import { HttpModule } from '@angular/http'; | |
| import { UpgradeAdapter } from '@angular/upgrade'; | |
| import { NameParser } from './admin/nameParser'; | |
| import { ProfileComponent } from './profile/profile.component'; | |
| import { Location, LocationStrategy, HashLocationStrategy, PlatformLocation } from '@angular/common'; | |
| export const upgradeAdapter = new UpgradeAdapter(forwardRef(() => AppModule)); |
This file contains hidden or 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
| import {Location} from '@angular/common'; | |
| import {Component, } from '@angular/core'; | |
| import {ComponentFixture, TestBed, fakeAsync, inject, tick} from '@angular/core/testing'; | |
| import { By } from '@angular/platform-browser'; | |
| import {Router} from '@angular/router'; | |
| import {RouterTestingModule} from '@angular/router/testing'; | |
| @Component({selector: 'root-cmp', template: ` | |
| <a routerLink="/simple">click me</a> |
This file contains hidden or 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 is really strange. But you need the module when you create | |
| // the upgrade adapter, but you also need the created upgrade adapter | |
| // when creating the Module (see below, the call to upgradeNg1Component) | |
| // so we use a forwardRef, and we have to put the upgradeAdapter and the | |
| // module in the same file | |
| export const upgradeAdapter = new UpgradeAdapter(forwardRef(() => AppModule)); | |
| @NgModule({ |
This file contains hidden or 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
| module.exports = function() { | |
| console.log('Hello Mars!') | |
| } |