Skip to content

Commit d3fbc9b

Browse files
tests fix 2
1 parent c8b2bc6 commit d3fbc9b

File tree

2 files changed

+9
-14
lines changed

2 files changed

+9
-14
lines changed

src/components/Ui/IllustratedBanner/IllustratedBanner.test.tsx

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -29,28 +29,23 @@ describe('<IllustratedBanner />', () => {
2929
);
3030
});
3131

32-
it('opens a new tab when button is clicked', () => {
33-
// Stub window.open
34-
cy.window().then((win) => {
35-
cy.stub(win, 'open').as('windowOpen');
36-
});
37-
32+
it('renders a link with correct attributes', () => {
3833
cy.mount(
3934
<IllustratedBanner
4035
title="Click Test"
41-
subtitle="Check window.open"
36+
subtitle="Check link attributes"
4237
help={{
4338
link: 'https://example.com',
4439
buttonText: 'Go',
4540
}}
4641
/>,
4742
);
4843

49-
cy.get('ui5-button').contains('Go').click();
50-
cy.get('@windowOpen').should(
51-
'have.been.calledWith',
52-
'https://example.com',
53-
'_blank',
54-
);
44+
cy.get('a')
45+
.should('have.attr', 'href', 'https://example.com')
46+
.and('have.attr', 'target', '_blank')
47+
.and('have.attr', 'rel', 'noreferrer');
48+
49+
cy.get('a').contains('Go');
5550
});
5651
});

src/components/Ui/IllustratedBanner/IllustratedBanner.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ export const IllustratedBanner = ({
3737
help.buttonIcon ? help.buttonIcon : 'sap-icon://question-mark'
3838
}
3939
>
40-
{help.buttonIcon}
40+
{help.buttonText}
4141
</Button>
4242
</a>
4343
)}

0 commit comments

Comments
 (0)