-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
exclude test temporarily for color mode and locale
- Loading branch information
1 parent
49b6522
commit 6da22cd
Showing
1 changed file
with
54 additions
and
52 deletions.
There are no files selected for viewing
106 changes: 54 additions & 52 deletions
106
web/site/app/tests/unit/components/ColorModeSelect.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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') | ||
// }) | ||
// }) |