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
0
Merge Requests
0
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
Léo-Paul Géneau
gitlab-ce
Commits
1cc633c8
Commit
1cc633c8
authored
Apr 16, 2018
by
Filipa Lacerda
Committed by
Clement Ho
Apr 16, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adds helpers to remove withespace and linebreaks
parent
d103a567
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
23 additions
and
7 deletions
+23
-7
spec/javascripts/helpers/vue_component_helper.js
spec/javascripts/helpers/vue_component_helper.js
+18
-3
spec/javascripts/ide/components/commit_sidebar/list_collapsed_spec.js
...ipts/ide/components/commit_sidebar/list_collapsed_spec.js
+2
-1
spec/javascripts/vue_mr_widget/components/states/mr_widget_conflicts_spec.js
...e_mr_widget/components/states/mr_widget_conflicts_spec.js
+1
-1
spec/javascripts/vue_mr_widget/components/states/mr_widget_pipeline_blocked_spec.js
...dget/components/states/mr_widget_pipeline_blocked_spec.js
+1
-1
spec/javascripts/vue_mr_widget/components/states/mr_widget_sha_mismatch_spec.js
...r_widget/components/states/mr_widget_sha_mismatch_spec.js
+1
-1
No files found.
spec/javascripts/helpers/vue_component_helper.js
View file @
1cc633c8
export
default
function
removeBreakLine
(
data
)
{
return
data
.
replace
(
/
\r?\n
|
\r
/g
,
'
'
);
}
/**
* Replaces line break with an empty space
* @param {*} data
*/
export
const
removeBreakLine
=
data
=>
data
.
replace
(
/
\r?\n
|
\r
/g
,
'
'
);
/**
* Removes line breaks, spaces and trims the given text
* @param {String} str
* @returns {String}
*/
export
const
trimText
=
str
=>
str
.
replace
(
/
\r?\n
|
\r
/g
,
''
)
.
replace
(
/
\s\s
+/g
,
'
'
)
.
trim
();
export
const
removeWhitespace
=
str
=>
str
.
replace
(
/
\s\s
+/g
,
'
'
);
spec/javascripts/ide/components/commit_sidebar/list_collapsed_spec.js
View file @
1cc633c8
...
...
@@ -3,6 +3,7 @@ import store from '~/ide/stores';
import
listCollapsed
from
'
~/ide/components/commit_sidebar/list_collapsed.vue
'
;
import
{
createComponentWithStore
}
from
'
spec/helpers/vue_mount_component_helper
'
;
import
{
file
}
from
'
../../helpers
'
;
import
{
removeWhitespace
}
from
'
../../../helpers/vue_component_helper
'
;
describe
(
'
Multi-file editor commit sidebar list collapsed
'
,
()
=>
{
let
vm
;
...
...
@@ -23,6 +24,6 @@ describe('Multi-file editor commit sidebar list collapsed', () => {
});
it
(
'
renders added & modified files count
'
,
()
=>
{
expect
(
vm
.
$el
.
textContent
.
replace
(
/
\s
+/g
,
'
'
).
trim
()).
toBe
(
'
1 1
'
);
expect
(
removeWhitespace
(
vm
.
$el
.
textContent
).
trim
()).
toBe
(
'
1 1
'
);
});
});
spec/javascripts/vue_mr_widget/components/states/mr_widget_conflicts_spec.js
View file @
1cc633c8
import
Vue
from
'
vue
'
;
import
conflictsComponent
from
'
~/vue_merge_request_widget/components/states/mr_widget_conflicts.vue
'
;
import
mountComponent
from
'
spec/helpers/vue_mount_component_helper
'
;
import
removeBreakLine
from
'
spec/helpers/vue_component_helper
'
;
import
{
removeBreakLine
}
from
'
spec/helpers/vue_component_helper
'
;
describe
(
'
MRWidgetConflicts
'
,
()
=>
{
let
Component
;
...
...
spec/javascripts/vue_mr_widget/components/states/mr_widget_pipeline_blocked_spec.js
View file @
1cc633c8
import
Vue
from
'
vue
'
;
import
pipelineBlockedComponent
from
'
~/vue_merge_request_widget/components/states/mr_widget_pipeline_blocked.vue
'
;
import
mountComponent
from
'
spec/helpers/vue_mount_component_helper
'
;
import
removeBreakLine
from
'
spec/helpers/vue_component_helper
'
;
import
{
removeBreakLine
}
from
'
spec/helpers/vue_component_helper
'
;
describe
(
'
MRWidgetPipelineBlocked
'
,
()
=>
{
let
vm
;
...
...
spec/javascripts/vue_mr_widget/components/states/mr_widget_sha_mismatch_spec.js
View file @
1cc633c8
import
Vue
from
'
vue
'
;
import
ShaMismatch
from
'
~/vue_merge_request_widget/components/states/sha_mismatch.vue
'
;
import
mountComponent
from
'
spec/helpers/vue_mount_component_helper
'
;
import
removeBreakLine
from
'
spec/helpers/vue_component_helper
'
;
import
{
removeBreakLine
}
from
'
spec/helpers/vue_component_helper
'
;
describe
(
'
ShaMismatch
'
,
()
=>
{
let
vm
;
...
...
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