diff --git a/components/buttons/Button.js b/components/buttons/Button.js index 3c19313c6cb..d75e61f8a2f 100644 --- a/components/buttons/Button.js +++ b/components/buttons/Button.js @@ -19,16 +19,16 @@ export default function Button({ if (!href) { return ( - @@ -37,7 +37,7 @@ export default function Button({ return ( - + { icon && iconPosition === 'left' && ( {icon} diff --git a/components/buttons/ChapterSuggestion.js b/components/buttons/ChapterSuggestion.js index 137b944c09c..3d28a1f8001 100644 --- a/components/buttons/ChapterSuggestion.js +++ b/components/buttons/ChapterSuggestion.js @@ -16,6 +16,7 @@ export default function ChapterSuggestion({ rel="noopener noreferrer" title={description} className={`${className} flex flex-col mt-4 p-6 max-w-lg rounded shadow-md border border-gray-200 text-gray-900 transition-all duration-300 ease-in-out hover:shadow-lg hover:border-gray-300`} + data-testid="ChapterSuggestion-link" >
{title}

{description}

diff --git a/components/buttons/DocsButton.js b/components/buttons/DocsButton.js index c8b64b4f72c..4f9d5d2af23 100644 --- a/components/buttons/DocsButton.js +++ b/components/buttons/DocsButton.js @@ -7,7 +7,7 @@ export default function DocsButton({ post, className='' }) { { post?.prevPage &&
-
+
-
{post.prevPage.title}
+
{post.prevPage.title}
@@ -36,7 +36,7 @@ export default function DocsButton({ post, className='' }) { { post?.nextPage &&
-
+
Up Next
@@ -55,7 +55,7 @@ export default function DocsButton({ post, className='' }) { />
-
{post.nextPage.title}
+
{post.nextPage.title}
diff --git a/components/buttons/GitHubIssue.js b/components/buttons/GitHubIssue.js index c54098d6fb6..30fcdcde47c 100644 --- a/components/buttons/GitHubIssue.js +++ b/components/buttons/GitHubIssue.js @@ -2,7 +2,7 @@ import React from 'react' export default function GitHubIssue({className=''}) { return ( - + Github:AsyncAPI Create Issue on GitHub diff --git a/components/buttons/ICSFileButton.js b/components/buttons/ICSFileButton.js index e7e4dbdd126..78ac35cc609 100644 --- a/components/buttons/ICSFileButton.js +++ b/components/buttons/ICSFileButton.js @@ -1,7 +1,7 @@ import Button from './Button'; import IconCalendar from '../icons/Calendar'; -export default function GoogleCalendarButton({ +export default function ICSFButton({ text = 'Download ICS File', href, target = '_blank', diff --git a/cypress/test/buttons/ApplyJob.cy.js b/cypress/test/buttons/ApplyJob.cy.js new file mode 100644 index 00000000000..69189e8156f --- /dev/null +++ b/cypress/test/buttons/ApplyJob.cy.js @@ -0,0 +1,22 @@ +import React from 'react'; +import { mount } from 'cypress/react'; +import ApplyJobButton from '../../../components/buttons/ApplyJob'; + +describe('ApplyJobButton', () => { + const job = { + contact: 'https://www.asyncapi.com/', + }; + + beforeEach(() => { + mount(); + }); + + it('renders the ApplyJobButton component', () => { + cy.contains('Apply for this job').should('exist'); + }); + + it('sets the correct href and target attributes', () => { + cy.get('[data-testid="Button-link"]').should('have.attr', 'href', 'https://www.asyncapi.com/'); + cy.get('[data-testid="Button-link"]').should('have.attr', 'target', '_blank'); + }); +}); diff --git a/cypress/test/buttons/Buttons.cy.js b/cypress/test/buttons/Buttons.cy.js new file mode 100644 index 00000000000..38a30d26bc4 --- /dev/null +++ b/cypress/test/buttons/Buttons.cy.js @@ -0,0 +1,64 @@ +import React from 'react'; +import { mount } from 'cypress/react'; +import Button from '../../../components/buttons/Button'; +import IconGithub from '../../../components/icons/Github' +describe('Button component', () => { + it('renders a button without href', () => { + const text = 'Click me'; + const type = 'button'; + const icon = ; + mount( +