Skip to content

Commit

Permalink
Adjust Actions tests
Browse files Browse the repository at this point in the history
Signed-off-by: John Molakvoæ <skjnldsv@protonmail.com>
  • Loading branch information
skjnldsv committed Aug 18, 2022
1 parent 717166d commit 40e15b0
Showing 1 changed file with 42 additions and 2 deletions.
44 changes: 42 additions & 2 deletions tests/unit/components/Actions/Actions.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ describe('Actions.vue', () => {
slots: {
default: [
'<ActionButton>Test1</ActionButton>',
'<ActionButton>Test2</ActionButton>'
'<ActionButton>Test2</ActionButton>',
],
},
stubs: {
Expand All @@ -54,7 +54,7 @@ describe('Actions.vue', () => {
wrapper = mount(Actions, {
slots: {
default: [
'<ActionButton>Test1</ActionButton>'
'<ActionButton>Test1</ActionButton>',
],
},
stubs: {
Expand All @@ -71,5 +71,45 @@ describe('Actions.vue', () => {
expect(wrapper.find('.action-item__menutoggle').exists()).toBe(true)
})
})

describe('3 ActionButton with one inline', () => {
beforeEach(() => {
wrapper = mount(Actions, {
slots: {
default: [
'<ActionButton>Test1</ActionButton>',
'<ActionButton>Test2</ActionButton>',
'<ActionButton>Test3</ActionButton>',
],
},
stubs: {
// used to register custom components
ActionButton,
},
propsData: {
inline: 1,
},
})
})
it('shows the first action outside.', () => {
expect(wrapper.findAll('.action-item').length).toBe(2)
expect(wrapper.findAll('button.action-item').length).toBe(1)
expect(wrapper.find('button.action-item').exists()).toBe(true)
})
it('shows the menu toggle.', () => {
expect(wrapper.find('.action-item__menutoggle').exists()).toBe(true)
})
it('shows the first two action outside on prop change.', async () => {
await wrapper.setProps({ inline: 2 })
expect(wrapper.findAll('.action-item').length).toBe(3)
expect(wrapper.findAll('button.action-item').length).toBe(2)
})
it('shows all actions outside on prop change.', async () => {
await wrapper.setProps({ inline: 3 })
expect(wrapper.findAll('.action-item').length).toBe(3)
expect(wrapper.findAll('button.action-item').length).toBe(3)
expect(wrapper.find('.action-item__menutoggle').exists()).toBe(false)
})
})
})
})

0 comments on commit 40e15b0

Please sign in to comment.