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 test file contents to Svelte #407

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

DanielKrasny
Copy link
Contributor

Closes #397.
Test files are hidden by default and should be opened manually. The file contents is loaded after the first "unfold" of a card.

Closes mrlvsb#397.
Test files are hidden by default and should be opened manually.
The file contents is loaded after the first "unfold" of a card.
Copy link
Collaborator

@Kobzol Kobzol left a comment

Choose a reason for hiding this comment

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

Thanks, this looks great!

I wonder if it's not too much hiding though, because in many cases, the tests are small, and now users will have to do a lot of clicking (and a lot of network requests) to show them.

I think that we might do something like this instead:

  1. Show the test by default (by inlining the content from Django) if it's "small". "small" should not be 65 KiB, but let's say something up to ~100 lines, so let's say up to 8 KiB.
  2. If the test is hidden, load it after clicking on the header, and then ignore the inline size limit, and always show the result (the inline part is important to avoid making the whole page HTML too big, but that's not such an issue when we load it lazily).

@geordi What do you think?

templates/web/task_detail.html Outdated Show resolved Hide resolved
frontend/src/TestFile.svelte Outdated Show resolved Hide resolved
frontend/src/TestFile.svelte Outdated Show resolved Hide resolved
Maximum inline bytes is not a constant in frontend anymore. The backend value is passed as a prop instead.
Modified the card size to correspond with previous solution.
Added missing student URL query.
@DanielKrasny
Copy link
Contributor Author

I looked over your review and fixed some issues. Test files are now open by default. However, I was unable to pass file contents from Django effectively (e.g. through slot), since this can be made in component's constructor only by using Svelte's internal methods and I don't find that solution forward compatible. That's why I'm still loading all test files as separate network requests.

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.

Foldable inputs in and outputs in tests
2 participants