2019-12-20 13:07:53 -05:00
|
|
|
export * from '@gitlab/ui';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The @gitlab/ui tooltip directive requires awkward and distracting set up in tests
|
2020-12-25 13:10:00 -05:00
|
|
|
* for components that use it (e.g., `attachTo: document.body` and `sync: true` passed
|
2019-12-20 13:07:53 -05:00
|
|
|
* 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-08 23:09:01 -04:00
|
|
|
*
|
|
|
|
* 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`.
|
2019-12-20 13:07:53 -05:00
|
|
|
*/
|
2020-07-08 23:09:01 -04:00
|
|
|
|
|
|
|
jest.mock('@gitlab/ui/dist/directives/tooltip.js', () => ({
|
2019-12-20 13:07:53 -05:00
|
|
|
bind() {},
|
2020-07-08 23:09:01 -04:00
|
|
|
}));
|
2019-12-20 13:07:53 -05:00
|
|
|
|
2020-07-08 23:09:01 -04:00
|
|
|
jest.mock('@gitlab/ui/dist/components/base/tooltip/tooltip.js', () => ({
|
2020-10-21 17:09:00 -04:00
|
|
|
props: ['target', 'id', 'triggers', 'placement', 'container', 'boundary', 'disabled', 'show'],
|
2019-12-20 13:07:53 -05:00
|
|
|
render(h) {
|
2020-08-26 11:10:29 -04:00
|
|
|
return h(
|
|
|
|
'div',
|
|
|
|
{
|
|
|
|
class: 'gl-tooltip',
|
|
|
|
...this.$attrs,
|
|
|
|
},
|
|
|
|
this.$slots.default,
|
|
|
|
);
|
2019-12-20 13:07:53 -05:00
|
|
|
},
|
2020-07-08 23:09:01 -04:00
|
|
|
}));
|
2020-03-27 08:07:43 -04:00
|
|
|
|
2020-07-08 23:09:01 -04:00
|
|
|
jest.mock('@gitlab/ui/dist/components/base/popover/popover.js', () => ({
|
2020-03-27 08:07:43 -04:00
|
|
|
props: {
|
|
|
|
cssClasses: {
|
|
|
|
type: Array,
|
|
|
|
required: false,
|
|
|
|
default: () => [],
|
|
|
|
},
|
2021-02-12 07:09:02 -05:00
|
|
|
...Object.fromEntries(
|
2021-03-02 07:10:52 -05:00
|
|
|
['title', 'target', 'triggers', 'placement', 'boundary', 'container'].map((prop) => [
|
|
|
|
prop,
|
|
|
|
{},
|
|
|
|
]),
|
2021-02-12 07:09:02 -05:00
|
|
|
),
|
2020-03-27 08:07:43 -04:00
|
|
|
},
|
|
|
|
render(h) {
|
2020-10-27 11:08:39 -04:00
|
|
|
return h(
|
|
|
|
'div',
|
|
|
|
{
|
|
|
|
class: 'gl-popover',
|
|
|
|
...this.$attrs,
|
|
|
|
},
|
2020-12-23 16:10:24 -05:00
|
|
|
Object.keys(this.$slots).map((s) => this.$slots[s]),
|
2020-10-27 11:08:39 -04:00
|
|
|
);
|
2020-03-27 08:07:43 -04:00
|
|
|
},
|
2020-07-08 23:09:01 -04:00
|
|
|
}));
|