Skip to content

Commit b892ac7

Browse files
author
GitLab Bot
committed
Add latest changes from gitlab-org/gitlab@master
1 parent 33a1d18 commit b892ac7

File tree

15 files changed

+63
-70
lines changed

15 files changed

+63
-70
lines changed

.eslintrc.yml

+1
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ overrides:
100100
- 'scripts/**/*'
101101
- '*.config.js'
102102
- '*.config.*.js'
103+
- 'jest_resolver.js'
103104
- storybook/config/*.js
104105
rules:
105106
'@gitlab/require-i18n-strings': off

app/assets/javascripts/related_issues/components/add_issuable_form.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ export default {
197197
<p v-if="hasError" class="gl-field-error">
198198
{{ addRelatedErrorMessage }}
199199
</p>
200-
<div class="add-issuable-form-actions clearfix">
200+
<div class="gl-mt-5 gl-clearfix">
201201
<gl-button
202202
ref="addButton"
203203
category="primary"

app/assets/javascripts/sidebar/components/assignees/uncollapsed_assignee_list.vue

+6-2
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,12 @@ export default {
8282
</div>
8383
</assignee-avatar-link>
8484
<div v-else>
85-
<div class="user-list">
86-
<div v-for="user in uncollapsedUsers" :key="user.id" class="user-item">
85+
<div class="gl-display-flex gl-flex-wrap">
86+
<div
87+
v-for="user in uncollapsedUsers"
88+
:key="user.id"
89+
class="user-item gl-display-inline-block"
90+
>
8791
<assignee-avatar-link :user="user" :issuable-type="issuableType" />
8892
</div>
8993
</div>

app/assets/javascripts/sidebar/components/participants/participants.vue

+2-2
Original file line numberDiff line numberDiff line change
@@ -104,11 +104,11 @@ export default {
104104
<gl-loading-icon v-if="loading" size="sm" :inline="true" />
105105
{{ participantLabel }}
106106
</div>
107-
<div class="participants-list hide-collapsed">
107+
<div class="hide-collapsed gl-display-flex gl-flex-wrap">
108108
<div
109109
v-for="participant in visibleParticipants"
110110
:key="participant.id"
111-
class="participants-author"
111+
class="participants-author gl-display-inline-block gl-pr-3 gl-pb-3"
112112
>
113113
<a :href="participant.web_url || participant.webUrl" class="author-link">
114114
<user-avatar-image

app/assets/javascripts/sidebar/components/time_tracking/comparison_pane.vue

+7-5
Original file line numberDiff line numberDiff line change
@@ -83,13 +83,15 @@ export default {
8383
:value="timeRemainingPercent"
8484
:variant="progressBarVariant"
8585
/>
86-
<div class="compare-display-container">
87-
<div class="compare-display float-left">
88-
<span class="compare-label">{{ s__('TimeTracking|Spent') }}</span>
86+
<div
87+
class="compare-display-container gl-display-flex gl-justify-content-space-between gl-mt-2"
88+
>
89+
<div class="gl-float-left">
90+
<span class="gl-text-gray-400">{{ s__('TimeTracking|Spent') }}</span>
8991
<span class="compare-value spent">{{ timeSpentHumanReadable }}</span>
9092
</div>
91-
<div class="compare-display estimated float-right">
92-
<span class="compare-label">{{ s__('TimeTrackingEstimated|Est') }}</span>
93+
<div class="estimated gl-float-right">
94+
<span class="gl-text-gray-400">{{ s__('TimeTrackingEstimated|Est') }}</span>
9395
<span class="compare-value">{{ timeEstimateHumanReadable }}</span>
9496
</div>
9597
</div>

app/assets/stylesheets/framework/variables.scss

-1
Original file line numberDiff line numberDiff line change
@@ -759,7 +759,6 @@ $help-shortcut-header-color: #333;
759759
*/
760760
$issues-today-bg: #f3fff2 !default;
761761
$issues-today-border: #e1e8d5 !default;
762-
$compare-display-color: #888;
763762

