Skip to content

887-refactor: Partners refactor #892

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 14 commits into
base: main
Choose a base branch
from

Conversation

HelenaIsh
Copy link
Collaborator

@HelenaIsh HelenaIsh commented May 13, 2025

What type of PR is this? (select all that apply)

  • πŸ• Feature
  • πŸ› Bug Fix
  • 🚧 Breaking Change
  • πŸ§‘β€πŸ’» Code Refactor
  • πŸ“ Documentation Update

Description

Refactor partnered module

Related Tickets & Documents

Screenshots, Recordings

I changed a little bit styles for tablets and mobiles

Before After
Tablet image image
Mobile image image

Added/updated tests?

  • πŸ‘Œ Yes
  • πŸ™…β€β™‚οΈ No, because they aren't needed
  • πŸ™‹β€β™‚οΈ No, because I need help

[optional] Are there any post deployment tasks we need to perform?

[optional] What gif best describes this PR or how it makes you feel?

@github-actions github-actions bot changed the title refactor: 887 - refactor partnered module 887-refactor: Partners refactor May 13, 2025
Copy link

Lighthouse Report:

  • Performance: 80 / 100
  • Accessibility: 96 / 100
  • Best Practices: 100 / 100
  • SEO: 100 / 100

View detailed report

Copy link

Lighthouse Report:

  • Performance: 72 / 100
  • Accessibility: 96 / 100
  • Best Practices: 100 / 100
  • SEO: 100 / 100

View detailed report

@HelenaIsh HelenaIsh self-assigned this May 13, 2025
Copy link
Collaborator

@YulikK YulikK left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see that the only test that is in the component does not check anything. Let's add unit tests that check the content output. Title, src and alt logos

Copy link

Lighthouse Report:

  • Performance: 85 / 100
  • Accessibility: 96 / 100
  • Best Practices: 100 / 100
  • SEO: 100 / 100

View detailed report

@HelenaIsh HelenaIsh requested a review from YulikK May 15, 2025 09:29
<WidgetTitle size="small">Partnered with</WidgetTitle>
<div className="partners">
<div className="partner-logo-container">
<ul className={cx('partners')}>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we use the structure like in Alumni widget?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand a point of keeping a similar HTML structure in all our widgets

Difference for now:

Alumni

<article>
  <section>
    <WidgetTitle />
    <Paragraph />
    <section>
      {alumni.map(() => (
        <figure>
          <Image />
        </figure>
      ))}
    </section>
  </section>
</article>

Partnered

<section>
  <div>
    <WidgetTitle />
    <ul>
      {partners.map(() => (
        <li>
          <Component />
        </li>
      ))}
    </ul>
  </div>
</section>
  • All containers in widgets have section tag.
  • I't strange to have article->section->section structure
  • lists usually use ul->li tags

Therefore, I suggest to keep partnered html structure in both partnered and alumni widgets

Comment on lines 15 to 23
<li className={cx('partner-logo-container')}>
<JetBrainsLogo />
</li>
<li className={cx('partner-logo-container')}>
<AwsLogo />
</li>
<li className={cx('partner-logo-container')}>
<GithubLogo />
</li>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we put our logos in the array above and then output them in a loop in the component? Even for 3 components it would look better.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a good idea - I also moved the array of logos to constants file

Comment on lines 11 to 15
render(<Partnered />);

expect(screen.getByText('Partnered with')).toBeInTheDocument();

expect(screen.getByTestId('widget-title')).toBeInTheDocument();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you look tests for AboutCourse, for example. How we checkin the content.
const title = await screen.findByTestId('widget-title'); expect(title).toBeVisible(); expect(title.textContent).toBe('About the course');

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I rewrote the test for checking the correct content to be similar to AboutCourse one

Comment on lines 19 to 27
render(<Partnered />);

const logos = screen.getAllByRole('img');

expect(logos).toHaveLength(3);

expect(screen.getByAltText('jetbrains icon')).toHaveAttribute('src', jetbrains.src);
expect(screen.getByAltText('AWS icon')).toHaveAttribute('src', aws.src);
expect(screen.getByAltText('github icon')).toHaveAttribute('src', github.src);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you look test for TrainingProgram. Its a good example for check img property
const image = screen.getByTestId('image'); expect(image).toHaveAttribute('alt', expect.stringContaining('AWS Cloud Developer')); expect(image).toHaveAttribute('src', awsDevImg.src);

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I rewrote the test for checking logos to directly verify alt and src attributes

Comment on lines 25 to 27
expect(screen.getByAltText('jetbrains icon')).toHaveAttribute('src', jetbrains.src);
expect(screen.getByAltText('AWS icon')).toHaveAttribute('src', aws.src);
expect(screen.getByAltText('github icon')).toHaveAttribute('src', github.src);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please make an array with src and alt properties for every logo and use it.each syntax for this test. You can see example in other test where we use it.each

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Copy link

Lighthouse Report:

  • Performance: 84 / 100
  • Accessibility: 96 / 100
  • Best Practices: 100 / 100
  • SEO: 100 / 100

View detailed report

@HelenaIsh HelenaIsh requested review from YulikK and ansivgit May 16, 2025 11:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Partners fsd refactor
4 participants