Commit 22153938 authored by Enrique Alcántara's avatar Enrique Alcántara

Merge branch '321512-support-slide-animation-settings-block' into 'master'

Add support to animate slide for settings-block component

See merge request gitlab-org/gitlab!54305
parents 9a75456a 66396612
...@@ -5,6 +5,11 @@ import { __ } from '~/locale'; ...@@ -5,6 +5,11 @@ import { __ } from '~/locale';
export default { export default {
components: { GlButton }, components: { GlButton },
props: { props: {
slideAnimated: {
type: Boolean,
default: true,
required: false,
},
defaultExpanded: { defaultExpanded: {
type: Boolean, type: Boolean,
default: false, default: false,
...@@ -28,7 +33,7 @@ export default { ...@@ -28,7 +33,7 @@ export default {
</script> </script>
<template> <template>
<section class="settings no-animate" :class="{ expanded }"> <section class="settings" :class="{ 'no-animate': !slideAnimated, expanded }">
<div class="settings-header"> <div class="settings-header">
<h4><slot name="title"></slot></h4> <h4><slot name="title"></slot></h4>
<gl-button @click="sectionExpanded = !sectionExpanded"> <gl-button @click="sectionExpanded = !sectionExpanded">
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
exports[`Settings Block renders the correct markup 1`] = ` exports[`Settings Block renders the correct markup 1`] = `
<section <section
class="settings no-animate" class="settings"
> >
<div <div
class="settings-header" class="settings-header"
......
...@@ -50,6 +50,27 @@ describe('Settings Block', () => { ...@@ -50,6 +50,27 @@ describe('Settings Block', () => {
expect(findDescriptionSlot().exists()).toBe(true); expect(findDescriptionSlot().exists()).toBe(true);
}); });
describe('slide animation behaviour', () => {
it('is animated by default', () => {
mountComponent();
expect(wrapper.classes('no-animate')).toBe(false);
});
it.each`
slideAnimated | noAnimatedClass
${true} | ${false}
${false} | ${true}
`(
'sets the correct state when slideAnimated is $slideAnimated',
({ slideAnimated, noAnimatedClass }) => {
mountComponent({ slideAnimated });
expect(wrapper.classes('no-animate')).toBe(noAnimatedClass);
},
);
});
describe('expanded behaviour', () => { describe('expanded behaviour', () => {
it('is collapsed by default', () => { it('is collapsed by default', () => {
mountComponent(); mountComponent();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment