oh please work

This commit is contained in:
Chris Nutter committed 2020-09-07 14:15:44 -07:00
1 parent e3c2d1b295
commit 18467e0fd4
142 files changed
+22252

No files matched your search

@@ -0,0 +1,36 @@
'use babel';
import buildColorSettings from '../../lib/colors/build-color-settings';
describe('Settings string', () => {
it('should return default values when no arguments are given', () => {
const defaultSettings = buildColorSettings();
expect(typeof defaultSettings).toBe('string');
expect(!!defaultSettings).not.toBe(false);
expect(defaultSettings.indexOf('@base-color: #009688'))
.toBeGreaterThan(-1);
expect(defaultSettings.indexOf('@accent-color: #FFFFFF'))
.toBeGreaterThan(-1);
expect(defaultSettings.indexOf('@accent-text-color: rgba(255,255,255,0.9)'))
.toBeGreaterThan(-1);
});
it('should return the selected @base-color', () => {
expect(buildColorSettings('#FF0000').indexOf('@base-color: #FF0000'))
.toBeGreaterThan(-1);
});
it('should return the selected @base-color and @accent-color', () => {
const customSettings = buildColorSettings('#FF0000', '#FAFAFA');
expect(customSettings.indexOf('@base-color: #FF0000'))
.toBeGreaterThan(-1);
expect(customSettings.indexOf('@accent-color: #FAFAFA'))
.toBeGreaterThan(-1);
});
});
@@ -0,0 +1,20 @@
'use babel';
import setFontSize from '../../lib/fonts/set-font-size';
describe('Font size setter', () => {
const root = document.documentElement;
it('should be able to change root element\'s font-size', () => {
expect(root.style.fontSize).toBe('');
setFontSize(22);
expect(root.style.fontSize).toBe('22px');
});
it('should be able to unset root element\'s font-size', () => {
setFontSize(22);
expect(root.style.fontSize).toBe('22px');
setFontSize(null);
expect(root.style.fontSize).toBe('');
});
});
@@ -0,0 +1,17 @@
'use babel';
import toCamelCase from '../../lib/helper/to-camel-case';
describe('camelCaseHelper', () => {
it('should convert spaces to camelCase', () => {
expect(toCamelCase('hello world')).toEqual('helloWorld');
});
it('should convert lisp-case to camelCase', () => {
expect(toCamelCase('hello-world')).toEqual('helloWorld');
});
it('should convert snake_case to camelCase', () => {
expect(toCamelCase('hello_world')).toEqual('helloWorld');
});
});
@@ -0,0 +1,19 @@
'use babel';
import toggleClassName from '../../lib/helper/toggle-class-name';
describe('className toggle helper', () => {
const root = document.documentElement;
it('should add a className to the root element', () => {
expect(root.classList.contains('testClass')).toBe(false);
toggleClassName('testClass', true);
expect(root.classList.contains('testClass')).toBe(true);
});
it('should remove a className from the root element', () => {
expect(root.classList.contains('testClass')).toBe(true);
toggleClassName('testClass', false);
expect(root.classList.contains('testClass')).toBe(false);
});
});