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
ed1dd601
Commit
ed1dd601
authored
Jul 08, 2020
by
Lukas Eipert
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Delete unused karma code
This deletes unused helpers, matchers and mock data from karma.
parent
0f68786a
Changes
16
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
4 additions
and
236 deletions
+4
-236
spec/frontend/helpers/init_vue_mr_page_helper.js
spec/frontend/helpers/init_vue_mr_page_helper.js
+3
-3
spec/frontend/merge_request_tabs_spec.js
spec/frontend/merge_request_tabs_spec.js
+1
-1
spec/javascripts/helpers/class_spec_helper.js
spec/javascripts/helpers/class_spec_helper.js
+0
-9
spec/javascripts/helpers/filtered_search_spec_helper.js
spec/javascripts/helpers/filtered_search_spec_helper.js
+0
-1
spec/javascripts/helpers/index.js
spec/javascripts/helpers/index.js
+0
-3
spec/javascripts/helpers/locale_helper.js
spec/javascripts/helpers/locale_helper.js
+0
-11
spec/javascripts/helpers/set_timeout_promise_helper.js
spec/javascripts/helpers/set_timeout_promise_helper.js
+0
-4
spec/javascripts/helpers/text_helper.js
spec/javascripts/helpers/text_helper.js
+0
-18
spec/javascripts/helpers/tracking_helper.js
spec/javascripts/helpers/tracking_helper.js
+0
-5
spec/javascripts/helpers/user_mock_data_helper.js
spec/javascripts/helpers/user_mock_data_helper.js
+0
-14
spec/javascripts/helpers/vue_mount_component_helper.js
spec/javascripts/helpers/vue_mount_component_helper.js
+0
-2
spec/javascripts/helpers/vue_test_utils_helper.js
spec/javascripts/helpers/vue_test_utils_helper.js
+0
-5
spec/javascripts/helpers/vuex_action_helper.js
spec/javascripts/helpers/vuex_action_helper.js
+0
-102
spec/javascripts/helpers/wait_for_promises.js
spec/javascripts/helpers/wait_for_promises.js
+0
-1
spec/javascripts/jobs/mock_data.js
spec/javascripts/jobs/mock_data.js
+0
-2
spec/javascripts/matchers.js
spec/javascripts/matchers.js
+0
-55
No files found.
spec/
javascripts
/helpers/init_vue_mr_page_helper.js
→
spec/
frontend
/helpers/init_vue_mr_page_helper.js
View file @
ed1dd601
import
MockAdapter
from
'
axios-mock-adapter
'
;
import
initMRPage
from
'
~/mr_notes
/index
'
;
import
initMRPage
from
'
~/mr_notes
'
;
import
axios
from
'
~/lib/utils/axios_utils
'
;
import
{
userDataMock
,
notesDataMock
,
noteableDataMock
}
from
'
../
../frontend/
notes/mock_data
'
;
import
diffFileMockData
from
'
../
../frontend/
diffs/mock_data/diff_file
'
;
import
{
userDataMock
,
notesDataMock
,
noteableDataMock
}
from
'
../notes/mock_data
'
;
import
diffFileMockData
from
'
../diffs/mock_data/diff_file
'
;
export
default
function
initVueMRPage
()
{
const
mrTestEl
=
document
.
createElement
(
'
div
'
);
...
...
spec/frontend/merge_request_tabs_spec.js
View file @
ed1dd601
...
...
@@ -5,7 +5,7 @@ import MergeRequestTabs from '~/merge_request_tabs';
import
'
~/commit/pipelines/pipelines_bundle
'
;
import
'
~/lib/utils/common_utils
'
;
import
'
vendor/jquery.scrollTo
'
;
import
initMrPage
from
'
../javascripts/
helpers/init_vue_mr_page_helper
'
;
import
initMrPage
from
'
helpers/init_vue_mr_page_helper
'
;
jest
.
mock
(
'
~/lib/utils/webpack
'
,
()
=>
({
resetServiceWorkersPublicPath
:
jest
.
fn
(),
...
...
spec/javascripts/helpers/class_spec_helper.js
deleted
100644 → 0
View file @
0f68786a
export
default
class
ClassSpecHelper
{
static
itShouldBeAStaticMethod
(
base
,
method
)
{
return
it
(
'
should be a static method
'
,
()
=>
{
expect
(
Object
.
prototype
.
hasOwnProperty
.
call
(
base
,
method
)).
toBeTruthy
();
});
}
}
window
.
ClassSpecHelper
=
ClassSpecHelper
;
spec/javascripts/helpers/filtered_search_spec_helper.js
deleted
100644 → 0
View file @
0f68786a
export
{
default
}
from
'
../../frontend/helpers/filtered_search_spec_helper
'
;
spec/javascripts/helpers/index.js
deleted
100644 → 0
View file @
0f68786a
import
mountComponent
,
{
mountComponentWithStore
}
from
'
./vue_mount_component_helper
'
;
export
{
mountComponent
,
mountComponentWithStore
};
spec/javascripts/helpers/locale_helper.js
deleted
100644 → 0
View file @
0f68786a
/* eslint-disable import/prefer-default-export */
export
const
setLanguage
=
languageCode
=>
{
const
htmlElement
=
document
.
querySelector
(
'
html
'
);
if
(
languageCode
)
{
htmlElement
.
setAttribute
(
'
lang
'
,
languageCode
);
}
else
{
htmlElement
.
removeAttribute
(
'
lang
'
);
}
};
spec/javascripts/helpers/set_timeout_promise_helper.js
deleted
100644 → 0
View file @
0f68786a
export
default
(
time
=
0
)
=>
new
Promise
(
resolve
=>
{
setTimeout
(
resolve
,
time
);
});
spec/javascripts/helpers/text_helper.js
deleted
100644 → 0
View file @
0f68786a
/**
* 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/helpers/tracking_helper.js
deleted
100644 → 0
View file @
0f68786a
// No new code should be added to this file. Instead, modify the
// file this one re-exports from. For more detail about why, see:
// https://gitlab.com/gitlab-org/gitlab-foss/merge_requests/31349
export
*
from
'
../../frontend/helpers/tracking_helper
'
;
spec/javascripts/helpers/user_mock_data_helper.js
deleted
100644 → 0
View file @
0f68786a
export
default
{
createNumberRandomUsers
(
numberUsers
)
{
const
users
=
[];
for
(
let
i
=
0
;
i
<
numberUsers
;
i
+=
1
)
{
users
.
push
({
avatar
:
'
https://gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon
'
,
id
:
i
+
1
,
name
:
`GitLab User
${
i
}
`
,
username
:
`gitlab
${
i
}
`
,
});
}
return
users
;
},
};
spec/javascripts/helpers/vue_mount_component_helper.js
deleted
100644 → 0
View file @
0f68786a
export
{
default
}
from
'
../../frontend/helpers/vue_mount_component_helper
'
;
export
*
from
'
../../frontend/helpers/vue_mount_component_helper
'
;
spec/javascripts/helpers/vue_test_utils_helper.js
deleted
100644 → 0
View file @
0f68786a
// No new code should be added to this file. Instead, modify the
// file this one re-exports from. For more detail about why, see:
// https://gitlab.com/gitlab-org/gitlab-foss/merge_requests/31349
export
*
from
'
../../frontend/helpers/vue_test_utils_helper
'
;
spec/javascripts/helpers/vuex_action_helper.js
deleted
100644 → 0
View file @
0f68786a
const
noop
=
()
=>
{};
/**
* Helper for testing action with expected mutations inspired in
* https://vuex.vuejs.org/en/testing.html
*
* @param {Function} action to be tested
* @param {Object} payload will be provided to the action
* @param {Object} state will be provided to the action
* @param {Array} [expectedMutations=[]] mutations expected to be committed
* @param {Array} [expectedActions=[]] actions expected to be dispatched
* @param {Function} [done=noop] to be executed after the tests
* @return {Promise}
*
* @example
* testAction(
* actions.actionName, // action
* { }, // mocked payload
* state, //state
* // expected mutations
* [
* { type: types.MUTATION}
* { type: types.MUTATION_1, payload: jasmine.any(Number)}
* ],
* // expected actions
* [
* { type: 'actionName', payload: {param: 'foobar'}},
* { type: 'actionName1'}
* ]
* done,
* );
*
* @example
* testAction(
* actions.actionName, // action
* { }, // mocked payload
* state, //state
* [ { type: types.MUTATION} ], // expected mutations
* [], // expected actions
* ).then(done)
* .catch(done.fail);
*/
export
default
(
action
,
payload
,
state
,
expectedMutations
=
[],
expectedActions
=
[],
done
=
noop
,
)
=>
{
const
mutations
=
[];
const
actions
=
[];
// mock commit
const
commit
=
(
type
,
mutationPayload
)
=>
{
const
mutation
=
{
type
};
if
(
typeof
mutationPayload
!==
'
undefined
'
)
{
mutation
.
payload
=
mutationPayload
;
}
mutations
.
push
(
mutation
);
};
// mock dispatch
const
dispatch
=
(
type
,
actionPayload
)
=>
{
const
dispatchedAction
=
{
type
};
if
(
typeof
actionPayload
!==
'
undefined
'
)
{
dispatchedAction
.
payload
=
actionPayload
;
}
actions
.
push
(
dispatchedAction
);
};
const
validateResults
=
()
=>
{
expect
({
mutations
,
actions
,
}).
toEqual
({
mutations
:
expectedMutations
,
actions
:
expectedActions
,
});
done
();
};
const
result
=
action
(
{
commit
,
state
,
dispatch
,
rootState
:
state
,
rootGetters
:
state
,
getters
:
state
},
payload
,
);
return
new
Promise
(
setImmediate
)
.
then
(()
=>
result
)
.
catch
(
error
=>
{
validateResults
();
throw
error
;
})
.
then
(
data
=>
{
validateResults
();
return
data
;
});
};
spec/javascripts/helpers/wait_for_promises.js
deleted
100644 → 0
View file @
0f68786a
export
default
()
=>
new
Promise
(
resolve
=>
requestAnimationFrame
(
resolve
));
spec/javascripts/jobs/mock_data.js
deleted
100644 → 0
View file @
0f68786a
export
{
default
}
from
'
../../frontend/jobs/mock_data
'
;
export
*
from
'
../../frontend/jobs/mock_data
'
;
spec/javascripts/matchers.js
View file @
ed1dd601
import
pixelmatch
from
'
pixelmatch
'
;
export
default
{
toContainText
:
()
=>
({
compare
(
vm
,
text
)
{
if
(
!
(
vm
.
$el
instanceof
HTMLElement
))
{
throw
new
Error
(
'
vm.$el is not a DOM element!
'
);
}
const
result
=
{
pass
:
vm
.
$el
.
innerText
.
includes
(
text
),
};
return
result
;
},
}),
toHaveSpriteIcon
:
()
=>
({
compare
(
element
,
iconName
)
{
if
(
!
iconName
)
{
throw
new
Error
(
'
toHaveSpriteIcon is missing iconName argument!
'
);
}
if
(
!
(
element
instanceof
HTMLElement
))
{
throw
new
Error
(
`
${
element
}
is not a DOM element!`
);
}
const
iconReferences
=
[].
slice
.
apply
(
element
.
querySelectorAll
(
'
svg use
'
));
const
matchingIcon
=
iconReferences
.
find
(
reference
=>
reference
.
getAttribute
(
'
xlink:href
'
).
endsWith
(
`#
${
iconName
}
`
),
);
const
result
=
{
pass
:
Boolean
(
matchingIcon
),
};
if
(
result
.
pass
)
{
result
.
message
=
`
${
element
.
outerHTML
}
contains the sprite icon "
${
iconName
}
"!`
;
}
else
{
result
.
message
=
`
${
element
.
outerHTML
}
does not contain the sprite icon "
${
iconName
}
"!`
;
const
existingIcons
=
iconReferences
.
map
(
reference
=>
{
const
iconUrl
=
reference
.
getAttribute
(
'
xlink:href
'
);
return
`"
${
iconUrl
.
replace
(
/^.+#/
,
''
)}
"`
;
});
if
(
existingIcons
.
length
>
0
)
{
result
.
message
+=
` (only found
${
existingIcons
.
join
(
'
,
'
)}
)`
;
}
}
return
result
;
},
}),
toRender
:
()
=>
({
compare
(
vm
)
{
const
result
=
{
pass
:
vm
.
$el
.
nodeType
!==
Node
.
COMMENT_NODE
,
};
return
result
;
},
}),
toImageDiffEqual
:
()
=>
{
const
getImageData
=
img
=>
{
const
canvas
=
document
.
createElement
(
'
canvas
'
);
...
...
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