Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
bd042d31
Commit
bd042d31
authored
Nov 05, 2020
by
Tom Quirk
Committed by
Phil Hughes
Nov 05, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix wiki specs
Adds :js to support toasts in tests
parent
43290d0d
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
40 additions
and
18 deletions
+40
-18
app/assets/javascripts/pages/shared/wikis/components/delete_wiki_modal.vue
...ripts/pages/shared/wikis/components/delete_wiki_modal.vue
+5
-1
app/assets/javascripts/pages/shared/wikis/wikis.js
app/assets/javascripts/pages/shared/wikis/wikis.js
+7
-0
app/controllers/concerns/wiki_actions.rb
app/controllers/concerns/wiki_actions.rb
+9
-6
changelogs/unreleased/wiki-toast.yml
changelogs/unreleased/wiki-toast.yml
+5
-0
locale/gitlab.pot
locale/gitlab.pot
+7
-4
spec/support/shared_examples/features/wiki/user_deletes_wiki_page_shared_examples.rb
...s/features/wiki/user_deletes_wiki_page_shared_examples.rb
+2
-2
spec/support/shared_examples/features/wiki/user_updates_wiki_page_shared_examples.rb
...s/features/wiki/user_updates_wiki_page_shared_examples.rb
+2
-2
spec/support/shared_examples/features/wiki/user_views_wiki_page_shared_examples.rb
...les/features/wiki/user_views_wiki_page_shared_examples.rb
+3
-3
No files found.
app/assets/javascripts/pages/shared/wikis/components/delete_wiki_modal.vue
View file @
bd042d31
...
...
@@ -41,7 +41,11 @@ export default {
primaryProps
()
{
return
{
text
:
this
.
$options
.
i18n
.
deletePageText
,
attributes
:
{
variant
:
'
danger
'
,
'
data-qa-selector
'
:
'
confirm_deletion_button
'
},
attributes
:
{
variant
:
'
danger
'
,
'
data-qa-selector
'
:
'
confirm_deletion_button
'
,
'
data-testid
'
:
'
confirm_deletion_button
'
,
},
};
},
cancelProps
()
{
...
...
app/assets/javascripts/pages/shared/wikis/wikis.js
View file @
bd042d31
import
{
GlBreakpointInstance
as
bp
}
from
'
@gitlab/ui/dist/utils
'
;
import
{
s__
,
sprintf
}
from
'
~/locale
'
;
import
Tracking
from
'
~/tracking
'
;
import
showToast
from
'
~/vue_shared/plugins/global_toast
'
;
const
MARKDOWN_LINK_TEXT
=
{
markdown
:
'
[Link Title](page-slug)
'
,
...
...
@@ -63,6 +64,7 @@ export default class Wikis {
}
Wikis
.
trackPageView
();
Wikis
.
showToasts
();
}
handleWikiTitleChange
(
e
)
{
...
...
@@ -116,4 +118,9 @@ export default class Wikis {
},
});
}
static
showToasts
()
{
const
toasts
=
document
.
querySelectorAll
(
'
.js-toast-message
'
);
toasts
.
forEach
(
toast
=>
showToast
(
toast
.
dataset
.
message
));
}
}
app/controllers/concerns/wiki_actions.rb
View file @
bd042d31
...
...
@@ -103,9 +103,10 @@ module WikiActions
@page
=
response
.
payload
[
:page
]
if
response
.
success?
flash
[
:toast
]
=
_
(
'Wiki page was successfully updated.'
)
redirect_to
(
wiki_page_path
(
wiki
,
page
),
notice:
_
(
'Wiki was successfully updated.'
)
wiki_page_path
(
wiki
,
page
)
)
else
render
'shared/wikis/edit'
...
...
@@ -122,9 +123,10 @@ module WikiActions
@page
=
response
.
payload
[
:page
]
if
response
.
success?
flash
[
:toast
]
=
_
(
'Wiki page was successfully created.'
)
redirect_to
(
wiki_page_path
(
wiki
,
page
),
notice:
_
(
'Wiki was successfully updated.'
)
wiki_page_path
(
wiki
,
page
)
)
else
render
'shared/wikis/edit'
...
...
@@ -169,9 +171,10 @@ module WikiActions
response
=
WikiPages
::
DestroyService
.
new
(
container:
container
,
current_user:
current_user
).
execute
(
page
)
if
response
.
success?
flash
[
:toast
]
=
_
(
"Wiki page was successfully deleted."
)
redirect_to
wiki_path
(
wiki
),
status: :found
,
notice:
_
(
"Page was successfully deleted"
)
status: :found
else
@error
=
response
render
'shared/wikis/edit'
...
...
changelogs/unreleased/wiki-toast.yml
0 → 100644
View file @
bd042d31
---
title
:
Use toasts for wiki notifications
merge_request
:
46201
author
:
type
:
changed
locale/gitlab.pot
View file @
bd042d31
...
...
@@ -19281,9 +19281,6 @@ msgstr ""
msgid "Page settings"
msgstr ""
msgid "Page was successfully deleted"
msgstr ""
msgid "PagerDutySettings|Active"
msgstr ""
...
...
@@ -30182,7 +30179,13 @@ msgstr ""
msgid "Wiki"
msgstr ""
msgid "Wiki was successfully updated."
msgid "Wiki page was successfully created."
msgstr ""
msgid "Wiki page was successfully deleted."
msgstr ""
msgid "Wiki page was successfully updated."
msgstr ""
msgid "WikiClone|Clone your wiki"
...
...
spec/support/shared_examples/features/wiki/user_deletes_wiki_page_shared_examples.rb
View file @
bd042d31
...
...
@@ -17,8 +17,8 @@ RSpec.shared_examples 'User deletes wiki page' do
it
'deletes a page'
,
:js
do
click_on
(
'Edit'
)
click_on
(
'Delete'
)
find
(
'
.modal-footer .btn-danger
'
).
click
find
(
'
[data-testid="confirm_deletion_button"]
'
).
click
expect
(
page
).
to
have_content
(
'
Page was successfully deleted
'
)
expect
(
page
).
to
have_content
(
'
Wiki page was successfully deleted.
'
)
end
end
spec/support/shared_examples/features/wiki/user_updates_wiki_page_shared_examples.rb
View file @
bd042d31
...
...
@@ -213,11 +213,11 @@ RSpec.shared_examples 'User updates wiki page' do
visit
wiki_page_path
(
wiki_page
.
wiki
,
wiki_page
,
action: :edit
)
end
it
'allows changing the title if the content does not change'
do
it
'allows changing the title if the content does not change'
,
:js
do
fill_in
'Title'
,
with:
'new title'
click_on
'Save changes'
expect
(
page
).
to
have_content
(
'Wiki was successfully updated.'
)
expect
(
page
).
to
have_content
(
'Wiki
page
was successfully updated.'
)
end
it
'shows a validation error when trying to change the content'
do
...
...
spec/support/shared_examples/features/wiki/user_views_wiki_page_shared_examples.rb
View file @
bd042d31
...
...
@@ -33,7 +33,7 @@ RSpec.shared_examples 'User views a wiki page' do
click_on
(
'Create page'
)
end
expect
(
page
).
to
have_content
(
'Wiki
was successfully upd
ated.'
)
expect
(
page
).
to
have_content
(
'Wiki
page was successfully cre
ated.'
)
end
it
'shows the history of a page that has a path'
do
...
...
@@ -49,7 +49,7 @@ RSpec.shared_examples 'User views a wiki page' do
end
end
it
'shows an old version of a page'
do
it
'shows an old version of a page'
,
:js
do
expect
(
current_path
).
to
include
(
'one/two/three-test'
)
expect
(
find
(
'.wiki-pages'
)).
to
have_content
(
'three'
)
...
...
@@ -65,7 +65,7 @@ RSpec.shared_examples 'User views a wiki page' do
fill_in
(
'Content'
,
with:
'Updated Wiki Content'
)
click_on
(
'Save changes'
)
expect
(
page
).
to
have_content
(
'Wiki was successfully updated.'
)
expect
(
page
).
to
have_content
(
'Wiki
page
was successfully updated.'
)
click_on
(
'Page history'
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment