Skip to content

Add ClassLoom e2e tests; fix TableView not syncing node attribute changes - #86

Merged
matthiask merged 2 commits into
mainfrom
classloom-tests-and-table-fix
Jun 8, 2026
Merged

Add ClassLoom e2e tests; fix TableView not syncing node attribute changes#86
matthiask merged 2 commits into
mainfrom
classloom-tests-and-table-fix

Conversation

@matthiask

Copy link
Copy Markdown
Member

Changes Overview

Two related pieces of work:

  1. ClassLoom e2e tests — a new test model and test file covering the ClassLoom extension end-to-end, including paragraph colors (non-combinable) and table layout classes (combinable).
  2. TableView attribute sync fixTableView.update() only re-rendered column widths; node attributes set via addGlobalAttributes (e.g. a class applied by ClassLoom) were visible in the serialized HTML but not in the live editor DOM.

Implementation Approach

Tests:

  • ClassLoomProseEditorModel added to the test app with two ClassLoom groups: paragraphColors (non-combinable, targeting paragraph) and tableLayout (combinable, targeting table). 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 — shared login() helper extracted from test_prose_editor_e2e.py.

TableView fix:
TableView.update() is patched in our Table extension override to call getRenderedAttributes + mergeAttributes on each update, then sync all non-style attributes to tableView.table. The style attribute is left to updateColumns() which manages width/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

  1. tox -e py313-dj52 — all tests pass
  2. Open /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.
  3. Insert a table, click a table layout button — the <table> element should get the class in the live DOM and the saved HTML.

Additional Notes

The Upgrades commit (dependency update) is separate and should be pushed to main directly after rebasing on the current tip.

matthiask and others added 2 commits June 8, 2026 17:59
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>
@matthiask
matthiask merged commit 799be72 into main Jun 8, 2026
5 checks passed
@matthiask
matthiask deleted the classloom-tests-and-table-fix branch June 8, 2026 16:21
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.

1 participant