Skip to content
Snippets Groups Projects
Commit 74c21def authored by David Pisek's avatar David Pisek :three:
Browse files

Merge branch '368613-fix-collapsed-button-label' into 'master'

Move method into computed properties

See merge request !95787
parents 57ef891c 5bbd1db7
No related branches found
No related tags found
2 merge requests!96059Draft: Add GraphQL query for deployment details,!95787Move method into computed properties
Pipeline #617812869 passed
......@@ -85,6 +85,9 @@ export default {
};
},
computed: {
collapseButtonLabel() {
return sprintf(this.isCollapsed ? __('Show details') : __('Hide details'));
},
statusIcon() {
return this.error ? EXTENSION_ICONS.failed : this.statusIconName;
},
......@@ -106,9 +109,6 @@ export default {
this.isLoading = false;
},
methods: {
collapseButtonLabel() {
return sprintf(this.isCollapsed ? __('Show details') : __('Hide details'));
},
toggleCollapsed() {
this.isCollapsed = !this.isCollapsed;
},
......
......@@ -155,6 +155,21 @@ describe('MR Widget', () => {
});
describe('handle collapse toggle', () => {
it('displays the toggle button correctly', () => {
createComponent({
propsData: {
isCollapsible: true,
fetchCollapsedData: () => Promise.resolve(),
},
slots: {
content: '<b>More complex content</b>',
},
});
expect(findToggleButton().attributes('title')).toBe('Show details');
expect(findToggleButton().attributes('aria-label')).toBe('Show details');
});
it('does not display the content slot until toggle is clicked', async () => {
createComponent({
propsData: {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment