From 42755ebf5b386fa4f2ff4644bcf487a41ba0ab4f Mon Sep 17 00:00:00 2001 From: Damian Mooyman Date: Fri, 1 Aug 2014 12:03:07 +1200 Subject: [PATCH] Tests for https://github.com/silverstripe/silverstripe-framework/pull/3347 --- tests/behat/features/insert-a-link.feature | 23 +++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/tests/behat/features/insert-a-link.feature b/tests/behat/features/insert-a-link.feature index be57ac3c..055be288 100644 --- a/tests/behat/features/insert-a-link.feature +++ b/tests/behat/features/insert-a-link.feature @@ -7,6 +7,7 @@ So that I can link to a external website or a page on my site Background: Given a "page" "Home" And a "page" "About Us" has the "Content" "My awesome content" + And a "page" "Details" has the "Content" "My sub-par content" And a "file" "assets/file1.jpg" And I am logged in with "ADMIN" permissions And I go to "/admin/pages" @@ -24,6 +25,18 @@ So that I can link to a external website or a page on my site # Required to avoid "unsaved changes" browser dialog Then I press the "Save draft" button + Scenario: I can link to an anchor in an internal page + Given I select "awesome" in the "Content" HTML field + And I press the "Insert Link" button + And I select the "Page on the site" radio button + And I fill in the "Page" dropdown with "Details" + And I wait for 1 second + And I select "youranchor" from "Form_EditorToolbarLinkForm_AnchorSelector" + And I press the "Insert link" button + Then the "Content" HTML field should contain "awesome" + # Required to avoid "unsaved changes" browser dialog + Then I press the "Save draft" button + Scenario: I can link to an external URL Given I select "awesome" in the "Content" HTML field And I press the "Insert Link" button @@ -46,18 +59,18 @@ So that I can link to a external website or a page on my site Then I press the "Save draft" button Scenario: I can link to an anchor - Given I fill in the "Content" HTML field with "

My awesome content

" + Given I fill in the "Content" HTML field with "

My awesome content

" And I select "awesome" in the "Content" HTML field When I press the "Insert Link" button When I select the "Anchor on this page" radio button - And I fill in "myanchor" for "Anchor" + And I select "myanchor" from "Form_EditorToolbarLinkForm_AnchorSelector" And I press the "Insert link" button Then the "Content" HTML field should contain "awesome" # Required to avoid "unsaved changes" browser dialog Then I press the "Save draft" button Scenario: I can edit a link - Given I fill in the "Content" HTML field with "

My awesome content" + Given I fill in the "Content" HTML field with "

My awesome content" And I select "awesome" in the "Content" HTML field When I press the "Insert Link" button # We need to hard-code the id attribute, if you say 'Then the URL field', it picks up URLSegment instead. @@ -70,10 +83,10 @@ So that I can link to a external website or a page on my site Then I press the "Save draft" button Scenario: I can remove a link - Given I fill in the "Content" HTML field with "My awesome content" + Given I fill in the "Content" HTML field with "My awesome content" And I select "awesome" in the "Content" HTML field When I press the "Unlink" button Then the "Content" HTML field should contain "My awesome content" And the "Content" HTML field should not contain "http://silverstripe.org" # Required to avoid "unsaved changes" browser dialog - Then I press the "Save draft" button \ No newline at end of file + Then I press the "Save draft" button