Skip to content

Commit

Permalink
exclude test temporarily for color mode and locale
Browse files Browse the repository at this point in the history
  • Loading branch information
Rajandeep98 committed Dec 6, 2024
1 parent 49b6522 commit 6da22cd
Showing 1 changed file with 54 additions and 52 deletions.
106 changes: 54 additions & 52 deletions web/site/app/tests/unit/components/ColorModeSelect.test.ts
Original file line number Diff line number Diff line change
@@ -1,64 +1,66 @@
import { describe, expect, it } from 'vitest'
import { mountSuspended, renderSuspended } from '@nuxt/test-utils/runtime'
import { fireEvent, screen } from '@testing-library/vue'
import { ColorModeSelect } from '#components'
import { enI18n } from '~/tests/mocks/i18n'
// // Commenting out tests temporarily

const $colorModeLight = {
preference: 'light'
}
// import { describe, expect, it } from 'vitest'
// import { mountSuspended, renderSuspended } from '@nuxt/test-utils/runtime'
// import { fireEvent, screen } from '@testing-library/vue'
// import { ColorModeSelect } from '#components'
// import { enI18n } from '~/tests/mocks/i18n'

const $colorModeDark = {
preference: 'dark'
}
// const $colorModeLight = {
// preference: 'light'
// }

describe.skip('<ColorModeSelect/>', () => {
it('mounts in light mode', async () => {
const component = await mountSuspended(ColorModeSelect, {
global: {
mocks: {
$colorMode: $colorModeLight
},
plugins: [enI18n]
}
})
// const $colorModeDark = {
// preference: 'dark'
// }

expect(component.attributes('aria-label')).to.equal('Switch to dark mode')
expect(component.html()).to.contain('<span class="i-mdi-white-balance-sunny flex-shrink-0 h-5 w-5" aria-hidden="true"></span>')
})
// describe('<ColorModeSelect/>', () => {
// it('mounts in light mode', async () => {
// const component = await mountSuspended(ColorModeSelect, {
// global: {
// mocks: {
// $colorMode: $colorModeLight
// },
// plugins: [enI18n]
// }
// })

it.skip('mounts in dark mode', async () => {
const component = await mountSuspended(ColorModeSelect, {
global: {
mocks: {
$colorMode: $colorModeDark
},
plugins: [enI18n]
}
})
// expect(component.attributes('aria-label')).to.equal('Switch to dark mode')
// expect(component.html()).to.contain('<span class="i-mdi-white-balance-sunny flex-shrink-0 h-5 w-5" aria-hidden="true"></span>')
// })

expect(component.attributes('aria-label')).to.equal('Switch to light mode')
expect(component.html()).to.contain('<span class="i-mdi-moon-waning-crescent flex-shrink-0 h-5 w-5" aria-hidden="true"></span>')
})
// it('mounts in dark mode', async () => {
// const component = await mountSuspended(ColorModeSelect, {
// global: {
// mocks: {
// $colorMode: $colorModeDark
// },
// plugins: [enI18n]
// }
// })

it.skip('can change colormode preference', async () => {
await renderSuspended(ColorModeSelect, {
global: {
mocks: {
$colorMode: $colorModeLight
},
plugins: [enI18n]
}
})
// expect(component.attributes('aria-label')).to.equal('Switch to light mode')
// expect(component.html()).to.contain('<span class="i-mdi-moon-waning-crescent flex-shrink-0 h-5 w-5" aria-hidden="true"></span>')
// })

const button = screen.getByRole('button')
// it('can change colormode preference', async () => {
// await renderSuspended(ColorModeSelect, {
// global: {
// mocks: {
// $colorMode: $colorModeLight
// },
// plugins: [enI18n]
// }
// })

await fireEvent.click(button)
// const button = screen.getByRole('button')

expect($colorModeLight.preference).to.equal('dark')
// await fireEvent.click(button)

await fireEvent.click(button)
// expect($colorModeLight.preference).to.equal('dark')

expect($colorModeLight.preference).to.equal('light')
})
})
// await fireEvent.click(button)

// expect($colorModeLight.preference).to.equal('light')
// })
// })

0 comments on commit 6da22cd

Please sign in to comment.