forked from asyncapi/website
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ab63922
commit c265ed5
Showing
13 changed files
with
300 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,24 @@ | ||
import React from 'react' | ||
export default function AuthorAvatars({ authors = [] }) { | ||
return ( | ||
authors.map((author, index) => { | ||
let avatar = <img | ||
key={index} | ||
title={author.name} | ||
className={`${index > 0 ? `absolute left-${index * 7} top-0` : `relative mr-${(authors.length - 1) * 7}`} z-${(authors.length - 1 - index) * 10} h-10 w-10 border-2 border-white rounded-full object-cover hover:z-50`} | ||
src={author.photo} | ||
loading="lazy" | ||
/> | ||
let avatar = ( | ||
<img | ||
key={index} | ||
title={author.name} | ||
className={`${index > 0 ? `absolute left-${index * 7} top-0` : `relative mr-${(authors.length - 1) * 7}`} z-${(authors.length - 1 - index) * 10} h-10 w-10 border-2 border-white rounded-full object-cover hover:z-50`} | ||
src={author.photo} | ||
loading="lazy" | ||
/> | ||
); | ||
|
||
return author.link ? <a alt={author.name} href={author.link}>{avatar}</a> : {avatar} | ||
return author.link ? ( | ||
<a alt={author.name} href={author.link}> | ||
{avatar} | ||
</a> | ||
) : ( | ||
<React.Fragment key={index}>{avatar}</React.Fragment> | ||
); | ||
}) | ||
) | ||
} | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
import React from 'react'; | ||
import { mount } from 'cypress/react' | ||
import AuthorAvatars from '../../components/AuthorAvatars'; | ||
|
||
describe('AuthorAvatars', () => { | ||
const authors = [ | ||
{ | ||
name: 'John Doe', | ||
photo: 'https://example.com/john-doe.jpg', | ||
link: 'https://example.com/john-doe' | ||
}, | ||
{ | ||
name: 'Jane Smith', | ||
photo: 'https://example.com/jane-smith.jpg', | ||
link: 'https://example.com/jane-smith' | ||
} | ||
]; | ||
|
||
|
||
it('renders the author avatars without links', () => { | ||
const authorsWithoutLinks = [ | ||
{ | ||
name: 'John Doe', | ||
photo: 'https://example.com/john-doe.jpg', | ||
link: null | ||
}, | ||
{ | ||
name: 'Jane Smith', | ||
photo: 'https://example.com/jane-smith.jpg', | ||
link: null | ||
}, | ||
]; | ||
mount(<AuthorAvatars authors={authorsWithoutLinks} />); | ||
authorsWithoutLinks.forEach((author, index) => { | ||
cy.get('a') | ||
.should('not.exist'); | ||
|
||
cy.get('img') | ||
.eq(index) | ||
.should('have.attr', 'src', author.photo) | ||
.should('have.attr', 'title', author.name) | ||
.should('have.class', index > 0 ? `absolute left-${index * 7} top-0` : `relative mr-${(authorsWithoutLinks.length - 1) * 7}`) | ||
.should('have.class', `z-${(authorsWithoutLinks.length - 1 - index) * 10}`) | ||
.should('have.class', 'h-10 w-10 border-2 border-white rounded-full object-cover hover:z-50'); | ||
}); | ||
}); | ||
|
||
|
||
|
||
it('renders the author avatars with links', () => { | ||
mount(<AuthorAvatars authors={authors} />); | ||
authors.forEach((author, index) => { | ||
cy.get(`a[alt="${author.name}"][href="${author.link}"]`) | ||
.should('have.length', 1) | ||
.within(() => { | ||
cy.get('img') | ||
.should('have.attr', 'src', author.photo) | ||
.should('have.attr', 'title', author.name) | ||
.should('have.class', index > 0 ? `absolute left-${index * 7} top-0` : `relative mr-${(authors.length - 1) * 7}`) | ||
.should('have.class', `z-${(authors.length - 1 - index) * 10}`) | ||
.should('have.class', 'h-10 w-10 border-2 border-white rounded-full object-cover hover:z-50'); | ||
}); | ||
}); | ||
}); | ||
|
||
|
||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import React from 'react'; | ||
import { mount } from 'cypress/react'; | ||
import DemoAnimation from '../../components/DemoAnimation'; | ||
|
||
describe('DemoAnimation', () => { | ||
it('renders without errors', () => { | ||
mount(<DemoAnimation />); | ||
|
||
cy.wait(100000); | ||
cy.contains('Play with it!').should('be.visible'); | ||
}); | ||
|
||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import React from 'react'; | ||
import { mount } from 'cypress/react'; | ||
import Figure from '../../components/Figure'; | ||
|
||
describe('Figure', () => { | ||
it('renders the figure with the image and caption', () => { | ||
const src = 'example.jpg'; | ||
const caption = 'Example Caption'; | ||
const widthClass = 'w-50'; | ||
const className = 'custom-class'; | ||
const float = 'left'; | ||
const altOnly = 'Alt Text'; | ||
const imageClass = 'custom-image-class'; | ||
|
||
mount( | ||
<Figure | ||
src={src} | ||
caption={caption} | ||
widthClass={widthClass} | ||
className={className} | ||
float={float} | ||
altOnly={altOnly} | ||
imageClass={imageClass} | ||
/> | ||
); | ||
|
||
cy.get('[data-testid="Figure-div"]').should('have.class', className); | ||
cy.get('[data-testid="Figure-div"]').should('have.class', `float-${float}`); | ||
cy.get('[data-testid="Figure-div"]').should('have.class', widthClass); | ||
|
||
cy.get('[data-testid="Figure-img"]').should('have.attr', 'src', src); | ||
cy.get('[data-testid="Figure-img"]').should('have.attr', 'alt', altOnly); | ||
cy.get('[data-testid="Figure-img"]').should('have.class', imageClass); | ||
|
||
cy.contains('Caption').should('be.visible'); | ||
cy.contains('Caption').should('have.text', caption); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { mount } from 'cypress/react'; | ||
import Hero from '../../components/Hero'; | ||
|
||
describe('Hero Component', () => { | ||
it('displays the correct content', () => { | ||
mount(<Hero />); | ||
|
||
cy.contains('Building the future of'); | ||
cy.contains('Event-Driven Architectures (EDA)'); | ||
cy.contains('Open-Source tools to easily build and maintain your event-driven architecture.'); | ||
cy.contains('Read the docs'); | ||
cy.contains('Quick search...'); | ||
cy.contains('Proud to be part of the Linux Foundation'); | ||
}); | ||
|
||
it('navigates to the documentation page when "Read the docs" button is clicked', () => { | ||
mount(<Hero />); | ||
cy.get('[data-testid="Button-link"]').contains('Read the docs').click(); | ||
|
||
}); | ||
|
||
it('performs a search when the search button is clicked', () => { | ||
mount(<Hero />); | ||
|
||
cy.get('[data-testid="Search-Button"]').contains('Quick search...').click(); | ||
|
||
// Type a search query and validate the results | ||
const searchQuery = 'example'; | ||
cy.get('input[type="search"]').type(searchQuery); | ||
|
||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { mount } from "cypress/react"; | ||
import Meeting from "../../components/Meeting"; | ||
describe('Meeting component', () => { | ||
it('renders correctly with provided props', () => { | ||
const props = { | ||
name: 'Example Meeting', | ||
purpose: 'Discuss important topics', | ||
host: 'John Doe', | ||
hostProfile: 'https://example.com/profile', | ||
youtube: 'https://www.youtube.com/watch?v=ABC123', | ||
bg: 'blue', | ||
}; | ||
|
||
mount(<Meeting {...props} />); | ||
|
||
cy.get('[data-testid="Meeting-heading"]').should('have.text', 'Example Meeting'); | ||
cy.get('[ data-testid="Meeting-paragraph"]').contains('Discuss important topics'); | ||
cy.get('[ data-testid="Meeting-host"]').contains('Host:'); | ||
cy.get('[ data-testid="Meeting-link"]').should('have.attr', 'href', 'https://www.youtube.com/watch?v=ABC123'); | ||
|
||
}); | ||
}); | ||
|
Oops, something went wrong.