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

fix: corrects behavior of style removal #3261

Merged
merged 7 commits into from
Jun 10, 2020
Rate limit · GitHub

Access has been restricted

You have triggered a rate limit.

Please wait a few minutes before you try again;
in some cases this may take up to an hour.

Conversation

nicholasrice
Copy link
Contributor

@nicholasrice nicholasrice commented Jun 9, 2020

Description

I noticed when using Controller.removeStyles(ElementStyles) that the method was removing all styles except the styles I was trying to remove. This corrects that behavior.

The removal method invokes the Array.prototype.filter method, where a callback returning true keeps the item and returning false removes the item. AdoptedStyleSheetsStyles.removeStylesFrom was returning false for all stylesheets that were not associated to the AdoptedStyleSheetsStyles instance, and true for all that were. This is the opposite behavior that we want.

Motivation & context

Issue type checklist

  • Chore: A change that does not impact distributed packages.
  • Bug fix: A change that fixes an issue, link to the issue above.
  • New feature: A change that adds functionality.

Is this a breaking change?

  • This change causes current functionality to break.

Adding or modifying component(s) in @microsoft/fast-components checklist

Process & policy checklist

  • I have added tests for my changes.
  • I have tested my changes.
  • I have updated the project documentation to reflect my changes.
  • I have read the CONTRIBUTING documentation and followed the standards for this project.
Rate limit · GitHub

Access has been restricted

You have triggered a rate limit.

Please wait a few minutes before you try again;
in some cases this may take up to an hour.

Copy link
Contributor

@EisenbergEffect EisenbergEffect left a comment

Choose a reason for hiding this comment

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

LOL Definitely need to add more unit tests :)

@nicholasrice
Copy link
Contributor Author

Seeing if I can add one for this real quickly ;)

@EisenbergEffect
Copy link
Contributor

@nicholasrice If you could add a single unit test for this case, I can come in tomorrow and fill in the rest of the cases for the Controller. Would be good to capture this as part of the bug fix though.

@nicholasrice nicholasrice force-pushed the users/nirice/fix-style-removal-behavior branch from 8c3ef7e to b40ea34 Compare June 10, 2020 01:29
@EisenbergEffect EisenbergEffect merged commit e37b7ab into master Jun 10, 2020
@EisenbergEffect EisenbergEffect deleted the users/nirice/fix-style-removal-behavior branch June 10, 2020 14:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Rate limit · GitHub

Access has been restricted

You have triggered a rate limit.

Please wait a few minutes before you try again;
in some cases this may take up to an hour.

3 participants