From 36ba47604ff72cfcea54b01f47bce31d273984ff Mon Sep 17 00:00:00 2001 From: Kevin Ansfield Date: Tue, 4 Jun 2024 19:46:39 +0100 Subject: [PATCH] Added Admin acceptance test for post revision restoration ref https://linear.app/tryghost/issue/ENG-1078 - adds required setup for acceptance testing post revisions - adds happy-path test for listing, previewing, and restoring a post revision --- ghost/admin/.lint-todo | 4 + .../app/components/modal-post-history.hbs | 32 ++- .../app/components/modal-post-history.js | 46 ++-- .../components/modals/restore-revision.hbs | 3 +- .../app/components/modals/restore-revision.js | 3 + ghost/admin/mirage/factories/post-revision.js | 5 + ghost/admin/mirage/models/page.js | 2 +- ghost/admin/mirage/models/post-revision.js | 6 + ghost/admin/mirage/models/post.js | 3 +- ghost/admin/mirage/models/user.js | 3 +- .../admin/mirage/serializers/post-revision.js | 9 + ghost/admin/mirage/serializers/post.js | 20 +- ghost/admin/package.json | 3 +- .../acceptance/editor/post-revisions-test.js | 78 ++++++ yarn.lock | 247 +++++++++--------- 15 files changed, 294 insertions(+), 170 deletions(-) create mode 100644 ghost/admin/mirage/factories/post-revision.js create mode 100644 ghost/admin/mirage/models/post-revision.js create mode 100644 ghost/admin/mirage/serializers/post-revision.js create mode 100644 ghost/admin/tests/acceptance/editor/post-revisions-test.js diff --git a/ghost/admin/.lint-todo b/ghost/admin/.lint-todo index 81cae4ab86..5e6e66fb1a 100644 --- a/ghost/admin/.lint-todo +++ b/ghost/admin/.lint-todo @@ -190,3 +190,7 @@ add|ember-template-lint|require-iframe-title|42|16|42|16|a3292b469dc37f2f4791e7f add|ember-template-lint|no-autofocus-attribute|21|20|21|20|942419d05c04ded6716f09faecd6b1ab55418121|1712707200000|1723075200000|1728259200000|app/components/modals/new-custom-integration.hbs add|ember-template-lint|no-invalid-interactive|2|37|2|37|e21ba31f54b631a428c28a1c9f88d0dc66f2f5fc|1712707200000|1723075200000|1728259200000|app/components/modals/search.hbs remove|ember-template-lint|no-unknown-arguments-for-builtin-components|93|93|93|93|156670ca427c49c51f0a94f862b286ccc9466d92|1712707200000|1723075200000|1728259200000|app/components/gh-nav-menu/footer.hbs +remove|ember-template-lint|no-action|20|125|20|125|ba0f8b6ba2697f1b071200d1a3dae9c34fcb2882|1712707200000|1723075200000|1728259200000|app/components/modal-post-history.hbs +remove|ember-template-lint|no-action|31|34|31|34|141d456b03124abca146e58e4ae15825fdd040bb|1712707200000|1723075200000|1728259200000|app/components/modal-post-history.hbs +remove|ember-template-lint|no-action|43|46|43|46|2f3118270fbb1ff6e5da6b0d482ccd21e69df3b5|1712707200000|1723075200000|1728259200000|app/components/modal-post-history.hbs +remove|ember-template-lint|require-valid-alt-text|12|28|12|28|bc0bb4f51567cea7289bfcb30d02932f0f57d0d9|1712707200000|1723075200000|1728259200000|app/components/modal-post-history.hbs diff --git a/ghost/admin/app/components/modal-post-history.hbs b/ghost/admin/app/components/modal-post-history.hbs index 4795ea8103..cdfca99eb7 100644 --- a/ghost/admin/app/components/modal-post-history.hbs +++ b/ghost/admin/app/components/modal-post-history.hbs @@ -1,6 +1,6 @@ {{!-- template-lint-disable no-invalid-interactive --}}
-
+
{{#if this.selectedHTML}} {{{this.selectedHTML}}} @@ -9,15 +9,23 @@
{{#if this.selectedRevision.feature_image}} - + {{this.selectedRevision.feature_image_alt}} {{/if}} {{#if this.selectedRevision.feature_image_caption}} -

{{{this.selectedRevision.feature_image_caption}}}

+

{{{this.selectedRevision.feature_image_caption}}}

{{/if}}
-
{{this.currentTitle}}
- +
{{this.currentTitle}}
+
@@ -28,7 +36,8 @@ aria-label="Close meta data panel" class="back settings-menu-header-action" data-test-button="close-psm-subview" - type="button" {{action "closeModal"}} + type="button" + {{on "click" this.closeModal}} {{on "mousedown" (optional this.noop)}} > {{svg-jar "arrow-left"}} @@ -39,19 +48,19 @@