mirror of
				https://github.com/lingble/chatwoot.git
				synced 2025-11-04 04:57:51 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			42 lines
		
	
	
		
			1.0 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			42 lines
		
	
	
		
			1.0 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
import { shallowMount, createLocalVue } from '@vue/test-utils';
 | 
						|
import darkModeMixin from '../darkModeMixin';
 | 
						|
import Vuex from 'vuex';
 | 
						|
const localVue = createLocalVue();
 | 
						|
localVue.use(Vuex);
 | 
						|
 | 
						|
const darkModeValues = ['light', 'auto'];
 | 
						|
 | 
						|
describe('darkModeMixin', () => {
 | 
						|
  let getters;
 | 
						|
  let store;
 | 
						|
  beforeEach(() => {
 | 
						|
    getters = {
 | 
						|
      'appConfig/darkMode': () => darkModeValues[0],
 | 
						|
    };
 | 
						|
    store = new Vuex.Store({ getters });
 | 
						|
  });
 | 
						|
 | 
						|
  it('if light theme', () => {
 | 
						|
    const Component = {
 | 
						|
      render() {},
 | 
						|
      mixins: [darkModeMixin],
 | 
						|
    };
 | 
						|
    const wrapper = shallowMount(Component, { store, localVue });
 | 
						|
    expect(wrapper.vm.$dm('bg-100', 'bg-600')).toBe('bg-100');
 | 
						|
  });
 | 
						|
 | 
						|
  it('if auto theme', () => {
 | 
						|
    getters = {
 | 
						|
      'appConfig/darkMode': () => darkModeValues[2],
 | 
						|
    };
 | 
						|
    store = new Vuex.Store({ getters });
 | 
						|
 | 
						|
    const Component = {
 | 
						|
      render() {},
 | 
						|
      mixins: [darkModeMixin],
 | 
						|
    };
 | 
						|
    const wrapper = shallowMount(Component, { store, localVue });
 | 
						|
    expect(wrapper.vm.$dm('bg-100', 'bg-600')).toBe('bg-100 bg-600');
 | 
						|
  });
 | 
						|
});
 |