I am getting an error while doing unit test case for a Particular Component 
which depends upon another 2 components , so in the constructor we have 
those 2 components

Below is the error which I am getting

Error: Can't resolve all parameters for maNavBar: (?, ?).

Is any good solution for this after NgModule introduce ?

Below is the 2 file contents:
*ma-navbar.ts*

import {Component, Input, Output, EventEmitter, Inject} from 
'@angular/core';
import {NavController, NavParams, MenuController, Navbar} from 
'ionic-angular';
import {ViewController} from 'ionic-angular';

@Component({
selector: 'ma-navbar',
templateUrl: 'ma-navbar.html'
})
export class maNavBar {
@Input() id: string;
@Input() navBarItems: any;
@Output() uiAction

: EventEmitter<any> = new EventEmitter<any>();

constructor( public menu: MenuController, public navCntrl: NavController) {

}
onClick(event: any, senderId: any) {
if (senderId == 'menuButton') {
this.menu.open()
}
if (senderId == 'backButton') {
this.navCntrl.pop();
}
this.uiAction.emit({
"event": event,
"senderId": senderId
})

}

}


*ma-navbar-spec.ts*

import { ComponentFixture, TestBed } from '@angular/core/testing';
import { By }              from '@angular/platform-browser';
import { DebugElement }    from '@angular/core';
import { NavController, MenuController } from 'ionic-angular';

import {maNavBar} from './ma-navbar';

let comp:    maNavBar;
let fixture: ComponentFixture<maNavBar>;
let de:      DebugElement;
let el:      HTMLElement;


describe('maNavBar', () => {
  beforeEach(() => {
    TestBed.configureTestingModule({
      declarations: [ maNavBar ], // declare the test component
      providers: [
            MenuController,
            NavController
        ]
    }).compileComponents();
    
    //de = fixture.debugElement.query(By.css('h1'));
    //el = de.nativeElement;

  });

  beforeEach(() => {
    fixture = TestBed.createComponent(maNavBar);

    comp = fixture.componentInstance; // BannerComponent test instance

    // query for the title <h1> by CSS element selector
    let id = "test-navbar",
    navBarItems = {
        "buttonCollection": [
            {
                "name": "",
                "id": "scanButton",
                "class": "scanButton",
                "enabled": true,
                "align": "right"
            }
        ],
        "header": [
            {
                "title": "PICK LIST"
            }
        ]
    };
    
    comp.id = 'test-navbar';
    
    comp.navBarItems = navBarItems;
    fixture.detectChanges(); // trigger initial data binding
  });

    it('should display hero name', () => {
        expect(comp.id).toEqual('test-navbar');
    });
});


-- 
You received this message because you are subscribed to the Google Groups 
"Angular" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to