mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
fix test
This commit is contained in:
parent
d54a04f825
commit
4e69e4de88
@ -87,7 +87,7 @@ describe('LanguageSwitch', () => {
|
||||
languageGetter.mockReturnValue('fr-FR')
|
||||
wrapper.vm.setCurrentLanguage()
|
||||
await wrapper.vm.$nextTick()
|
||||
expect(wrapper.find('button.dropdown-toggle').text()).toBe('France - fr')
|
||||
expect(wrapper.find('button.dropdown-toggle').text()).toBe('French - fr')
|
||||
})
|
||||
})
|
||||
|
||||
@ -98,7 +98,7 @@ describe('LanguageSwitch', () => {
|
||||
languageGetter.mockReturnValue('nl-NL')
|
||||
wrapper.vm.setCurrentLanguage()
|
||||
await wrapper.vm.$nextTick()
|
||||
expect(wrapper.find('button.dropdown-toggle').text()).toBe('Niederland - nl')
|
||||
expect(wrapper.find('button.dropdown-toggle').text()).toBe('Dutch - nl')
|
||||
})
|
||||
})
|
||||
|
||||
@ -143,9 +143,27 @@ describe('LanguageSwitch', () => {
|
||||
})
|
||||
})
|
||||
|
||||
describe('language "fr" in store', () => {
|
||||
it('shows French as language', async () => {
|
||||
wrapper.vm.$store.state.language = 'fr'
|
||||
wrapper.vm.setCurrentLanguage()
|
||||
await wrapper.vm.$nextTick()
|
||||
expect(wrapper.find('button.dropdown-toggle').text()).toBe('French - fr')
|
||||
})
|
||||
})
|
||||
|
||||
describe('language "nl" in store', () => {
|
||||
it('shows Dutch as language', async () => {
|
||||
wrapper.vm.$store.state.language = 'nl'
|
||||
wrapper.vm.setCurrentLanguage()
|
||||
await wrapper.vm.$nextTick()
|
||||
expect(wrapper.find('button.dropdown-toggle').text()).toBe('Dutch - nl')
|
||||
})
|
||||
})
|
||||
|
||||
describe('dropdown menu', () => {
|
||||
it('has English and German as languages to choose', () => {
|
||||
expect(wrapper.findAll('li')).toHaveLength(3)
|
||||
expect(wrapper.findAll('li')).toHaveLength(5)
|
||||
})
|
||||
|
||||
it('has English as first language to choose', () => {
|
||||
@ -159,6 +177,14 @@ describe('LanguageSwitch', () => {
|
||||
it('has Español as second language to choose', () => {
|
||||
expect(wrapper.findAll('li').at(2).text()).toBe('Español')
|
||||
})
|
||||
|
||||
it('has French as second language to choose', () => {
|
||||
expect(wrapper.findAll('li').at(3).text()).toBe('French')
|
||||
})
|
||||
|
||||
it('has Dutch as second language to choose', () => {
|
||||
expect(wrapper.findAll('li').at(4).text()).toBe('Dutch')
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
@ -184,6 +210,39 @@ describe('LanguageSwitch', () => {
|
||||
}),
|
||||
)
|
||||
})
|
||||
|
||||
it("with locale 'es'", () => {
|
||||
wrapper.findAll('li').at(2).find('a').trigger('click')
|
||||
expect(updateUserInfosMutationMock).toBeCalledWith(
|
||||
expect.objectContaining({
|
||||
variables: {
|
||||
locale: 'es',
|
||||
},
|
||||
}),
|
||||
)
|
||||
})
|
||||
|
||||
it("with locale 'fr'", () => {
|
||||
wrapper.findAll('li').at(3).find('a').trigger('click')
|
||||
expect(updateUserInfosMutationMock).toBeCalledWith(
|
||||
expect.objectContaining({
|
||||
variables: {
|
||||
locale: 'fr',
|
||||
},
|
||||
}),
|
||||
)
|
||||
})
|
||||
|
||||
it("with locale 'nl'", () => {
|
||||
wrapper.findAll('li').at(4).find('a').trigger('click')
|
||||
expect(updateUserInfosMutationMock).toBeCalledWith(
|
||||
expect.objectContaining({
|
||||
variables: {
|
||||
locale: 'nl',
|
||||
},
|
||||
}),
|
||||
)
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
@ -81,7 +81,7 @@ describe('LanguageSwitch', () => {
|
||||
languageGetter.mockReturnValue('fr-FR')
|
||||
wrapper.vm.setCurrentLanguage()
|
||||
await wrapper.vm.$nextTick()
|
||||
expect(wrapper.findAll('span.locales').at(3).text()).toBe('France')
|
||||
expect(wrapper.findAll('span.locales').at(3).text()).toBe('French')
|
||||
})
|
||||
})
|
||||
describe('navigator language is "nl-NL"', () => {
|
||||
@ -90,7 +90,7 @@ describe('LanguageSwitch', () => {
|
||||
languageGetter.mockReturnValue('nl-NL')
|
||||
wrapper.vm.setCurrentLanguage()
|
||||
await wrapper.vm.$nextTick()
|
||||
expect(wrapper.findAll('span.locales').at(4).text()).toBe('Niederlande')
|
||||
expect(wrapper.findAll('span.locales').at(4).text()).toBe('Dutch')
|
||||
})
|
||||
})
|
||||
describe('navigator language is "it-IT" (not supported)', () => {
|
||||
@ -130,7 +130,7 @@ describe('LanguageSwitch', () => {
|
||||
})
|
||||
describe('language menu', () => {
|
||||
it('has English, German and Español as languages to choose', () => {
|
||||
expect(wrapper.findAll('span.locales')).toHaveLength(3)
|
||||
expect(wrapper.findAll('span.locales')).toHaveLength(5)
|
||||
})
|
||||
it('has English as first language to choose', () => {
|
||||
expect(wrapper.findAll('span.locales').at(0).text()).toBe('English')
|
||||
@ -141,6 +141,12 @@ describe('LanguageSwitch', () => {
|
||||
it('has Español as third language to choose', () => {
|
||||
expect(wrapper.findAll('span.locales').at(2).text()).toBe('Español')
|
||||
})
|
||||
it('has French as third language to choose', () => {
|
||||
expect(wrapper.findAll('span.locales').at(3).text()).toBe('French')
|
||||
})
|
||||
it('has Dutch as third language to choose', () => {
|
||||
expect(wrapper.findAll('span.locales').at(4).text()).toBe('Dutch')
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
@ -155,17 +161,6 @@ describe('LanguageSwitch', () => {
|
||||
}),
|
||||
)
|
||||
})
|
||||
|
||||
// it("with locale 'en'", () => {
|
||||
// wrapper.findAll('span.locales').at(0).trigger('click')
|
||||
// expect(updateUserInfosMutationMock).toBeCalledWith(
|
||||
// expect.objectContaining({
|
||||
// variables: {
|
||||
// locale: 'en',
|
||||
// },
|
||||
// }),
|
||||
// )
|
||||
// })
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user