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
9e50721d
Commit
9e50721d
authored
May 11, 2020
by
Illya Klymov
Committed by
Paul Slaughter
May 26, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove obsolete mutation observer stubs
parent
45ed2a3b
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
11 deletions
+20
-11
app/assets/javascripts/filtered_search/services/recent_searches_service_error.js
...filtered_search/services/recent_searches_service_error.js
+2
-5
ee/spec/frontend/approvals/components/mr_edit/mr_rules_spec.js
...ec/frontend/approvals/components/mr_edit/mr_rules_spec.js
+18
-6
No files found.
app/assets/javascripts/filtered_search/services/recent_searches_service_error.js
View file @
9e50721d
import
{
__
}
from
'
~/locale
'
;
class
RecentSearchesServiceError
{
class
RecentSearchesServiceError
extends
Error
{
constructor
(
message
)
{
super
(
message
||
__
(
'
Recent Searches Service is unavailable
'
));
this
.
name
=
'
RecentSearchesServiceError
'
;
this
.
message
=
message
||
__
(
'
Recent Searches Service is unavailable
'
);
}
}
// Can't use `extends` for builtin prototypes and get true inheritance yet
RecentSearchesServiceError
.
prototype
=
Error
.
prototype
;
export
default
RecentSearchesServiceError
;
ee/spec/frontend/approvals/components/mr_edit/mr_rules_spec.js
View file @
9e50721d
...
...
@@ -50,6 +50,15 @@ describe('EE Approvals MRRules', () => {
return
onTargetBranchMutationHandler
();
};
let
OriginalMutationObserver
;
beforeAll
(()
=>
{
OriginalMutationObserver
=
global
.
MutationObserver
;
});
afterAll
(()
=>
{
global
.
MutationObserver
=
OriginalMutationObserver
;
});
beforeEach
(()
=>
{
store
=
createStoreOptions
(
MREditModule
());
store
.
modules
.
approvals
.
state
=
{
...
...
@@ -69,10 +78,13 @@ describe('EE Approvals MRRules', () => {
describe
(
'
when editing a MR
'
,
()
=>
{
const
initialTargetBranch
=
'
master
'
;
let
targetBranchInputElement
;
let
MutationObserver
Spy
;
let
MutationObserver
Mock
;
beforeEach
(()
=>
{
MutationObserverSpy
=
jest
.
spyOn
(
global
,
'
MutationObserver
'
);
MutationObserverMock
=
jest
.
fn
()
.
mockImplementation
(
args
=>
new
OriginalMutationObserver
(
args
));
global
.
MutationObserver
=
MutationObserverMock
;
targetBranchInputElement
=
document
.
createElement
(
'
input
'
);
targetBranchInputElement
.
id
=
'
merge_request_target_branch
'
;
...
...
@@ -91,7 +103,7 @@ describe('EE Approvals MRRules', () => {
afterEach
(()
=>
{
targetBranchInputElement
.
parentNode
.
removeChild
(
targetBranchInputElement
);
MutationObserver
Spy
.
mockClear
();
MutationObserver
Mock
.
mockClear
();
});
it
(
'
sets the target branch data to be the same value as the target branch dropdown
'
,
()
=>
{
...
...
@@ -103,20 +115,20 @@ describe('EE Approvals MRRules', () => {
it
(
'
updates the target branch data when the target branch dropdown is changed
'
,
()
=>
{
factory
();
const
newValue
=
setTargetBranchInputValue
();
callTargetBranchHandler
(
MutationObserver
Spy
);
callTargetBranchHandler
(
MutationObserver
Mock
);
expect
(
wrapper
.
vm
.
targetBranch
).
toBe
(
newValue
);
});
it
(
'
re-fetches rules when target branch has changed
'
,
()
=>
{
factory
();
setTargetBranchInputValue
();
callTargetBranchHandler
(
MutationObserver
Spy
);
callTargetBranchHandler
(
MutationObserver
Mock
);
expect
(
store
.
modules
.
approvals
.
actions
.
fetchRules
).
toHaveBeenCalled
();
});
it
(
'
disconnects MutationObserver when component gets destroyed
'
,
()
=>
{
const
mockDisconnect
=
jest
.
fn
();
MutationObserver
Spy
.
mockImplementation
(()
=>
({
MutationObserver
Mock
.
mockImplementation
(()
=>
({
disconnect
:
mockDisconnect
,
observe
:
jest
.
fn
(),
}));
...
...
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