764763
/*
765764
* Label

app/assets/stylesheets/pages/issuable.scss

+1-43
Original file line numberDiff line numberDiff line change
@@ -220,21 +220,12 @@
220220
}
221221

222222
.cross-project-reference {
223-
color: inherit;
224-
225223
span {
226-
white-space: nowrap;
227224
width: 85%;
228-
overflow: hidden;
229-
position: relative;
230-
display: inline-block;
231-
text-overflow: ellipsis;
232225
}
233226

234227
button {
235-
float: right;
236228
padding: 1px 5px;
237-
background-color: $gray-light;
238229
}
239230
}
240231

@@ -563,35 +554,17 @@
563554
}
564555
}
565556

566-
.participants-list {
567-
display: flex;
568-
flex-wrap: wrap;
569-
}
570-
571-
.user-list {
572-
display: flex;
573-
flex-wrap: wrap;
574-
}
575-
576557
.participants-author {
577-
display: inline-block;
578-
padding: 0 $gl-padding-8 $gl-padding-8 0;
579-
580558
&:nth-of-type(7n) {
581559
padding-right: 0;
582560
}
583561

584-
.author-link {
585-
display: block;
586-
}
587-
588562
.avatar.avatar-inline {
589563
margin: 0;
590564
}
591565
}
592566

593567
.user-item {
594-
display: inline-block;
595568
padding: 5px;
596569
flex-basis: 20%;
597570

@@ -803,10 +776,6 @@
803776
}
804777
}
805778

806-
.add-issuable-form-actions {
807-
margin-top: $gl-padding;
808-
}
809-
810779
.time-tracker {
811780
.sidebar-collapsed-icon {
812781
> .stopwatch-svg {
@@ -839,18 +808,7 @@
839808
}
840809

841810
.compare-display-container {
842-
display: flex;
843-
justify-content: space-between;
844-
margin-top: 5px;
845-
846-
.compare-display {
847-
font-size: 13px;
848-
color: $compare-display-color;
849-
850-
.compare-value {
851-
color: $gl-text-color;
852-
}
853-
}
811+
font-size: 13px;
854812
}
855813

856814
.time-tracking-help-state {

app/views/shared/milestones/_sidebar.html.haml

+2-2
Original file line numberDiff line numberDiff line change
@@ -164,8 +164,8 @@
164164
.sidebar-collapsed-icon.dont-change-state
165165
= clipboard_button(text: milestone_ref, title: s_('MilestoneSidebar|Copy reference'), placement: "left", boundary: 'viewport')
166166
.cross-project-reference.hide-collapsed
167-
%span
167+
%span.gl-display-inline-block.gl-text-truncate
168168
= s_('MilestoneSidebar|Reference:')
169169
%span{ title: milestone_ref }
170170
= milestone_ref
171-
= clipboard_button(text: milestone_ref, title: s_('MilestoneSidebar|Copy reference'), placement: "left", boundary: 'viewport')
171+
= clipboard_button(text: milestone_ref, title: s_('MilestoneSidebar|Copy reference'), placement: "left", boundary: 'viewport', class: 'btn-clipboard btn-transparent gl-float-right gl-bg-gray-10')

doc/development/testing_guide/frontend_testing.md

+10-5
Original file line numberDiff line numberDiff line change
@@ -783,20 +783,25 @@ often using fixtures to validate correct integration with the backend code.
783783
784784
### Use fixtures
785785
786-
Jest uses `spec/frontend/__helpers__/fixtures.js` to import fixtures in tests.
787-
788-
The following are examples of tests that work for Jest:
786+
To import a JSON fixture, `import` it using the `test_fixtures` alias.
789787
790788
```javascript
789+
import responseBody from 'test_fixtures/some/fixture.json' // loads spec/frontend/fixtures/some/fixture.json
790+
791791
it('makes a request', () => {
792-
const responseBody = getJSONFixture('some/fixture.json'); // loads spec/frontend/fixtures/some/fixture.json
793792
axiosMock.onGet(endpoint).reply(200, responseBody);
794793

795794
myButton.click();
796795

797796
// ...
798797
});
798+
```
799799
800+
For other fixtures, Jest uses `spec/frontend/__helpers__/fixtures.js` to import them in tests.
801+
802+
The following are examples of tests that work for Jest:
803+
804+
```javascript
800805
it('uses some HTML element', () => {
801806
loadFixtures('some/page.html'); // loads spec/frontend/fixtures/some/page.html and adds it to the DOM
802807

@@ -860,7 +865,7 @@ end
860865
This will create a new fixture located at
861866
`tmp/tests/frontend/fixtures-ee/graphql/releases/graphql/queries/all_releases.query.graphql.json`.
862867
863-
You can import the JSON fixture in a Jest test using the `getJSONFixture` method
868+
You can import the JSON fixture in a Jest test using the `test_fixtures` alias
864869
[as described below](#use-fixtures).
865870
866871
## Data-driven tests

jest.config.base.js

+1
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ module.exports = (path, options = {}) => {
112112
cacheDirectory: '<rootDir>/tmp/cache/jest',
113113
modulePathIgnorePatterns: ['<rootDir>/.yarn-cache/'],
114114
reporters,
115+
resolver: './jest_resolver.js',
115116
setupFilesAfterEnv: [`<rootDir>/${path}/test_setup.js`, 'jest-canvas-mock'],
116117
restoreMocks: true,
117118
transform: {

jest_resolver.js

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
const fs = require('fs');
2+
3+
// Wrap jest default resolver to detect missing frontend fixtures.
4+
module.exports = (request, options) => {
5+
try {
6+
return options.defaultResolver(request, options);
7+
} catch (e) {
8+
if (request.match(/tmp\/tests\/frontend\/fixtures/) && !fs.existsSync(request)) {
9+
console.error(
10+
'\x1b[1m\x1b[41m\x1b[30m %s \x1b[0m %s',
11+
'!',
12+
`Fixture file ${request} does not exist. Did you run bin/rake frontend:fixtures?`,
13+
);
14+
}
15+
throw e;
16+
}
17+
};

spec/frontend/.eslintrc.yml

+6-1
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,9 @@ rules:
2626
- off
2727
"@gitlab/no-global-event-off":
2828
- off
29-
29+
import/no-unresolved:
30+
- error
31+
# The test fixtures and graphql schema are dynamically generated in CI
32+
# during the `frontend-fixtures` and `graphql-schema-dump` jobs.
33+
# They may not be present during linting.
34+
- ignore: ['^test_fixtures\/', 'tmp/tests/graphql/gitlab_schema.graphql']

spec/frontend/deploy_freeze/helpers.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1+
import freezePeriodsFixture from 'test_fixtures/api/freeze-periods/freeze_periods.json';
2+
import timezoneDataFixture from 'test_fixtures/timezones/short.json';
13
import { secondsToHours } from '~/lib/utils/datetime_utility';
24

3-
export const freezePeriodsFixture = getJSONFixture('/api/freeze-periods/freeze_periods.json');
4-
export const timezoneDataFixture = getJSONFixture('/timezones/short.json');
5+
export { freezePeriodsFixture, timezoneDataFixture };
56

67
export const findTzByName = (identifier = '') =>
78
timezoneDataFixture.find(({ name }) => name.toLowerCase() === identifier.toLowerCase());

spec/frontend/sidebar/assignees_spec.js

+5-3
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { mount } from '@vue/test-utils';
33
import { trimText } from 'helpers/text_helper';
44
import UsersMockHelper from 'helpers/user_mock_data_helper';
55
import Assignee from '~/sidebar/components/assignees/assignees.vue';
6+
import AssigneeAvatarLink from '~/sidebar/components/assignees/assignee_avatar_link.vue';
67
import UsersMock from './mock_data';
78

89
describe('Assignee component', () => {
@@ -19,6 +20,7 @@ describe('Assignee component', () => {
1920
});
2021
};
2122

23+
const findAllAvatarLinks = () => wrapper.findAllComponents(AssigneeAvatarLink);
2224
const findComponentTextNoUsers = () => wrapper.find('[data-testid="no-value"]');
2325
const findCollapsedChildren = () => wrapper.findAll('.sidebar-collapsed-icon > *');
2426

@@ -148,7 +150,7 @@ describe('Assignee component', () => {
148150
editable: true,
149151
});
150152

151-
expect(wrapper.findAll('.user-item').length).toBe(users.length);
153+
expect(findAllAvatarLinks()).toHaveLength(users.length);
152154
expect(wrapper.find('.user-list-more').exists()).toBe(false);
153155
});
154156

@@ -178,9 +180,9 @@ describe('Assignee component', () => {
178180
users,
179181
});
180182

181-
const userItems = wrapper.findAll('.user-list .user-item a');
183+
const userItems = findAllAvatarLinks();
182184

183-
expect(userItems.length).toBe(3);
185+
expect(userItems).toHaveLength(3);
184186
expect(userItems.at(0).attributes('title')).toBe(users[2].name);
185187
});
186188

spec/frontend_integration/test_helpers/mock_server/graphql.js

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
import { buildSchema, graphql } from 'graphql';
22
import { memoize } from 'lodash';
33

4-
// The graphql schema is dynamically generated in CI
5-
// during the `graphql-schema-dump` job.
6-
// eslint-disable-next-line global-require, import/no-unresolved
4+
// eslint-disable-next-line global-require
75
const getGraphqlSchema = () => require('../../../../tmp/tests/graphql/gitlab_schema.graphql');
86

97
const graphqlResolvers = {

0 commit comments

Comments
 (0)