@gitlab/ui 44.0.0 → 44.1.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
|
+
# [44.1.0](https://gitlab.com/gitlab-org/gitlab-ui/compare/v44.0.0...v44.1.0) (2022-10-05)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* **GlAlert:** add aria-live attribute ([89b866b](https://gitlab.com/gitlab-org/gitlab-ui/commit/89b866b771514bc6db25108b4defaed8df53c052))
|
|
7
|
+
|
|
1
8
|
# [44.0.0](https://gitlab.com/gitlab-org/gitlab-ui/compare/v43.21.0...v44.0.0) (2022-10-05)
|
|
2
9
|
|
|
3
10
|
|
|
@@ -93,6 +93,14 @@ var script = {
|
|
|
93
93
|
}
|
|
94
94
|
},
|
|
95
95
|
computed: {
|
|
96
|
+
ariaLive() {
|
|
97
|
+
if ([alertVariantOptions.danger, alertVariantOptions.warning].includes(this.variant)) {
|
|
98
|
+
return 'assertive';
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
return 'polite';
|
|
102
|
+
},
|
|
103
|
+
|
|
96
104
|
iconName() {
|
|
97
105
|
return alertVariantIconMap[this.variant];
|
|
98
106
|
},
|
|
@@ -187,7 +195,7 @@ var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=
|
|
|
187
195
|
{ 'gl-alert-sticky': _vm.sticky },
|
|
188
196
|
{ 'gl-alert-not-dismissible': !_vm.dismissible },
|
|
189
197
|
{ 'gl-alert-no-icon': !_vm.showIcon },
|
|
190
|
-
_vm.variantClass ]},[(_vm.showIcon)?_c('gl-icon',{class:{ 'gl-alert-icon': true, 'gl-alert-icon-no-title': !_vm.title },attrs:{"name":_vm.iconName}}):_vm._e(),_vm._v(" "),_c('div',{staticClass:"gl-alert-content",attrs:{"role":"alert"}},[(_vm.title)?_c('h2',{staticClass:"gl-alert-title"},[_vm._v(_vm._s(_vm.title))]):_vm._e(),_vm._v(" "),_c('div',{staticClass:"gl-alert-body"},[_vm._t("default")],2),_vm._v(" "),(_vm.shouldRenderActions)?_c('div',{staticClass:"gl-alert-actions"},[_vm._t("actions",function(){return _vm._l((_vm.actionButtons),function(actionButton,index){return _c('gl-button',_vm._g(_vm._b({key:index,staticClass:"gl-alert-action"},'gl-button',actionButton.attrs,false),actionButton.listeners),[_vm._v("\n "+_vm._s(actionButton.text)+"\n ")])})})],2):_vm._e()]),_vm._v(" "),(_vm.dismissible)?_c('close-button',{ref:"dismiss",staticClass:"gl-dismiss-btn",attrs:{"label":_vm.dismissLabel},on:{"click":_vm.onDismiss}}):_vm._e()],1)};
|
|
198
|
+
_vm.variantClass ]},[(_vm.showIcon)?_c('gl-icon',{class:{ 'gl-alert-icon': true, 'gl-alert-icon-no-title': !_vm.title },attrs:{"name":_vm.iconName}}):_vm._e(),_vm._v(" "),_c('div',{staticClass:"gl-alert-content",attrs:{"role":"alert","aria-live":_vm.ariaLive}},[(_vm.title)?_c('h2',{staticClass:"gl-alert-title"},[_vm._v(_vm._s(_vm.title))]):_vm._e(),_vm._v(" "),_c('div',{staticClass:"gl-alert-body"},[_vm._t("default")],2),_vm._v(" "),(_vm.shouldRenderActions)?_c('div',{staticClass:"gl-alert-actions"},[_vm._t("actions",function(){return _vm._l((_vm.actionButtons),function(actionButton,index){return _c('gl-button',_vm._g(_vm._b({key:index,staticClass:"gl-alert-action"},'gl-button',actionButton.attrs,false),actionButton.listeners),[_vm._v("\n "+_vm._s(actionButton.text)+"\n ")])})})],2):_vm._e()]),_vm._v(" "),(_vm.dismissible)?_c('close-button',{ref:"dismiss",staticClass:"gl-dismiss-btn",attrs:{"label":_vm.dismissLabel},on:{"click":_vm.onDismiss}}):_vm._e()],1)};
|
|
191
199
|
var __vue_staticRenderFns__ = [];
|
|
192
200
|
|
|
193
201
|
/* style */
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { shallowMount } from '@vue/test-utils';
|
|
2
|
-
import { buttonCategoryOptions } from '../../../utils/constants';
|
|
2
|
+
import { alertVariantOptions, buttonCategoryOptions } from '../../../utils/constants';
|
|
3
3
|
import GlAlert from './alert.vue';
|
|
4
4
|
|
|
5
5
|
const DummyComponent = {
|
|
@@ -191,4 +191,24 @@ describe('Alert component', () => {
|
|
|
191
191
|
});
|
|
192
192
|
});
|
|
193
193
|
});
|
|
194
|
+
|
|
195
|
+
describe('aria-live', () => {
|
|
196
|
+
it.each([alertVariantOptions.danger, alertVariantOptions.warning])(
|
|
197
|
+
'for %p variant, has aria-live assertive attribute',
|
|
198
|
+
(variant) => {
|
|
199
|
+
createComponent({ propsData: { variant } });
|
|
200
|
+
|
|
201
|
+
expect(wrapper.find('[aria-live=assertive').exists()).toBe(true);
|
|
202
|
+
}
|
|
203
|
+
);
|
|
204
|
+
|
|
205
|
+
it.each([alertVariantOptions.info, alertVariantOptions.success, alertVariantOptions.tip])(
|
|
206
|
+
'for %p variant, has aria-live polite attribute',
|
|
207
|
+
(variant) => {
|
|
208
|
+
createComponent({ propsData: { variant } });
|
|
209
|
+
|
|
210
|
+
expect(wrapper.find('[aria-live=polite]').exists()).toBe(true);
|
|
211
|
+
}
|
|
212
|
+
);
|
|
213
|
+
});
|
|
194
214
|
});
|
|
@@ -90,6 +90,13 @@ export default {
|
|
|
90
90
|
},
|
|
91
91
|
},
|
|
92
92
|
computed: {
|
|
93
|
+
ariaLive() {
|
|
94
|
+
if ([alertVariantOptions.danger, alertVariantOptions.warning].includes(this.variant)) {
|
|
95
|
+
return 'assertive';
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
return 'polite';
|
|
99
|
+
},
|
|
93
100
|
iconName() {
|
|
94
101
|
return alertVariantIconMap[this.variant];
|
|
95
102
|
},
|
|
@@ -185,7 +192,7 @@ export default {
|
|
|
185
192
|
:class="{ 'gl-alert-icon': true, 'gl-alert-icon-no-title': !title }"
|
|
186
193
|
/>
|
|
187
194
|
|
|
188
|
-
<div class="gl-alert-content" role="alert">
|
|
195
|
+
<div class="gl-alert-content" role="alert" :aria-live="ariaLive">
|
|
189
196
|
<h2 v-if="title" class="gl-alert-title">{{ title }}</h2>
|
|
190
197
|
|
|
191
198
|
<div class="gl-alert-body">
|