jupyter / nbgrader

A system for assigning and grading notebooks
https://nbgrader.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
1.3k stars 317 forks source link

Recreate nbgrader widgets after they are disposed. #1773

Closed ykazakov closed 1 year ago

ykazakov commented 1 year ago

Fixes #1772

I did not add tests to reproduce the issue. This would require a bit more work.

github-actions[bot] commented 1 year ago

Binder :point_left: Launch a Binder on branch ykazakov/nbgrader/master

brichet commented 1 year ago

Thanks @ykazakov This also fixes https://github.com/jupyter/nbgrader/issues/1722

It would be great if you could add some tests. I can give some hints if needed.

ykazakov commented 1 year ago

It would be great if you could add some tests. I can give some hints if needed.

I can give it a try. I found relevant functions to open the menus, e.g:

https://github.com/jupyter/nbgrader/blob/05bb458668e3a10136ba0b0df5f432ecab3f9ccb/nbgrader/tests/labextension_ui-tests/tests/test_assignment_list.spec.ts#L92

Any idea how to close the opened tab?

brichet commented 1 year ago

This is the correct function. It may be added to the following test (for assignment list) or a new test can be created. https://github.com/jupyter/nbgrader/blob/05bb458668e3a10136ba0b0df5f432ecab3f9ccb/nbgrader/tests/labextension_ui-tests/tests/test_assignment_list.spec.ts#L155

I think the close icon have the class lm-TabBar-tabCloseIcon, so maybe we could simulate a click on it (be sure to select the correct one if several tabs are opened or if there is another TabBar).

tuncbkose commented 1 year ago

By the way, I submitted an identical pull request two weeks ago (#1756).

ykazakov commented 1 year ago

I have now extended the UI tests upon suggestion of @brichet (with a little of refactoring). The tests fail without the patch.

@tuncbkose sorry I did not notice the identical issue #1722. I noticed that the bug is still present in the latest release 0.8.2, so I did not check for old issues. :-/

brichet commented 1 year ago

Thanks @ykazakov