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
c82a9861
Commit
c82a9861
authored
Aug 03, 2021
by
GitLab Bot
Browse files
Options
Browse Files
Download
Plain Diff
Automatic merge of gitlab-org/gitlab master
parents
c0ed81e5
139c8fb9
Changes
12
Show whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
52 additions
and
48 deletions
+52
-48
app/assets/javascripts/lazy_loader.js
app/assets/javascripts/lazy_loader.js
+1
-1
app/models/ci/build.rb
app/models/ci/build.rb
+0
-4
ee/app/controllers/ee/projects/merge_requests_controller.rb
ee/app/controllers/ee/projects/merge_requests_controller.rb
+8
-10
ee/spec/frontend/boards/components/board_scope_spec.js
ee/spec/frontend/boards/components/board_scope_spec.js
+0
-2
spec/frontend/__helpers__/mock_dom_observer.js
spec/frontend/__helpers__/mock_dom_observer.js
+10
-12
spec/frontend/alerts_settings/components/alerts_settings_wrapper_spec.js
...lerts_settings/components/alerts_settings_wrapper_spec.js
+0
-2
spec/frontend/environment.js
spec/frontend/environment.js
+21
-2
spec/frontend/issue_show/components/app_spec.js
spec/frontend/issue_show/components/app_spec.js
+0
-3
spec/frontend/issue_show/issue_spec.js
spec/frontend/issue_show/issue_spec.js
+0
-3
spec/frontend/popovers/components/popovers_spec.js
spec/frontend/popovers/components/popovers_spec.js
+6
-3
spec/frontend/tooltips/components/tooltips_spec.js
spec/frontend/tooltips/components/tooltips_spec.js
+6
-3
spec/frontend/vue_shared/directives/autofocusonshow_spec.js
spec/frontend/vue_shared/directives/autofocusonshow_spec.js
+0
-3
No files found.
app/assets/javascripts/lazy_loader.js
View file @
c82a9861
...
...
@@ -44,7 +44,7 @@ export default class LazyLoader {
startContentObserver
()
{
const
contentNode
=
document
.
querySelector
(
this
.
observerNode
)
||
document
.
querySelector
(
'
body
'
);
if
(
contentNode
)
{
if
(
contentNode
&&
!
this
.
mutationObserver
)
{
this
.
mutationObserver
=
new
MutationObserver
(()
=>
this
.
searchLazyImages
());
this
.
mutationObserver
.
observe
(
contentNode
,
{
...
...
app/models/ci/build.rb
View file @
c82a9861
...
...
@@ -118,10 +118,6 @@ module Ci
where
(
'EXISTS (?)'
,
::
Ci
::
JobArtifact
.
select
(
1
).
where
(
'ci_builds.id = ci_job_artifacts.job_id'
).
merge
(
query
))
end
scope
:with_archived_trace
,
->
do
with_existing_job_artifacts
(
Ci
::
JobArtifact
.
trace
)
end
scope
:without_archived_trace
,
->
do
where
(
'NOT EXISTS (?)'
,
Ci
::
JobArtifact
.
select
(
1
).
where
(
'ci_builds.id = ci_job_artifacts.job_id'
).
trace
)
end
...
...
ee/app/controllers/ee/projects/merge_requests_controller.rb
View file @
c82a9861
...
...
@@ -17,19 +17,17 @@ module EE
end
before_action
:authorize_read_pipeline!
,
only:
[
:container_scanning_reports
,
:dependency_scanning_reports
,
:sast_reports
,
:secret_detection_reports
,
:dast_reports
,
:
metrics_reports
,
:coverage
_fuzzing_reports
,
:
api_fuzzing
_reports
]
:sast_reports
,
:secret_detection_reports
,
:
dast_reports
,
:coverage_fuzzing_reports
,
:api
_fuzzing_reports
,
:
metrics
_reports
]
before_action
:authorize_read_licenses!
,
only:
[
:license_scanning_reports
]
feature_category
:code_review
,
[
:delete_description_version
,
:description_diff
]
feature_category
:container_scanning
,
[
:container_scanning_reports
]
feature_category
:dependency_scanning
,
[
:dependency_scanning_reports
]
feature_category
:fuzz_testing
,
[
:coverage_fuzzing_reports
,
:api_fuzzing_reports
]
feature_category
:license_compliance
,
[
:license_scanning_reports
]
feature_category
:vulnerability_management
,
[
:sast_reports
,
:secret_detection_reports
]
feature_category
:dynamic_application_security_testing
,
[
:dast_reports
]
feature_category
:vulnerability_management
,
[
:container_scanning_reports
,
:dependency_scanning_reports
,
:sast_reports
,
:secret_detection_reports
,
:dast_reports
,
:coverage_fuzzing_reports
,
:api_fuzzing_reports
]
feature_category
:metrics
,
[
:metrics_reports
]
feature_category
:license_compliance
,
[
:license_scanning_reports
]
feature_category
:code_review
,
[
:delete_description_version
,
:description_diff
]
end
def
license_scanning_reports
...
...
ee/spec/frontend/boards/components/board_scope_spec.js
View file @
c82a9861
...
...
@@ -2,7 +2,6 @@ import { mount } from '@vue/test-utils';
import
Vue
,
{
nextTick
}
from
'
vue
'
;
import
Vuex
from
'
vuex
'
;
import
BoardScope
from
'
ee/boards/components/board_scope.vue
'
;
import
{
useMockIntersectionObserver
}
from
'
helpers/mock_dom_observer
'
;
import
{
TEST_HOST
}
from
'
helpers/test_constants
'
;
import
LabelsSelect
from
'
~/vue_shared/components/sidebar/labels_select_vue/labels_select_root.vue
'
;
...
...
@@ -11,7 +10,6 @@ Vue.use(Vuex);
describe
(
'
BoardScope
'
,
()
=>
{
let
wrapper
;
let
store
;
useMockIntersectionObserver
();
const
createStore
=
()
=>
{
return
new
Vuex
.
Store
({
...
...
spec/frontend/__helpers__/mock_dom_observer.js
View file @
c82a9861
...
...
@@ -52,7 +52,7 @@ class MockIntersectionObserver extends MockObserver {
* const { trigger: triggerMutate } = useMockMutationObserver();
*
* it('test', () => {
* trigger(el, { options: { childList: true }, entry: { } });
* trigger
Mutate
(el, { options: { childList: true }, entry: { } });
* });
* })
* ```
...
...
@@ -60,33 +60,31 @@ class MockIntersectionObserver extends MockObserver {
* @param {String} key
*/
const
useMockObserver
=
(
key
,
createMock
)
=>
{
let
mockObserver
;
let
mockObserver
s
=
[]
;
let
origObserver
;
beforeEach
(()
=>
{
origObserver
=
global
[
key
];
global
[
key
]
=
jest
.
fn
().
mockImplementation
((...
args
)
=>
{
mockObserver
=
createMock
(...
args
);
const
mockObserver
=
createMock
(...
args
);
mockObservers
.
push
(
mockObserver
);
return
mockObserver
;
});
});
afterEach
(()
=>
{
mockObserver
=
null
;
mockObservers
.
forEach
((
x
)
=>
x
.
disconnect
());
mockObservers
=
[];
global
[
key
]
=
origObserver
;
});
const
trigger
=
(...
args
)
=>
{
if
(
!
mockObserver
)
{
return
;
}
mockObserver
.
$_triggerObserve
(...
args
);
mockObservers
.
forEach
((
observer
)
=>
{
observer
.
$_triggerObserve
(...
args
);
});
};
const
observersCount
=
()
=>
mockObserver
.
$_observers
.
length
;
return
{
trigger
,
observersCount
};
return
{
trigger
};
};
export
const
useMockIntersectionObserver
=
()
=>
...
...
spec/frontend/alerts_settings/components/alerts_settings_wrapper_spec.js
View file @
c82a9861
...
...
@@ -6,7 +6,6 @@ import VueApollo from 'vue-apollo';
import
createHttpIntegrationMutation
from
'
ee_else_ce/alerts_settings/graphql/mutations/create_http_integration.mutation.graphql
'
;
import
updateHttpIntegrationMutation
from
'
ee_else_ce/alerts_settings/graphql/mutations/update_http_integration.mutation.graphql
'
;
import
createMockApollo
from
'
helpers/mock_apollo_helper
'
;
import
{
useMockIntersectionObserver
}
from
'
helpers/mock_dom_observer
'
;
import
{
extendedWrapper
}
from
'
helpers/vue_test_utils_helper
'
;
import
waitForPromises
from
'
helpers/wait_for_promises
'
;
import
IntegrationsList
from
'
~/alerts_settings/components/alerts_integrations_list.vue
'
;
...
...
@@ -57,7 +56,6 @@ describe('AlertsSettingsWrapper', () => {
let
wrapper
;
let
fakeApollo
;
let
destroyIntegrationHandler
;
useMockIntersectionObserver
();
const
httpMappingData
=
{
payloadExample
:
'
{"test: : "field"}
'
,
...
...
spec/frontend/environment.js
View file @
c82a9861
...
...
@@ -88,13 +88,32 @@ class CustomEnvironment extends JSDOMEnvironment {
}),
});
this
.
global
.
PerformanceObserver
=
class
{
/**
* JSDom doesn't have an own observer implementation, so this a Noop Observer.
* If you are testing functionality, related to observers, have a look at __helpers__/mock_dom_observer.js
*
* JSDom actually implements a _proper_ MutationObserver, so no need to mock it!
*/
class
NoopObserver
{
/* eslint-disable no-useless-constructor, no-unused-vars, no-empty-function, class-methods-use-this */
constructor
(
callback
)
{}
disconnect
()
{}
observe
(
element
,
initObject
)
{}
unobserve
(
element
)
{}
takeRecords
()
{
return
[];
}
/* eslint-enable no-useless-constructor, no-unused-vars, no-empty-function, class-methods-use-this */
};
}
[
'
IntersectionObserver
'
,
'
PerformanceObserver
'
,
'
ResizeObserver
'
].
forEach
((
observer
)
=>
{
if
(
this
.
global
[
observer
])
{
throw
new
Error
(
`We overwrite an existing Observer in jsdom (
${
observer
}
), are you sure you want to do that?`
,
);
}
this
.
global
[
observer
]
=
NoopObserver
;
});
}
async
teardown
()
{
...
...
spec/frontend/issue_show/components/app_spec.js
View file @
c82a9861
...
...
@@ -2,7 +2,6 @@ import { GlIntersectionObserver } from '@gitlab/ui';
import
{
mount
}
from
'
@vue/test-utils
'
;
import
MockAdapter
from
'
axios-mock-adapter
'
;
import
{
nextTick
}
from
'
vue
'
;
import
{
useMockIntersectionObserver
}
from
'
helpers/mock_dom_observer
'
;
import
'
~/behaviors/markdown/render_gfm
'
;
import
IssuableApp
from
'
~/issue_show/components/app.vue
'
;
import
DescriptionComponent
from
'
~/issue_show/components/description.vue
'
;
...
...
@@ -30,8 +29,6 @@ jest.mock('~/issue_show/event_hub');
const
REALTIME_REQUEST_STACK
=
[
initialRequest
,
secondRequest
];
describe
(
'
Issuable output
'
,
()
=>
{
useMockIntersectionObserver
();
let
mock
;
let
realtimeRequestCount
=
0
;
let
wrapper
;
...
...
spec/frontend/issue_show/issue_spec.js
View file @
c82a9861
import
MockAdapter
from
'
axios-mock-adapter
'
;
import
{
useMockIntersectionObserver
}
from
'
helpers/mock_dom_observer
'
;
import
waitForPromises
from
'
helpers/wait_for_promises
'
;
import
{
initIssuableApp
}
from
'
~/issue_show/issue
'
;
import
*
as
parseData
from
'
~/issue_show/utils/parse_data
'
;
...
...
@@ -10,8 +9,6 @@ import { appProps } from './mock_data/mock_data';
const
mock
=
new
MockAdapter
(
axios
);
mock
.
onGet
().
reply
(
200
);
useMockIntersectionObserver
();
jest
.
mock
(
'
~/lib/utils/poll
'
);
const
setupHTML
=
(
initialData
)
=>
{
...
...
spec/frontend/popovers/components/popovers_spec.js
View file @
c82a9861
...
...
@@ -4,7 +4,7 @@ import { useMockMutationObserver } from 'helpers/mock_dom_observer';
import
Popovers
from
'
~/popovers/components/popovers.vue
'
;
describe
(
'
popovers/components/popovers.vue
'
,
()
=>
{
const
{
trigger
:
triggerMutate
,
observersCount
}
=
useMockMutationObserver
();
const
{
trigger
:
triggerMutate
}
=
useMockMutationObserver
();
let
wrapper
;
const
buildWrapper
=
(...
targets
)
=>
{
...
...
@@ -120,10 +120,13 @@ describe('popovers/components/popovers.vue', () => {
it
(
'
disconnects mutation observer on beforeDestroy
'
,
async
()
=>
{
await
buildWrapper
(
createPopoverTarget
());
const
{
observer
}
=
wrapper
.
vm
;
jest
.
spyOn
(
observer
,
'
disconnect
'
);
expect
(
observer
sCount
()).
toBe
(
1
);
expect
(
observer
.
disconnect
).
toHaveBeenCalledTimes
(
0
);
wrapper
.
destroy
();
expect
(
observersCount
()).
toBe
(
0
);
expect
(
observer
.
disconnect
).
toHaveBeenCalledTimes
(
1
);
});
});
spec/frontend/tooltips/components/tooltips_spec.js
View file @
c82a9861
...
...
@@ -4,7 +4,7 @@ import { useMockMutationObserver } from 'helpers/mock_dom_observer';
import
Tooltips
from
'
~/tooltips/components/tooltips.vue
'
;
describe
(
'
tooltips/components/tooltips.vue
'
,
()
=>
{
const
{
trigger
:
triggerMutate
,
observersCount
}
=
useMockMutationObserver
();
const
{
trigger
:
triggerMutate
}
=
useMockMutationObserver
();
let
wrapper
;
const
buildWrapper
=
()
=>
{
...
...
@@ -211,11 +211,14 @@ describe('tooltips/components/tooltips.vue', () => {
it
(
'
disconnects mutation observer on beforeDestroy
'
,
()
=>
{
buildWrapper
();
wrapper
.
vm
.
addTooltips
([
createTooltipTarget
()]);
const
{
observer
}
=
wrapper
.
vm
;
jest
.
spyOn
(
observer
,
'
disconnect
'
);
expect
(
observer
sCount
()).
toBe
(
1
);
expect
(
observer
.
disconnect
).
toHaveBeenCalledTimes
(
0
);
wrapper
.
destroy
();
expect
(
observersCount
()).
toBe
(
0
);
expect
(
observer
.
disconnect
).
toHaveBeenCalledTimes
(
1
);
});
it
(
'
exposes hidden event
'
,
async
()
=>
{
...
...
spec/frontend/vue_shared/directives/autofocusonshow_spec.js
View file @
c82a9861
import
{
useMockIntersectionObserver
}
from
'
helpers/mock_dom_observer
'
;
import
autofocusonshow
from
'
~/vue_shared/directives/autofocusonshow
'
;
/**
...
...
@@ -7,8 +6,6 @@ import autofocusonshow from '~/vue_shared/directives/autofocusonshow';
* on underlying DOM methods.
*/
describe
(
'
AutofocusOnShow directive
'
,
()
=>
{
useMockIntersectionObserver
();
describe
(
'
with input invisible on component render
'
,
()
=>
{
let
el
;
...
...
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