summaryrefslogtreecommitdiff
path: root/test/models/helpers
diff options
context:
space:
mode:
authorerdgeist <erdgeist@erdgeist.org>2026-07-16 13:50:15 +0200
committererdgeist <erdgeist@erdgeist.org>2026-07-16 13:50:15 +0200
commit603ccfbd5fe96f0b83aaf3d5118aded2a39992fb (patch)
tree0e88ec41af6ce1a03e65bedb3f68a5a9881d96bb /test/models/helpers
parentbb7ef80d084f474bb4c3be0ae0d033aff3de0272 (diff)
Condense the action log into a scannable table
Several minor improvements to the action log presentation: * Now a table with date and human readable presentation as rows is displayed * If no changes in a title were detected, the old version is omitted * The "inferred" flag is demoted to the end of the line * You can zoom in on the node's history directly from a log line * byline for the first publish action is preserved * Revisions are directly linked to when a new one i published
Diffstat (limited to 'test/models/helpers')
-rw-r--r--test/models/helpers/node_actions_helper_test.rb32
1 files changed, 27 insertions, 5 deletions
diff --git a/test/models/helpers/node_actions_helper_test.rb b/test/models/helpers/node_actions_helper_test.rb
index 93bbdf6..5244c19 100644
--- a/test/models/helpers/node_actions_helper_test.rb
+++ b/test/models/helpers/node_actions_helper_test.rb
@@ -21,12 +21,13 @@ class NodeActionsHelperTest < ActionView::TestCase
21 "human_readable_node_name" => "Subject" }.merge(metadata)) 21 "human_readable_node_name" => "Subject" }.merge(metadata))
22 end 22 end
23 23
24 test "publish renders the title pair" do 24 test "publish renders the revision sentence, not the titles" do
25 out = action_summary(entry("publish", 25 out = action_summary(entry("publish",
26 { "via" => "draft", "title" => { "from" => "Old", "to" => "New" } })) 26 { "via" => "draft", "title" => { "from" => "Old", "to" => "New" } }))
27 27
28 assert_includes out, "quentin" 28 assert_includes out, "quentin"
29 assert_includes out, "Old" 29 assert_includes out, "new revision"
30 assert_not_includes out, "Old"
30 end 31 end
31 32
32 test "first publish uses its own sentence" do 33 test "first publish uses its own sentence" do
@@ -68,10 +69,8 @@ class NodeActionsHelperTest < ActionView::TestCase
68 69
69 test "metadata values are escaped" do 70 test "metadata values are escaped" do
70 out = action_summary(entry("publish", 71 out = action_summary(entry("publish",
71 { "human_readable_node_name" => "<b>bold</b>", 72 { "human_readable_node_name" => "<b>bold</b>" }))
72 "title" => { "from" => "<script>alert(1)</script>", "to" => "x" } }))
73 73
74 assert_not_includes out, "<script>"
75 assert_not_includes out, "<b>" 74 assert_not_includes out, "<b>"
76 end 75 end
77 76
@@ -82,4 +81,27 @@ class NodeActionsHelperTest < ActionView::TestCase
82 81
83 assert_includes out, "<a " 82 assert_includes out, "<a "
84 end 83 end
84
85 test "details are guarded off when nothing but an unchanged title is present" do
86 unchanged = entry("publish", { "title" => { "from" => "Same", "to" => "Same" } })
87 changed = entry("publish", { "title" => { "from" => "Old", "to" => "New" } })
88
89 assert_not action_details?(unchanged)
90 assert action_details?(changed)
91 end
92
93 test "first publish with a byline names the author" do
94 out = action_summary(entry("publish",
95 { "title" => { "from" => nil, "to" => "New" },
96 "author" => { "from" => nil, "to" => "quentin" } }))
97
98 assert_includes out, "author"
99 end
100
101 test "create entries with their flat title render and are guarded off details" do
102 e = entry("create", { "title" => "Initial", "path" => "a/b" })
103
104 assert_includes action_summary(e), "a/b"
105 assert_not action_details?(e)
106 end
85end 107end