@cisco-msx/common
v6.0.25-alpha
Published
MSX common components and testing mocks
Downloads
13
Keywords
Readme
@cisco-msx/common
Common components and directives for MSX platform and service packs. Also contains mock testing versions of those components and directives that can be used safely outside of an AngularJS environment.
Usage
import { NgModule } from '@angular/core';
import { MsxCommonModule } from '@cisco-msx/common';
@NgModule({
imports: [
MsxCommonModule
]
})
export class MyModule {}
For service packs, ensure you have installed and are using
@cisco-msx/webpack-externals
in your Webpack configuration, and add
@cisco-msx/common
to your package.json's peerDependencies
and
devDependencies
. This ensures that your package indicates that it depends on
@cisco-msx/common
to run, but will install the package locally during
development for use in your unit tests.
{
"name": "my-service-pack",
"peerDependencies": {
"@cisco-msx/common": "^1.0.0"
},
"devDependencies": {
"@cisco-msx/common": "^1.0.0"
}
}
Testing
If you are testing your component using Angular's TestBed
, import the
MsxCommonTestingModule
in your testing module instead of MsxCommonModule
to
have @cisco-msx/common
's components and directives mocked.
import {
async,
ComponentFixture,
TestBed
} from '@angular/core/testing';
import { MsxCommonTestingModule } from '@cisco-msx/common/testing';
import { MyComponent } from './my.component';
describe('MyComponent', () => {
let component: MyComponent;
let fixture: ComponentFixture<MyComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
imports: [
MsxCommonTestingModule
],
declarations: [MyComponent]
});
fixture = TestBed.createComponent(MyComponent);
component = fixture.componentInstance;
}));
});