Skip to content

Commit

Permalink
fix(defaultcomponent): take html as input instead of aHtml.
Browse files Browse the repository at this point in the history
  • Loading branch information
Niek Raaijmakers committed Jun 24, 2021
1 parent 150899f commit cfafcd4
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,26 @@ describe('ButtonV1Component', () => {
});


it('render provided HTML without ID and datalayer', () => {
isInEditorSpy.and.returnValue(false);

component.html = `<div id="test">hi there!</div>`;

fixture.detectChanges();
const element = fixture.nativeElement;

const wrapper = element.querySelector('.cmp-default-wrapper');

expect(wrapper.querySelector("#test").innerText).toEqual('hi there!');


});


it('render provided HTML', () => {
isInEditorSpy.and.returnValue(false);

component.aHtml = `<div id="test">hi there!</div>`;
component.html = `<div id="test">hi there!</div>`;
component.id = 'myId';
component.dataLayer = {
"testaccordion": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,13 @@ import {AbstractCoreComponent, DefaultV1IsEmptyFn, DefaultV1Model} from "@adobe/
export class DefaultV1Component extends AbstractCoreComponent implements DefaultV1Model{

@Input() baseCssClass = 'cmp-default';
@Input("html") aHtml;
@Input() html;

get isEmpty(): boolean {
return DefaultV1IsEmptyFn(this);
}

get aHtml(){
return this.html;
}
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@

export interface DefaultV1Model{
aHtml: string;
html: string;
}

export function DefaultV1IsEmptyFn(props:DefaultV1Model): boolean{
return props.aHtml == null || props.aHtml.trim().length === 0;
return props.html == null || props.html.trim().length === 0;
}

0 comments on commit cfafcd4

Please sign in to comment.