debian-mirror-gitlab/spec/frontend/__mocks__/@gitlab/ui.js

38 lines
1.1 KiB
JavaScript
Raw Normal View History

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
* for components that use it (e.g., `attachToDocument: true` and `sync: true` passed
* 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
jest.mock('@gitlab/ui/dist/directives/tooltip.js', () => ({
2020-03-13 15:44:24 +05:30
bind() {},
2020-07-28 23:09:34 +05:30
}));
2020-03-13 15:44:24 +05:30
2020-07-28 23:09:34 +05:30
jest.mock('@gitlab/ui/dist/components/base/tooltip/tooltip.js', () => ({
2020-03-13 15:44:24 +05:30
render(h) {
return h('div', this.$attrs, this.$slots.default);
},
2020-07-28 23:09:34 +05:30
}));
2020-04-22 19:07:51 +05:30
2020-07-28 23:09:34 +05:30
jest.mock('@gitlab/ui/dist/components/base/popover/popover.js', () => ({
2020-04-22 19:07:51 +05:30
props: {
cssClasses: {
type: Array,
required: false,
default: () => [],
},
},
render(h) {
return h('div', this.$attrs, Object.keys(this.$slots).map(s => this.$slots[s]));
},
2020-07-28 23:09:34 +05:30
}));