Skip to content

Commit

Permalink
Merge pull request #293 from creative-commoners/pulls/2.0/otheradmin
Browse files Browse the repository at this point in the history
FIX Handle no trailing slash in other tab of archive admin
  • Loading branch information
GuySartorelli authored Jun 15, 2023
2 parents 6d04908 + 73cc19d commit 2cd9f27
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 12 deletions.
2 changes: 1 addition & 1 deletion client/dist/js/bundle.js

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion client/src/legacy/ArchiveAdmin/ArchiveAdmin.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
* File: ArchiveAdmin.js
*/
import jQuery from 'jquery';
import { joinUrlPaths } from 'lib/urls';

jQuery.entwine('ss', ($) => {
$('.ArchiveAdmin__action--restore').entwine({
Expand All @@ -22,7 +23,7 @@ jQuery.entwine('ss', ($) => {
const othersArchiveUrl = $(this).data('others-archive-url');
if (targetClassName) {
targetClassName = targetClassName.replace(/\\/g, '-');
const url = othersArchiveUrl + targetClassName;
const url = joinUrlPaths(othersArchiveUrl, targetClassName);

$('.cms-container').loadPanel(url, '', { pjax: 'CurrentForm' });
}
Expand Down
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@
"require-dev": {
"phpunit/phpunit": "^9.5",
"squizlabs/php_codesniffer": "^3.7",
"silverstripe/cms": "^5"
"silverstripe/cms": "^5",
"silverstripe/frameworktest": "^1"
},
"scripts": {
"lint": "phpcs src/ tests/",
Expand Down
17 changes: 17 additions & 0 deletions tests/Behat/features/archive-other.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
Feature: Archive admin other tab
As a CMS author
I want to view the other tab in the archive section
So that I can easily switch back to older content

Background:
Given I am logged in with "ADMIN" permissions

Scenario: I can select from the dropdown
When I go to "/admin/archive?others=1"
And I wait 2 seconds
Then I should not see an "#Form_EditForm_Others" element
When I click on the "#Form_EditForm_OtherDropdown_chosen" element
And I wait 1 seconds
And I click "Companies" in the "#Form_EditForm_OtherDropdown_chosen .chosen-results" element
And I wait 1 seconds
Then I should see an "#Form_EditForm_Others" element
5 changes: 3 additions & 2 deletions tests/Behat/features/compare-mode.feature
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,9 @@ Feature: Compare mode
Given I click on "Content" in the header tabs
Then I fill in the "Content" HTML field with "<p>Hello universe</p>"
And I press the "Save" button
# This is a workaround @todo remove when https://github.com/silverstripe/silverstripe-cms/issues/2128 is resolved in framework
And I go to "/admin/pages/history/show/1"
And I wait 3 seconds
And I click on the ".toast__close" element
And I click on "History" in the header tabs
And I wait for 3 seconds
Then I should see a list of versions

Expand Down
13 changes: 7 additions & 6 deletions tests/Behat/features/list-view.feature
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ Feature: View a list of versions
And I press the "Publish" button
And I wait 3 seconds
Then I should see a "Published 'Home' successfully." success toast
# This is a workaround @todo remove when https://github.com/silverstripe/silverstripe-cms/issues/2128 is resolved in framework
And I go to "/admin/pages/history/show/1"
When I click on the ".toast__close" element
And I click on "History" in the header tabs
And I wait for 3 seconds
Then I should see a list of versions
And I should see "EDITOR User" in the author column in version 1
Expand All @@ -41,8 +41,8 @@ Feature: View a list of versions
And I press the "Save" button
And I wait 3 seconds
Then I should see a "Saved 'Home' successfully." success toast
# This is a workaround @todo remove when https://github.com/silverstripe/silverstripe-cms/issues/2128 is resolved in framework
And I go to "/admin/pages/history/show/1"
When I click on the ".toast__close" element
And I click on "History" in the header tabs
And I wait for 3 seconds
Then I should see a list of versions
And I should see "EDITOR User" in the author column in version 1
Expand All @@ -54,8 +54,9 @@ Feature: View a list of versions
Given I should see an edit page form
When I fill in the "Content" HTML field with "<p>Order scenario</p>"
And I press the "Publish" button
And I wait 3 seconds
Then I should see a "Published 'Home' successfully." success toast
# This is a workaround @todo remove when https://github.com/silverstripe/silverstripe-cms/issues/2128 is resolved in framework
And I go to "/admin/pages/history/show/1"
When I click on the ".toast__close" element
And I click on "History" in the header tabs
And I wait for 3 seconds
Then I should see a list of versions in descending order
4 changes: 3 additions & 1 deletion tests/Behat/features/revert-to-a-version.feature
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ Feature: Revert to a version
And I wait 3 seconds
And I fill in the "Content" HTML field with "<p>Second version</p>"
And I press the "Save" button
And I go to "/admin/pages/history/show/1"
And I wait 3 seconds
And I click on the ".toast__close" element
And I click on "History" in the header tabs
And I wait for 3 seconds
Then I should see a list of versions

Expand Down

0 comments on commit 2cd9f27

Please sign in to comment.