mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-05-26 17:24:56 +00:00
[AAE-17551] added backgroundImage property for header (#9058)
* [AAE-17551] added backgroundImage property for header * [AAE-17551] added test for background image * [AAE-17551] removed some material selectors * [AAE-17551] rebasing * [AAE-17551] fixed unit test
This commit is contained in:
parent
94fb61541c
commit
a29f63cd9b
@ -1,6 +1,6 @@
|
||||
<mat-toolbar
|
||||
[color]="color"
|
||||
[style.background-color]="color">
|
||||
[style.background-image]="'url(' + backgroundImage + ')'">
|
||||
<button
|
||||
*ngIf="showSidenavToggle && position === 'start'"
|
||||
id="adf-sidebar-toggle-start"
|
||||
|
@ -35,11 +35,14 @@ describe('HeaderLayoutComponent', () => {
|
||||
describe('Input parameters', () => {
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [TranslateModule.forRoot(), CoreTestingModule]
|
||||
imports: [
|
||||
TranslateModule.forRoot(),
|
||||
CoreTestingModule
|
||||
]
|
||||
});
|
||||
fixture = TestBed.createComponent(HeaderLayoutComponent);
|
||||
component = fixture.componentInstance;
|
||||
loader = TestbedHarnessEnvironment.loader(fixture);
|
||||
component = fixture.componentInstance;
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
@ -69,6 +72,15 @@ describe('HeaderLayoutComponent', () => {
|
||||
expect(await host.getAttribute('ng-reflect-color')).toBe('primary');
|
||||
});
|
||||
|
||||
it('should change background image when provided', async () => {
|
||||
component.backgroundImage = '/assets/someImage.png';
|
||||
fixture.detectChanges();
|
||||
|
||||
const toolbarHarness = await loader.getHarness(MatToolbarHarness);
|
||||
const toolbar = await toolbarHarness.host();
|
||||
expect(await toolbar.getCssValue('background-image')).toContain('/assets/someImage.png');
|
||||
});
|
||||
|
||||
it('should display the img element with the expected src if a logo path is set', () => {
|
||||
component.logo = 'logo.png';
|
||||
fixture.detectChanges();
|
||||
@ -78,7 +90,7 @@ describe('HeaderLayoutComponent', () => {
|
||||
expect(src).toEqual('logo.png');
|
||||
});
|
||||
|
||||
it('should have custom url link set on logo when the redirectUrl is set', () => {
|
||||
it('should have custom url link set on logo when the redirectUrl is set', async () => {
|
||||
component.redirectUrl = '/customHomePage';
|
||||
fixture.detectChanges();
|
||||
|
||||
@ -218,10 +230,11 @@ describe('HeaderLayoutComponent', () => {
|
||||
describe('Template transclusion', () => {
|
||||
@Component({
|
||||
selector: 'adf-test-layout-header',
|
||||
template: `<adf-layout-header title="test" color="primary"
|
||||
><p>Test text</p>
|
||||
<p></p
|
||||
></adf-layout-header>`
|
||||
template: `
|
||||
<adf-layout-header title="test" color="primary">
|
||||
<p>Test text</p>
|
||||
<p></p>
|
||||
</adf-layout-header>`
|
||||
})
|
||||
class HeaderLayoutTesterComponent {}
|
||||
|
||||
|
@ -48,6 +48,9 @@ export class HeaderLayoutComponent implements OnInit {
|
||||
*/
|
||||
@Input() color: ThemePalette;
|
||||
|
||||
/** Path to a background image for the header. */
|
||||
@Input() backgroundImage: string;
|
||||
|
||||
/**
|
||||
* Toggles whether the sidenav button will be displayed in the header
|
||||
* or not.
|
||||
|
Loading…
x
Reference in New Issue
Block a user