|
| 1 | +import invokePlugin from '../util/invokePlugin' |
| 2 | +import plugin from '../../src/plugins/divideColor' |
| 3 | + |
| 4 | +test('generating divide color utilities', () => { |
| 5 | + const config = { |
| 6 | + theme: { |
| 7 | + divideColor: { |
| 8 | + default: 'orange', // This should be ignored |
| 9 | + purple: 'purple', |
| 10 | + white: { |
| 11 | + 25: 'rgba(255,255,255,.25)', |
| 12 | + 50: 'rgba(255,255,255,.5)', |
| 13 | + 75: 'rgba(255,255,255,.75)', |
| 14 | + default: '#fff', |
| 15 | + }, |
| 16 | + red: { |
| 17 | + 1: 'rgb(33,0,0)', |
| 18 | + 2: 'rgb(67,0,0)', |
| 19 | + 3: 'rgb(100,0,0)', |
| 20 | + }, |
| 21 | + green: { |
| 22 | + 1: 'rgb(0,33,0)', |
| 23 | + 2: 'rgb(0,67,0)', |
| 24 | + 3: 'rgb(0,100,0)', |
| 25 | + }, |
| 26 | + blue: { |
| 27 | + 1: 'rgb(0,0,33)', |
| 28 | + 2: 'rgb(0,0,67)', |
| 29 | + 3: 'rgb(0,0,100)', |
| 30 | + }, |
| 31 | + }, |
| 32 | + }, |
| 33 | + variants: { |
| 34 | + divideColor: ['responsive'], |
| 35 | + }, |
| 36 | + } |
| 37 | + |
| 38 | + const { utilities } = invokePlugin(plugin(), config) |
| 39 | + |
| 40 | + expect(utilities).toEqual([ |
| 41 | + [ |
| 42 | + { |
| 43 | + '.divide-purple > :not(template) ~ :not(template)': { |
| 44 | + 'border-color': 'purple', |
| 45 | + }, |
| 46 | + '.divide-white-25 > :not(template) ~ :not(template)': { |
| 47 | + 'border-color': 'rgba(255,255,255,.25)', |
| 48 | + }, |
| 49 | + '.divide-white-50 > :not(template) ~ :not(template)': { |
| 50 | + 'border-color': 'rgba(255,255,255,.5)', |
| 51 | + }, |
| 52 | + '.divide-white-75 > :not(template) ~ :not(template)': { |
| 53 | + 'border-color': 'rgba(255,255,255,.75)', |
| 54 | + }, |
| 55 | + '.divide-white > :not(template) ~ :not(template)': { |
| 56 | + 'border-color': '#fff', |
| 57 | + }, |
| 58 | + '.divide-red-1 > :not(template) ~ :not(template)': { |
| 59 | + 'border-color': 'rgb(33,0,0)', |
| 60 | + }, |
| 61 | + '.divide-red-2 > :not(template) ~ :not(template)': { |
| 62 | + 'border-color': 'rgb(67,0,0)', |
| 63 | + }, |
| 64 | + '.divide-red-3 > :not(template) ~ :not(template)': { |
| 65 | + 'border-color': 'rgb(100,0,0)', |
| 66 | + }, |
| 67 | + '.divide-green-1 > :not(template) ~ :not(template)': { |
| 68 | + 'border-color': 'rgb(0,33,0)', |
| 69 | + }, |
| 70 | + '.divide-green-2 > :not(template) ~ :not(template)': { |
| 71 | + 'border-color': 'rgb(0,67,0)', |
| 72 | + }, |
| 73 | + '.divide-green-3 > :not(template) ~ :not(template)': { |
| 74 | + 'border-color': 'rgb(0,100,0)', |
| 75 | + }, |
| 76 | + '.divide-blue-1 > :not(template) ~ :not(template)': { |
| 77 | + 'border-color': 'rgb(0,0,33)', |
| 78 | + }, |
| 79 | + '.divide-blue-2 > :not(template) ~ :not(template)': { |
| 80 | + 'border-color': 'rgb(0,0,67)', |
| 81 | + }, |
| 82 | + '.divide-blue-3 > :not(template) ~ :not(template)': { |
| 83 | + 'border-color': 'rgb(0,0,100)', |
| 84 | + }, |
| 85 | + }, |
| 86 | + ['responsive'], |
| 87 | + ], |
| 88 | + ]) |
| 89 | +}) |
0 commit comments