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 existing tests, added tests for spoilers, and adjusted spoiler logic #8

Merged
merged 3 commits into from
Apr 12, 2024

Conversation

hjiangsu
Copy link
Member

This PR contains the following changes:

  • Fixed all existing tests that were failing
  • Added some spoiler tests for formatting to markdown, and widget tests
  • Adjusted some of the logic for how spoilers are created. This is to allow inline selection of content to create spoilers
    • Additionally, I've adjusted to cursor positioning so that the cursor lands at the end of the spoiler body
ecdb9a7f-2320-4b72-aaf3-41a1bd1300dd.mp4

Copy link
Member

@micahmo micahmo left a comment

Choose a reason for hiding this comment

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

LGTM!

  • Adjusted some of the logic for how spoilers are created. This is to allow inline selection of content to create spoilers
    • Additionally, I've adjusted to cursor positioning so that the cursor lands at the end of the spoiler body

Just curious, but was there a regression? Looking back at the demo in #6 both of these things worked.

@hjiangsu
Copy link
Member Author

Just curious, but was there a regression? Looking back at the demo in #6 both of these things worked.

selection of content to create spoilers

For this, I believe it was creating the spoiler on the same line which would be invalid!

This is some text ::: spoiler Spoiler
spoiler body
:::

The correct behaviour should be

This is some text
::: spoiler Spoiler
spoiler body
:::

cursor positioning so that the cursor lands at the end of the spoiler body

Trying this again, I cant reproduce my issue. However, I encountered a case previously where it was not inserting the cursor at the right location (it seems like it had something to do with selectedText being an empty string)

@hjiangsu
Copy link
Member Author

I also added a commit which fixes a couple more edge cases that I found!

487b6002-8296-4ce1-8432-b38251006457.mp4

@micahmo
Copy link
Member

micahmo commented Apr 12, 2024

Cool, thanks! Looks good!

@hjiangsu hjiangsu merged commit a59db6b into master Apr 12, 2024
1 check passed
@hjiangsu hjiangsu deleted the fix/tests branch April 12, 2024 15:24
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.

2 participants