Skip to content
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

Move theming support from Beta to Main #44

Merged
merged 16 commits into from
Sep 30, 2024
Merged

Move theming support from Beta to Main #44

merged 16 commits into from
Sep 30, 2024

Conversation

jordanjones243
Copy link
Contributor

@jordanjones243 jordanjones243 commented Aug 16, 2024

Alaska Airlines Pull Request

Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change.

Resolves: #37, #41

Summary:

Please summarize the scope of the changes you have submitted, what the intent of the work is and anything that describes the before/after state of the project.

Type of change:

Please delete options that are not relevant.

  • New capability
  • Revision of an existing capability
  • Infrastructure change (automation, etc.)
  • Other (please elaborate)

Checklist:

  • My update follows the CONTRIBUTING guidelines of this project
  • I have performed a self-review of my own update

By submitting this Pull Request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

Pull Requests will be evaluated by their quality of update and whether it is consistent with the goals and values of this project. Any submission is to be considered a conversation between the submitter and the maintainers of this project and may require changes to your submission.

Thank you for your submission!

-- Auro Design System Team

Summary by Sourcery

Move theming support for the auro-toast component from beta to main, enabling customization through design tokens. Refactor the component to use dynamic icons and versioned components, and update the styling to leverage design tokens. Enhance documentation with theming examples and update tests to ensure compatibility with the new features.

New Features:

  • Introduce theming support for the auro-toast component, allowing customization through design tokens.

Enhancements:

  • Refactor the auro-toast component to use dynamic named icons and custom versioned components for better maintainability and performance.
  • Update the styling of the auro-toast component to use design tokens, replacing hard-coded values for improved consistency and flexibility.

Documentation:

  • Add documentation on theme support for the auro-toast component, including examples of how to restyle the component using design tokens.

Tests:

  • Update tests for the auro-toast component to reflect changes in the close button and icon handling, ensuring proper functionality with the new theming and icon system.

Chores:

  • Update the changelog to reflect the latest changes and improvements in the auro-toast component.

jordanjones243 and others added 10 commits July 8, 2024 18:28
# [1.2.0-beta.1](v1.1.6...v1.2.0-beta.1) (2024-07-09)

### Bug Fixes

* **hover:** corrects minor visual jump in close button on hover ([7e1a45d](7e1a45d))

### Features

