Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
M
Moecube Store
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
MyCard
Moecube Store
Commits
cd7b566f
Commit
cd7b566f
authored
Oct 29, 2016
by
Ward Bell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: karma shim values; update app.component.spec more like cli
parent
e2d55c59
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
25 additions
and
27 deletions
+25
-27
app/app.component.spec.ts
app/app.component.spec.ts
+20
-22
app/app.component.ts
app/app.component.ts
+1
-1
app/app.module.ts
app/app.module.ts
+2
-2
karma-test-shim.js
karma-test-shim.js
+1
-1
karma.conf.js
karma.conf.js
+1
-1
No files found.
app/app.component.spec.ts
View file @
cd7b566f
/* tslint:disable:no-unused-variable */
import
{
AppComponent
}
from
'
./app.component
'
;
import
{
TestBed
}
from
'
@angular/core/testing
'
;
import
{
async
,
ComponentFixture
,
TestBed
}
from
'
@angular/core/testing
'
;
import
{
By
}
from
'
@angular/platform-browser
'
;
import
{
DebugElement
}
from
'
@angular/core
'
;
//////// SPECS /////////////
describe
(
'
AppComponent
'
,
function
()
{
let
de
:
DebugElement
;
let
comp
:
AppComponent
;
let
fixture
:
ComponentFixture
<
AppComponent
>
;
beforeEach
(
async
(()
=>
{
TestBed
.
configureTestingModule
({
declarations
:
[
AppComponent
]
})
.
compileComponents
();
}));
/// Delete this
describe
(
'
Smoke test
'
,
()
=>
{
it
(
'
should run a passing test
'
,
()
=>
{
expect
(
true
).
toEqual
(
true
,
'
should pass
'
);
});
});
describe
(
'
AppComponent with TCB
'
,
function
()
{
beforeEach
(()
=>
{
TestBed
.
configureTestingModule
({
declarations
:
[
AppComponent
]});
fixture
=
TestBed
.
createComponent
(
AppComponent
);
comp
=
fixture
.
componentInstance
;
de
=
fixture
.
debugElement
.
query
(
By
.
css
(
'
h1
'
));
});
it
(
'
should instantiate component
'
,
()
=>
{
let
fixture
=
TestBed
.
createComponent
(
AppComponent
);
expect
(
fixture
.
componentInstance
instanceof
AppComponent
).
toBe
(
true
,
'
should create AppComponent
'
);
});
it
(
'
should create component
'
,
()
=>
expect
(
comp
).
toBeDefined
()
);
it
(
'
should have expected <h1> text
'
,
()
=>
{
let
fixture
=
TestBed
.
createComponent
(
AppComponent
);
fixture
.
detectChanges
();
let
h1
=
fixture
.
debugElement
.
query
(
el
=>
el
.
name
===
'
h1
'
).
nativeElement
;
// it works
h1
=
fixture
.
debugElement
.
query
(
By
.
css
(
'
h1
'
)).
nativeElement
;
// preferred
expect
(
h1
.
innerText
).
toMatch
(
/angular app/i
,
'
<h1> should say something about "Angular App"
'
);
const
h1
=
de
.
nativeElement
;
expect
(
h1
.
innerText
).
toMatch
(
/angular app/i
,
'
<h1> should say something about "Angular App"
'
);
});
});
app/app.component.ts
View file @
cd7b566f
...
...
@@ -2,6 +2,6 @@ import { Component } from '@angular/core';
@
Component
({
selector
:
'
my-app
'
,
template
:
'
<h1>My First Angular App</h1>
'
template
:
`<h1>My First Angular App</h1>`
})
export
class
AppComponent
{
}
app/app.module.ts
View file @
cd7b566f
...
...
@@ -4,8 +4,8 @@ import { BrowserModule } from '@angular/platform-browser';
import
{
AppComponent
}
from
'
./app.component
'
;
@
NgModule
({
imports
:
[
BrowserModule
],
imports
:
[
BrowserModule
],
declarations
:
[
AppComponent
],
bootstrap
:
[
AppComponent
]
bootstrap
:
[
AppComponent
]
})
export
class
AppModule
{
}
karma-test-shim.js
View file @
cd7b566f
...
...
@@ -28,7 +28,7 @@ var allSpecFiles = Object.keys(window.__karma__.files)
.
filter
(
isBuiltFile
);
System
.
config
({
baseURL
:
'
/
base
'
,
baseURL
:
'
base
'
,
// Extend usual application package list with test folder
packages
:
{
'
testing
'
:
{
main
:
'
index.js
'
,
defaultExtension
:
'
js
'
}
},
...
...
karma.conf.js
View file @
cd7b566f
...
...
@@ -3,7 +3,7 @@ module.exports = function(config) {
var
appBase
=
'
app/
'
;
// transpiled app JS and map files
var
appSrcBase
=
'
app/
'
;
// app source TS files
var
appAssets
=
'
/
base/app/
'
;
// component assets fetched by Angular's compiler
var
appAssets
=
'
base/app/
'
;
// component assets fetched by Angular's compiler
var
testBase
=
'
testing/
'
;
// transpiled test JS and map files
var
testSrcBase
=
'
testing/
'
;
// test source TS files
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment