Add ClassLoom e2e tests; fix TableView not syncing node attribute changes - #86
Merged
Conversation
Adds a ClassLoom test model (paragraph colors + combinable table-layout classes) and a new e2e test file covering both non-combinable and combinable class groups, including live DOM assertions. Extracts the shared login helper into tests/testapp/e2e_utils.py so it can be reused across e2e test files. Also fixes TableView not reflecting node attribute changes (e.g. a class set via addGlobalAttributes) in the live editor DOM. TableView.update() only re-rendered columns; we patch it with a getHTMLAttributes callback that recomputes fresh merged HTMLAttributes via getRenderedAttributes on each update. An upstream fix has been proposed at ueberdosis/tiptap#7925. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changes Overview
Two related pieces of work:
TableView.update()only re-rendered column widths; node attributes set viaaddGlobalAttributes(e.g. aclassapplied by ClassLoom) were visible in the serialized HTML but not in the live editor DOM.Implementation Approach
Tests:
ClassLoomProseEditorModeladded to the test app with two ClassLoom groups:paragraphColors(non-combinable, targetingparagraph) andtableLayout(combinable, targetingtable). Menu groups use button groups for easy Playwright interaction.tests/testapp/test_classloom_e2e.py— seven tests asserting toolbar active state, live DOM class presence, and saved model HTML for both non-combinable (apply, switch, remove) and combinable (apply multiple, toggle off one, clear all) behaviours.tests/testapp/e2e_utils.py— sharedlogin()helper extracted fromtest_prose_editor_e2e.py.TableView fix:
TableView.update()is patched in ourTableextension override to callgetRenderedAttributes+mergeAttributeson each update, then sync all non-styleattributes totableView.table. Thestyleattribute is left toupdateColumns()which manageswidth/minWidth. An upstream fix has been proposed at ueberdosis/tiptap#7925.Testing Done
All 47 tests pass (
tox -e py313-dj52), including the 7 new e2e tests which assert both the live DOM state and the saved model content.Verification Steps
tox -e py313-dj52— all tests pass/admin/testapp/classloomproseeditormodel/add/, type a paragraph, click a color button — the<p>element should get the class in the live editor DOM and the saved HTML.<table>element should get the class in the live DOM and the saved HTML.Additional Notes
The
Upgradescommit (dependency update) is separate and should be pushed tomaindirectly after rebasing on the current tip.