import {
registerNavbarPicker,
registerSidebarPicker,
} from '@/views/admin/Customization'
test('preview navbar color', () => {
const nav = document.createElement('nav')
nav.className = 'navbar-primary navbar-dark'
const picker = document.createElement('div')
picker.innerHTML = `
`
const cyan = picker.querySelector('[value=cyan]')!
const orange = picker.querySelector('[value=orange]')!
registerNavbarPicker(nav, picker, 'primary')
cyan.click()
expect(nav.className).toContain('navbar-cyan')
expect(nav.className).toContain('navbar-dark')
expect(nav.className).not.toContain('navbar-light')
orange.click()
expect(nav.className).toContain('navbar-orange')
expect(nav.className).not.toContain('navbar-cyan')
expect(nav.className).toContain('navbar-light')
expect(nav.className).not.toContain('navbar-dark')
})
test('preview sidebar color', () => {
const sidebar = document.createElement('aside')
sidebar.className = 'sidebar-dark-primary'
const darkPicker = document.createElement('div')
darkPicker.innerHTML = `
`
const darkCyan = darkPicker.querySelector('[value="dark-cyan"]')!
const lightPicker = document.createElement('div')
lightPicker.innerHTML = `
`
const lightCyan = lightPicker.querySelector('[value="light-cyan"]')!
registerSidebarPicker(
sidebar,
{ dark: darkPicker, light: lightPicker },
'dark-primary',
)
darkCyan.click()
expect(sidebar.className).toContain('sidebar-dark-cyan')
lightCyan.click()
expect(sidebar.className).toContain('sidebar-light-cyan')
})