[ADF-3339] added test component for header (#3576)

* [ADF-3339] added test component for header

* [APM-3339] remove lint errors

* [ADF-3339] solved lint error

* [ADF-3339] removed numbers from tests
This commit is contained in:
Georgiana Roman
2018-07-17 22:21:37 +03:00
committed by Eugenio Romano
parent c63184334f
commit 9901295e25
13 changed files with 182 additions and 16 deletions

View File

@@ -7,11 +7,12 @@
color: mat-color($primary, default-contrast) !important;
position: relative;
padding: 0 24px 0 0;
padding: 0 24px;
.adf-menu-icon {
position: relative;
margin-left: 14px;
margin-left: -11px;
margin-right: 3px;
}
.adf-app-logo {
@@ -19,7 +20,6 @@
height: 28px;
width: 28px;
margin-right: 6px;
margin-left: 3px;
}
.adf-header-delimiter {

View File

@@ -89,7 +89,15 @@ describe('HeaderLayoutComponent', () => {
expect(component.clicked.emit).toHaveBeenCalledWith(true);
});
it('if showSidenavToggle is false the button menu should not be displayed', () => {
it('if showSidenavToggle is true the button menu should be displayed', () => {
component.showSidenavToggle = true;
fixture.detectChanges();
const button = fixture.nativeElement.querySelector('.adf-menu-icon');
expect(button === null).toBeFalsy();
});
it('if showSidenavToggle is false the button menu should not be displayed', () => {
component.showSidenavToggle = false;
fixture.detectChanges();

View File

@@ -15,7 +15,7 @@
* limitations under the License.
*/
import { Component, Input, Output, EventEmitter, ViewEncapsulation } from '@angular/core';
import { Component, Input, Output, EventEmitter, ViewEncapsulation, OnInit } from '@angular/core';
@Component({
selector: 'adf-layout-header',
@@ -23,9 +23,9 @@ import { Component, Input, Output, EventEmitter, ViewEncapsulation } from '@angu
encapsulation: ViewEncapsulation.None,
host: { class: 'adf-layout-header' }
})
export class HeaderLayoutComponent {
export class HeaderLayoutComponent implements OnInit {
@Input() title: string;
@Input() logo: string = './assets/images/logo.png';
@Input() logo: string;
@Input() color: string;
@Input() showSidenavToggle: boolean = true;
@Output() clicked = new EventEmitter<any>();
@@ -33,4 +33,10 @@ export class HeaderLayoutComponent {
toggleMenu() {
this.clicked.emit(true);
}
ngOnInit() {
if (!this.logo) {
this.logo = './assets/images/logo.png';
}
}
}