2020-03-13 15:44:24 +05:30
|
|
|
export * from '@gitlab/ui';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The @gitlab/ui tooltip directive requires awkward and distracting set up in tests
|
2021-03-08 18:12:59 +05:30
|
|
|
* for components that use it (e.g., `attachTo: document.body` and `sync: true` passed
|
2020-03-13 15:44:24 +05:30
|
|
|
* to the `mount` helper from `vue-test-utils`).
|
|
|
|
*
|
|
|
|
* This mock decouples those tests from the implementation, removing the need to set
|
|
|
|
* them up specially just for these tooltips.
|
2020-07-28 23:09:34 +05:30
|
|
|
*
|
|
|
|
* Mocking the modules using the full file path allows the mocks to take effect
|
|
|
|
* when the modules are imported in this project (`gitlab`) **and** when they
|
|
|
|
* are imported internally in `@gitlab/ui`.
|
2020-03-13 15:44:24 +05:30
|
|
|
*/
|
2020-07-28 23:09:34 +05:30
|
|
|
|
2023-05-27 22:25:52 +05:30
|
|
|
/* eslint-disable global-require */
|
|
|
|
|
|
|
|
jest.mock('@gitlab/ui/src/directives/tooltip.js', () => ({
|
2021-12-11 22:18:48 +05:30
|
|
|
GlTooltipDirective: {
|
|
|
|
bind() {},
|
|
|
|
},
|
2020-07-28 23:09:34 +05:30
|
|
|
}));
|
2023-05-27 22:25:52 +05:30
|
|
|
jest.mock('@gitlab/ui/dist/directives/tooltip.js', () =>
|
|
|
|
require('@gitlab/ui/src/directives/tooltip'),
|
|
|
|
);
|
2020-03-13 15:44:24 +05:30
|
|
|
|
2023-05-27 22:25:52 +05:30
|
|
|
jest.mock('@gitlab/ui/src/components/base/tooltip/tooltip.vue', () => ({
|
2021-01-29 00:20:46 +05:30
|
|
|
props: ['target', 'id', 'triggers', 'placement', 'container', 'boundary', 'disabled', 'show'],
|
2020-03-13 15:44:24 +05:30
|
|
|
render(h) {
|
2020-11-24 15:15:51 +05:30
|
|
|
return h(
|
|
|
|
'div',
|
|
|
|
{
|
|
|
|
class: 'gl-tooltip',
|
|
|
|
...this.$attrs,
|
|
|
|
},
|
|
|
|
this.$slots.default,
|
|
|
|
);
|
2020-03-13 15:44:24 +05:30
|
|
|
},
|
2020-07-28 23:09:34 +05:30
|
|
|
}));
|
2020-04-22 19:07:51 +05:30
|
|
|
|
2023-05-27 22:25:52 +05:30
|
|
|
jest.mock('@gitlab/ui/dist/components/base/tooltip/tooltip.js', () =>
|
|
|
|
require('@gitlab/ui/src/components/base/tooltip/tooltip.vue'),
|
|
|
|
);
|
|
|
|
|
|
|
|
jest.mock('@gitlab/ui/src/components/base/popover/popover.vue', () => ({
|
2020-04-22 19:07:51 +05:30
|
|
|
props: {
|
|
|
|
cssClasses: {
|
|
|
|
type: Array,
|
|
|
|
required: false,
|
|
|
|
default: () => [],
|
|
|
|
},
|
2021-03-11 19:13:27 +05:30
|
|
|
...Object.fromEntries(
|
2022-04-04 11:22:00 +05:30
|
|
|
[
|
|
|
|
'title',
|
|
|
|
'target',
|
|
|
|
'triggers',
|
|
|
|
'placement',
|
|
|
|
'boundary',
|
|
|
|
'container',
|
|
|
|
'showCloseButton',
|
2023-03-04 22:38:38 +05:30
|
|
|
'show',
|
|
|
|
'boundaryPadding',
|
2022-04-04 11:22:00 +05:30
|
|
|
].map((prop) => [prop, {}]),
|
2021-03-11 19:13:27 +05:30
|
|
|
),
|
2020-04-22 19:07:51 +05:30
|
|
|
},
|
|
|
|
render(h) {
|
2021-01-29 00:20:46 +05:30
|
|
|
return h(
|
|
|
|
'div',
|
|
|
|
{
|
|
|
|
class: 'gl-popover',
|
|
|
|
...this.$attrs,
|
|
|
|
},
|
2021-03-08 18:12:59 +05:30
|
|
|
Object.keys(this.$slots).map((s) => this.$slots[s]),
|
2021-01-29 00:20:46 +05:30
|
|
|
);
|
2020-04-22 19:07:51 +05:30
|
|
|
},
|
2020-07-28 23:09:34 +05:30
|
|
|
}));
|
2023-05-27 22:25:52 +05:30
|
|
|
jest.mock('@gitlab/ui/dist/components/base/popover/popover.js', () =>
|
|
|
|
require('@gitlab/ui/src/components/base/popover/popover.vue'),
|
|
|
|
);
|