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
3270fc44
Commit
3270fc44
authored
Feb 25, 2022
by
GitLab Bot
Browse files
Options
Browse Files
Download
Plain Diff
Automatic merge of gitlab-org/gitlab master
parents
31854910
060d5d36
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
50 additions
and
12 deletions
+50
-12
app/assets/javascripts/lib/utils/text_markdown.js
app/assets/javascripts/lib/utils/text_markdown.js
+2
-0
qa/qa.rb
qa/qa.rb
+6
-0
qa/qa/runtime/logger.rb
qa/qa/runtime/logger.rb
+10
-3
qa/qa/support/repeater.rb
qa/qa/support/repeater.rb
+3
-2
qa/spec/spec_helper.rb
qa/spec/spec_helper.rb
+1
-7
spec/features/issues/gfm_autocomplete_spec.rb
spec/features/issues/gfm_autocomplete_spec.rb
+8
-0
spec/frontend/lib/utils/text_markdown_spec.js
spec/frontend/lib/utils/text_markdown_spec.js
+20
-0
No files found.
app/assets/javascripts/lib/utils/text_markdown.js
View file @
3270fc44
...
...
@@ -367,6 +367,8 @@ function handleContinueList(e, textArea) {
export
function
keypressNoteText
(
e
)
{
const
textArea
=
this
;
if
(
$
(
textArea
).
atwho
?.(
'
isSelecting
'
))
return
;
handleContinueList
(
e
,
textArea
);
handleSurroundSelectedText
(
e
,
textArea
);
}
...
...
qa/qa.rb
View file @
3270fc44
...
...
@@ -11,6 +11,12 @@ require_relative 'lib/gitlab'
require_relative
'../config/bundler_setup'
Bundler
.
require
(
:default
)
require
'securerandom'
require
'pathname'
require
'active_support/core_ext/hash'
require
'active_support/core_ext/object/blank'
require
'rainbow/refinement'
module
QA
root
=
"
#{
__dir__
}
/qa"
...
...
qa/qa/runtime/logger.rb
View file @
3270fc44
...
...
@@ -2,13 +2,19 @@
require
'logger'
require
'forwardable'
require
'rainbow/refinement'
module
QA
module
Runtime
module
Logger
extend
SingleForwardable
using
Rainbow
LEVEL_COLORS
=
{
"DEBUG"
=>
:magenta
,
"INFO"
=>
:green
,
"WARN"
=>
:yellow
,
"ERROR"
=>
:indianred
,
"FATAL"
=>
:red
}.
freeze
def_delegators
:logger
,
:debug
,
:info
,
:warn
,
:error
,
:fatal
,
:unknown
...
...
@@ -23,8 +29,9 @@ module QA
logger
.
formatter
=
proc
do
|
severity
,
datetime
,
progname
,
msg
|
date_format
=
datetime
.
strftime
(
"%Y-%m-%d %H:%M:%S"
)
msg_prefix
=
"[date=
#{
date_format
}
from=QA Tests]
#{
severity
.
ljust
(
5
)
}
-- "
"[date=
#{
date_format
}
from=QA Tests]
#{
severity
.
ljust
(
5
)
}
-- "
.
yellow
+
"
#{
msg
}
\n
"
Rainbow
(
msg_prefix
).
send
(
LEVEL_COLORS
.
fetch
(
severity
,
:yellow
))
+
"
#{
msg
}
\n
"
end
end
end
...
...
qa/qa/support/repeater.rb
View file @
3270fc44
# frozen_string_literal: true
require
'active_support/inflector'
require
'rainbow/refinement'
module
QA
module
Support
...
...
@@ -40,7 +39,9 @@ module QA
QA
::
Runtime
::
Logger
.
debug
(
msg
.
join
(
' '
))
end
QA
::
Runtime
::
Logger
.
debug
(
"Attempt number
#{
attempts
+
1
}
"
.
bg
(
:yellow
).
black
)
if
log
&&
max_attempts
&&
attempts
>
0
if
log
&&
max_attempts
&&
attempts
>
0
QA
::
Runtime
::
Logger
.
debug
(
"Attempt number
#{
attempts
+
1
}
"
.
bg
(
:yellow
).
black
)
end
result
=
yield
if
result
...
...
qa/spec/spec_helper.rb
View file @
3270fc44
...
...
@@ -2,12 +2,6 @@
require_relative
'../qa'
require
'securerandom'
require
'pathname'
require
'active_support/core_ext/hash'
require
'active_support/core_ext/object/blank'
require
'rainbow/refinement'
require_relative
'qa_deprecation_toolkit_env'
QaDeprecationToolkitEnv
.
configure!
...
...
@@ -36,7 +30,7 @@ RSpec.configure do |config|
end
config
.
prepend_before
do
|
example
|
QA
::
Runtime
::
Logger
.
debug
(
"
\n
Starting test:
#{
example
.
full_description
}
\n
"
)
QA
::
Runtime
::
Logger
.
info
(
"Starting test:
#{
Rainbow
(
example
.
full_description
).
bright
}
"
)
QA
::
Runtime
::
Example
.
current
=
example
# Reset fabrication counters tracked in resource base
...
...
spec/features/issues/gfm_autocomplete_spec.rb
View file @
3270fc44
...
...
@@ -420,6 +420,14 @@ RSpec.describe 'GFM autocomplete', :js do
end
end
end
context
'when typing enter for autocomplete in a markdown list'
do
it
'does not create a new list item'
do
fill_in
'Comment'
,
with:
"- @
#{
user
.
username
}
\n
"
expect
(
find_field
(
'Comment'
).
value
).
to
eq
"- @
#{
user
.
username
}
\n
"
end
end
end
private
...
...
spec/frontend/lib/utils/text_markdown_spec.js
View file @
3270fc44
import
$
from
'
jquery
'
;
import
{
insertMarkdownText
,
keypressNoteText
}
from
'
~/lib/utils/text_markdown
'
;
import
'
~/lib/utils/jquery_at_who
'
;
describe
(
'
init markdown
'
,
()
=>
{
let
textArea
;
...
...
@@ -223,6 +225,24 @@ describe('init markdown', () => {
expect
(
textArea
.
selectionEnd
).
toBe
(
text
.
length
);
});
// test that when we're in the middle of autocomplete, we don't
// add a new list item
it
.
each
`
text | expected | atwho_selecting
${
'
- item @
'
}
|
${
'
- item @
'
}
|
${
true
}
${
'
- item @
'
}
|
${
'
- item @
\n
-
'
}
|
${
false
}
`
(
'
behaves correctly during autocomplete
'
,
({
text
,
expected
,
atwho_selecting
})
=>
{
jest
.
spyOn
(
$
.
fn
,
'
atwho
'
).
mockReturnValue
(
atwho_selecting
);
textArea
.
value
=
text
;
textArea
.
setSelectionRange
(
text
.
length
,
text
.
length
);
textArea
.
addEventListener
(
'
keydown
'
,
keypressNoteText
);
textArea
.
dispatchEvent
(
enterEvent
);
expect
(
textArea
.
value
).
toEqual
(
expected
);
});
it
(
'
does nothing if feature flag disabled
'
,
()
=>
{
gon
.
features
=
{
markdownContinueLists
:
false
};
...
...
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