@gitlab/ui 41.7.1 → 41.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
# [41.8.0](https://gitlab.com/gitlab-org/gitlab-ui/compare/v41.7.1...v41.8.0) (2022-06-14)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* **Tabs:** Use unique href for each tab ([171664d](https://gitlab.com/gitlab-org/gitlab-ui/commit/171664d2b5d74cc0bca174637705d89fc6197344))
|
|
7
|
+
|
|
1
8
|
## [41.7.1](https://gitlab.com/gitlab-org/gitlab-ui/compare/v41.7.0...v41.7.1) (2022-06-13)
|
|
2
9
|
|
|
3
10
|
|
|
@@ -23,6 +23,15 @@ var script = {
|
|
|
23
23
|
type: String,
|
|
24
24
|
required: false,
|
|
25
25
|
default: null
|
|
26
|
+
},
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Provide an `href` for the tab, for example to associate the tab with the tab panel's ID
|
|
30
|
+
*/
|
|
31
|
+
href: {
|
|
32
|
+
type: String,
|
|
33
|
+
required: false,
|
|
34
|
+
default: '#'
|
|
26
35
|
}
|
|
27
36
|
},
|
|
28
37
|
computed: {
|
|
@@ -51,7 +60,7 @@ var script = {
|
|
|
51
60
|
const __vue_script__ = script;
|
|
52
61
|
|
|
53
62
|
/* template */
|
|
54
|
-
var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('b-tab',_vm._g(_vm._b({attrs:{"title-link-class":_vm.linkClass,"query-param-value":_vm.queryParamValue},scopedSlots:_vm._u([_vm._l((Object.keys(_vm.$slots)),function(slot){return {key:slot,fn:function(){return [_vm._t(slot)]},proxy:true}})],null,true)},'b-tab',_vm.$attrs,false),_vm.$listeners))};
|
|
63
|
+
var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('b-tab',_vm._g(_vm._b({attrs:{"title-link-class":_vm.linkClass,"query-param-value":_vm.queryParamValue,"title-link-attributes":{ href: _vm.href }},scopedSlots:_vm._u([_vm._l((Object.keys(_vm.$slots)),function(slot){return {key:slot,fn:function(){return [_vm._t(slot)]},proxy:true}})],null,true)},'b-tab',_vm.$attrs,false),_vm.$listeners))};
|
|
55
64
|
var __vue_staticRenderFns__ = [];
|
|
56
65
|
|
|
57
66
|
/* style */
|
package/package.json
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { shallowMount } from '@vue/test-utils';
|
|
2
|
+
import { BTab } from 'bootstrap-vue';
|
|
2
3
|
import { DEFAULT_TAB_TITLE_LINK_CLASS } from '../constants';
|
|
3
4
|
import GlTab from './tab.vue';
|
|
4
5
|
|
|
@@ -6,9 +7,7 @@ describe('Tab component', () => {
|
|
|
6
7
|
let wrapper;
|
|
7
8
|
|
|
8
9
|
const createComponent = (options) => {
|
|
9
|
-
wrapper = shallowMount(GlTab, {
|
|
10
|
-
...options,
|
|
11
|
-
});
|
|
10
|
+
wrapper = shallowMount(GlTab, { ...options });
|
|
12
11
|
};
|
|
13
12
|
|
|
14
13
|
it.each`
|
|
@@ -22,14 +21,25 @@ describe('Tab component', () => {
|
|
|
22
21
|
'computed title link class is $expectedProp when titleLinkClass is $titleLinkClass',
|
|
23
22
|
({ titleLinkClass, expectedProp }) => {
|
|
24
23
|
createComponent({
|
|
25
|
-
propsData: {
|
|
26
|
-
titleLinkClass,
|
|
27
|
-
},
|
|
24
|
+
propsData: { titleLinkClass },
|
|
28
25
|
});
|
|
29
26
|
|
|
30
|
-
expect(wrapper.
|
|
31
|
-
`<b-tab-stub tag="div" title="" titlelinkclass="${expectedProp}"></b-tab-stub>`
|
|
32
|
-
);
|
|
27
|
+
expect(wrapper.findComponent(BTab).props('titleLinkClass')).toEqual(expectedProp);
|
|
33
28
|
}
|
|
34
29
|
);
|
|
30
|
+
|
|
31
|
+
it('passes title-link-attributes to b-tab when href is explicitly passed', () => {
|
|
32
|
+
const titleLinkAttributes = 'href-example';
|
|
33
|
+
const expectedProp = { href: titleLinkAttributes };
|
|
34
|
+
createComponent({
|
|
35
|
+
propsData: { href: titleLinkAttributes },
|
|
36
|
+
});
|
|
37
|
+
expect(wrapper.findComponent(BTab).props('titleLinkAttributes')).toEqual(expectedProp);
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
it('passes # as href to b-tab when href is not passed', () => {
|
|
41
|
+
const expectedProp = { href: '#' };
|
|
42
|
+
createComponent();
|
|
43
|
+
expect(wrapper.findComponent(BTab).props('titleLinkAttributes')).toEqual(expectedProp);
|
|
44
|
+
});
|
|
35
45
|
});
|
|
@@ -24,6 +24,14 @@ export default {
|
|
|
24
24
|
required: false,
|
|
25
25
|
default: null,
|
|
26
26
|
},
|
|
27
|
+
/**
|
|
28
|
+
* Provide an `href` for the tab, for example to associate the tab with the tab panel's ID
|
|
29
|
+
*/
|
|
30
|
+
href: {
|
|
31
|
+
type: String,
|
|
32
|
+
required: false,
|
|
33
|
+
default: '#',
|
|
34
|
+
},
|
|
27
35
|
},
|
|
28
36
|
computed: {
|
|
29
37
|
linkClass() {
|
|
@@ -46,6 +54,7 @@ export default {
|
|
|
46
54
|
:title-link-class="linkClass"
|
|
47
55
|
:query-param-value="queryParamValue"
|
|
48
56
|
v-bind="$attrs"
|
|
57
|
+
:title-link-attributes="{ href }"
|
|
49
58
|
v-on="$listeners"
|
|
50
59
|
>
|
|
51
60
|
<template v-for="slot in Object.keys($slots)" #[slot]>
|
|
@@ -226,6 +226,20 @@ WithScrollAndGrowing.parameters = {
|
|
|
226
226
|
storyshots: { disable: true },
|
|
227
227
|
};
|
|
228
228
|
|
|
229
|
+
export const WithHref = (_args, { argTypes }) => ({
|
|
230
|
+
props: Object.keys(argTypes),
|
|
231
|
+
components: { ...components, GlBadge },
|
|
232
|
+
template: wrap(`
|
|
233
|
+
<gl-tab href="#tab-1" title="Tab 1">
|
|
234
|
+
<h2 id="tab-1">Tab panel 1</h2>
|
|
235
|
+
<p>Some paragraph text<p>
|
|
236
|
+
</gl-tab>
|
|
237
|
+
<gl-tab href="#tab-2" title="Tab 2">
|
|
238
|
+
<h2 id="tab-2">Tab panel 2</h2>
|
|
239
|
+
<p>Some paragraph text<p>
|
|
240
|
+
</gl-tab>`),
|
|
241
|
+
});
|
|
242
|
+
|
|
229
243
|
export default {
|
|
230
244
|
title: 'base/tabs',
|
|
231
245
|
component: GlTabs,
|