* refactor color token structure with tier 3 tokens [#37](#37) ([4c3e3ce](4c3e3ce))

### Performance Improvements

* replace hard coded values with tokens ([f31eb13](f31eb13))
# [1.2.0-beta.2](v1.2.0-beta.1...v1.2.0-beta.2) (2024-07-20)

### Features

* **version:** implement custom versioned components ([f0c717c](f0c717c))

### Performance Improvements

* **icon:** update to use dynamic named icon ([22939fd](22939fd))
@jordanjones243 jordanjones243 self-assigned this Aug 16, 2024
@jordanjones243 jordanjones243 requested a review from a team as a code owner August 16, 2024 15:39
Copy link

sourcery-ai bot commented Aug 16, 2024

Reviewer's Guide by Sourcery

This pull request moves theming support from Beta to Main for the auro-toast component. The changes include significant refactoring of the component's structure, styling, and functionality to improve theming capabilities and align with design system standards. Key changes include updating icon handling, implementing custom versioned components, refactoring color token structure, and improving accessibility.

File-Level Changes

Files Changes
src/auro-toast.js Refactored icon handling to use dynamic named icons and custom SVG elements
src/auro-toast.js
src/buttonVersion.js
src/iconVersion.js
Implemented custom versioned components for buttons and icons
src/auro-toast.js Updated component structure to use auro-button for the close button
src/style.scss
src/color.scss
src/tokens.scss
Refactored color token structure with tier 3 tokens
src/style.scss Updated styling to use design tokens instead of hard-coded values
src/auro-toast.js Improved accessibility by adding hidden text for the close button
test/auro-toast.test.js Updated tests to reflect new component structure
demo/api.md
docs/partials/api.md
Added theme support documentation
README.md
CHANGELOG.md
Updated README and CHANGELOG to reflect new version and features
README.md Removed CSS custom property fallbacks section from README
web-test-runner.config.mjs Updated web-test-runner configuration

Tips
  • Trigger a new Sourcery review by commenting @sourcery-ai review on the pull request.
  • Continue your discussion with Sourcery by replying directly to review comments.
  • You can change your review settings at any time by accessing your dashboard:
    • Enable or disable the Sourcery-generated pull request summary or reviewer's guide;
    • Change the review language;
  • You can always contact us if you have any questions or feedback.

@CLAassistant
Copy link

CLAassistant commented Aug 16, 2024

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
2 out of 3 committers have signed the CLA.

✅ jason-capsule42
✅ jordanjones243
❌ semantic-release-bot
You have signed the CLA already but the status is still pending? Let us recheck it.

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey @jordanjones243 - I've reviewed your changes - here's some feedback:

Overall Comments:

  • The changes to improve theming support and component flexibility look good. However, the reduction of test coverage thresholds to 0% is concerning. What are your plans to improve test coverage?
Here's what I looked at during the review
  • 🟢 General issues: all looks good
  • 🟢 Security: all looks good
  • 🟡 Testing: 4 issues found
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment to tell me if it was helpful.

<auro-toast id="2" visible> Hello I am a toast! </auro-toast>
`);

const closeButton = el.shadowRoot.querySelector('[part="close-button"]');
Copy link

Choose a reason for hiding this comment

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

suggestion (testing): Update test to check for correct close button selector

The test has been updated to use the new selector for the close button. It's good to see this change, but we should also add an assertion to ensure the button exists before clicking it.

Suggested change
const closeButton = el.shadowRoot.querySelector('[part="close-button"]');
const closeButton = el.shadowRoot.querySelector('[part="close-button"]');
if (!closeButton) {
throw new Error('Close button not found');
}

Comment on lines +35 to +38
await aTimeout(5500);
const root = el.shadowRoot;

expect(toastContainer.classList.contains('hidden')).to.be.true;
await aTimeout(310);
expect(el.visible).to.be.false;
}).timeout(5400);
expect(el.visible).to.be.false;
Copy link

Choose a reason for hiding this comment

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

suggestion (testing): Improve test for auto-hiding toast

The test for auto-hiding the toast after five seconds has been simplified. However, it might be beneficial to add an assertion to check if the toast is visible before the timeout, to ensure it's not hidden prematurely.

Suggested change
await aTimeout(5500);
const root = el.shadowRoot;
expect(toastContainer.classList.contains('hidden')).to.be.true;
await aTimeout(310);
expect(el.visible).to.be.false;
}).timeout(5400);
expect(el.visible).to.be.false;
expect(el.visible).to.be.true;
await aTimeout(5000);
expect(el.visible).to.be.true;
await aTimeout(500);
expect(el.visible).to.be.false;

Comment on lines +46 to +50
await aTimeout(5050);
const root = el.shadowRoot;
const toastContainer = root.querySelector('.toastContainer');

expect(toastContainer.classList.contains('hidden')).to.be.false;
expect(el.visible).to.be.true;
expect(el.visible).to.be.true;
Copy link

Choose a reason for hiding this comment

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

suggestion (testing): Simplify error toast persistence test

The test for error toast not auto-dismissing has been simplified, which is good. Consider adding an assertion at the beginning to ensure the toast is initially visible, providing a more comprehensive test.

Suggested change
await aTimeout(5050);
const root = el.shadowRoot;
const toastContainer = root.querySelector('.toastContainer');
expect(toastContainer.classList.contains('hidden')).to.be.false;
expect(el.visible).to.be.true;
expect(el.visible).to.be.true;
const root = el.shadowRoot;
const toastContainer = root.querySelector('.toastContainer');
expect(el.visible).to.be.true;
expect(toastContainer).to.be.visible;
await aTimeout(5050);
expect(el.visible).to.be.true;
expect(toastContainer).to.be.visible;


console.warn(el.shadowRoot.querySelector('.typeIcon'));
expect(root.querySelector('.typeIcon')).to.not.exist;
});

});
Copy link

Choose a reason for hiding this comment

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

suggestion (testing): Consider adding tests for new functionality

The changes in auro-toast.js introduce new functionality, such as different icons for different variants and the use of auro-button and auro-icon. Consider adding tests to cover these new features and ensure they work as expected.

it('displays correct icon for different variants', async () => {
  const variants = ['success', 'error', 'warning', 'information'];
  for (const variant of variants) {
    const el = await fixture(html`<auro-toast variant="${variant}" visible></auro-toast>`);
    const icon = el.shadowRoot.querySelector('auro-icon');
    expect(icon).to.exist;
    expect(icon.name).to.equal(variant);
  }
});

it('respects noIcon attribute', async () => {
  const el = await fixture(html`<auro-toast noIcon visible></auro-toast>`);
  expect(el.shadowRoot.querySelector('auro-icon')).to.not.exist;
});

jordanjones243 and others added 6 commits September 26, 2024 15:22
BREAKING CHANGE: trigger major release for theming support #37
# [2.0.0-beta.1](v1.2.0-beta.2...v2.0.0-beta.1) (2024-09-26)

### Features

* add tag name as attribute when custom registered ([c140d41](c140d41))

### Performance Improvements

* refactor custom component registration config ([ec76cc7](ec76cc7))
* update dependencies ([2831c72](2831c72))

### BREAKING CHANGES

* trigger major release for theming support #37
@jason-capsule42 jason-capsule42 merged commit a36f5a5 into main Sep 30, 2024
8 of 9 checks passed
@blackfalcon
Copy link
Member

🎉 This PR is included in version 2.0.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@blackfalcon blackfalcon added the released Completed work has been released label Sep 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
released Completed work has been released
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement custom versioned auro components Update color tokens for theming support
5 participants