File tree Expand file tree Collapse file tree 2 files changed +18
-1
lines changed
Expand file tree Collapse file tree 2 files changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -24,7 +24,7 @@ class="comment-box">
2424 @else
2525 {{ trans (' common.deleted_user' ) } }
2626 @endif
27- <span title =" {{ $comment -> created_at } }" >  ; {{ trans (' entities.comment_created' , [' createDiff' => $comment -> created ]) } } </span >
27+ <span title =" {{ $comment -> created_at } }" >  ; {{ trans (' entities.comment_created' , [' createDiff' => $comment -> created_at -> diffForHumans () ]) } } </span >
2828 @if ($comment -> isUpdated () )
2929 <span class =" mx-xs" >&bull ; </span >
3030 <span title =" {{ trans (' entities.comment_updated' , [' updateDiff' => $comment -> updated_at , ' username' => $comment -> updatedBy -> name ?? trans (' common.deleted_user' )]) } }" >
Original file line number Diff line number Diff line change @@ -214,4 +214,21 @@ public function test_comment_editor_js_loaded_with_create_or_edit_permissions()
214214 $ resp ->assertSee ('window.editor_translations ' , false );
215215 $ resp ->assertSee ('component="entity-selector" ' , false );
216216 }
217+
218+ public function test_comment_displays_relative_times ()
219+ {
220+ $ page = $ this ->entities ->page ();
221+ $ comment = Comment::factory ()->create (['entity_id ' => $ page ->id , 'entity_type ' => $ page ->getMorphClass ()]);
222+ $ comment ->created_at = now ()->subWeek ();
223+ $ comment ->updated_at = now ()->subDay ();
224+ $ comment ->save ();
225+
226+ $ pageResp = $ this ->asAdmin ()->get ($ page ->getUrl ());
227+ $ html = $ this ->withHtml ($ pageResp );
228+
229+ // Create date shows relative time as text to user
230+ $ html ->assertElementContains ('.comment-box ' , 'commented 1 week ago ' );
231+ // Updated indicator has full time as title
232+ $ html ->assertElementContains ('.comment-box span[title^="Updated ' . $ comment ->updated_at ->format ('Y-m-d ' ) . '"] ' , 'Updated ' );
233+ }
217234}
You can’t perform that action at this time.
0 commit comments