Skip to content

Commit

Permalink
Added tests for mobile interactions
Browse files Browse the repository at this point in the history
  • Loading branch information
MRita443 committed Sep 26, 2023
1 parent ee2544a commit 6885c18
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 0 deletions.
38 changes: 38 additions & 0 deletions src/lib/layout/hexagons/TeamMemberHexagon.stories.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { fireEvent, within } from '@storybook/testing-library';
import { expect } from '@storybook/jest';
import TeamMemberHexagon from './TeamMemberHexagon.svelte';

export default {
Expand All @@ -9,6 +11,42 @@ export default {
}
};

export const MobileHexagon = {
parameters: {
viewport: {
defaultViewport: 'mobile2'
}
},
args: {
data: {
name: 'Bruno Rosendo',
email: 'brunorosendo@gmail.com',
role: 'Co-Gestor de Projetos',
photo: 'images/previews/bruno_rosendo.png',
linkedin: 'https://pt.linkedin.com/',
gitHub: 'https://github.com/',
websites: [{ url: 'https://www.facebook.com/' }]
}
},
play: async ({ canvasElement, step }) => {
const canvas = within(canvasElement);

await step('Open Hexagon', async () => {
const container = await canvas.findByTestId('container');
const role = await canvas.findByTestId('role');
await fireEvent.touchStart(container);
await expect(role).toHaveAttribute('style', 'opacity: 1;');
});

await step('Close Hexagon', async () => {
const container = await canvas.findByTestId('container');
const role = await canvas.findByTestId('role');
await fireEvent.touchStart(container);
await expect(role).toHaveAttribute('style', 'opacity: 0;');
});
}
};

export const CustomIconHexagon = {
args: {
data: {
Expand Down
2 changes: 2 additions & 0 deletions src/lib/layout/hexagons/TeamMemberHexagon.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@
data-state="closed"
>
<div
data-testid="container"
class="container absolute bottom-0 z-20 w-full px-4 duration-500 group-hover:bottom-1/2 group-hover:translate-y-1/3"
>
<p
Expand All @@ -80,6 +81,7 @@
{teamMember.name}
</p>
<p
data-testid="role"
class="full-opacity mx-auto text-center text-xs leading-tight text-gray-100 opacity-0 transition-all duration-500 ease-out group-hover:opacity-100 sm:text-xs md:text-sm lg:text-base xl:text-lg"
>
{teamMember.role}
Expand Down

0 comments on commit 6885c18

Please sign in to comment.