diff --git a/src/components/ec-container/__snapshots__/ec-container.spec.ts.snap b/src/components/ec-container/__snapshots__/ec-container.spec.ts.snap index 4af75c78f..14faf3213 100644 --- a/src/components/ec-container/__snapshots__/ec-container.spec.ts.snap +++ b/src/components/ec-container/__snapshots__/ec-container.spec.ts.snap @@ -1,5 +1,27 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html +exports[`EcContainer > should apply mobile layout styles when isResponsive is given 1`] = ` +
+
+ + +
+
+ + +
+
+`; + exports[`EcContainer > should make the navigation collapsable when isCollapsable is given 1`] = `
should not have a collapsable navigation by default 1`] =
`; +exports[`EcContainer > should not use mobile layout by default 1`] = ` +
+
+ + +
+
+ + +
+
+`; + exports[`EcContainer > should render empty if no slots were given 1`] = `
{ expect(wrapper.findByDataTest('ec-container__navigation').classes('ec-container__navigation--is-collapsable')).toBe(true); }); + it('should not use mobile layout by default', () => { + const wrapper = mountEcContainer(); + + expect(wrapper.element).toMatchSnapshot(); + expect(wrapper.findByDataTest('ec-container').classes('ec-container--is-responsive')).toBe(false); + expect(wrapper.findByDataTest('ec-container__navigation').classes('ec-container__navigation--is-responsive')).toBe(false); + }); + + it('should apply mobile layout styles when isResponsive is given', () => { + const wrapper = mountEcContainer({ isResponsive: true }); + + expect(wrapper.element).toMatchSnapshot(); + expect(wrapper.findByDataTest('ec-container').classes('ec-container--is-responsive')).toBe(true); + expect(wrapper.findByDataTest('ec-container__navigation').classes('ec-container__navigation--is-responsive')).toBe(true); + }); + it('should render empty if no slots were given', () => { const wrapper = mountEcContainer(); diff --git a/src/components/ec-container/ec-container.story.ts b/src/components/ec-container/ec-container.story.ts index 5a61b5536..555328a23 100644 --- a/src/components/ec-container/ec-container.story.ts +++ b/src/components/ec-container/ec-container.story.ts @@ -210,3 +210,25 @@ withNavigation.args = { copyrightText: 'Copyright text 2019', isCollapsed: false, }; + +export const withResponsiveLayout: StoryFn = args => ({ + components: { EcContainer }, + setup() { + return { args }; + }, + template: ` + + + + + `, +}); + +withResponsiveLayout.args = { + isCollapsable: false, + isResponsive: true, +}; diff --git a/src/components/ec-container/ec-container.vue b/src/components/ec-container/ec-container.vue index 7fd5a1d1f..13e96f6da 100644 --- a/src/components/ec-container/ec-container.vue +++ b/src/components/ec-container/ec-container.vue @@ -1,11 +1,15 @@